_readsector42:
SBPBI(0x10, Xdap+0) /* packet size */
SBPBI(0x00, Xdap+1) /* reserved */
SBPBI(0x01, Xdap+2) /* number of blocks to transfer */
SBPBI(0x00, Xdap+3) /* reserved */
SBPWI(0x7C00, Xdap+4) /* transfer buffer :offset */
SBPWI(0x0000, Xdap+6) /* transfer buffer seg: */
LXW(0x08, xDI, rAX) /* LBA (64-bits) */
SBPW(rAX, Xdap+8)
LXW(0x0A, xDI, rAX)
SBPW(rAX, Xdap+10)
SBPWI(0x0000, Xdap+12)
SBPWI(0x0000, Xdap+14)
MW(rBP, rSI) /* disk address packet */
LBI(0x42, rAH) /* extended read */
BIOSCALL(0x13) /* CF set on failure */
JCC _readsectorok
LWI(ioerror(SB), rSI)
CALL16(buggery(SB))
/*
* Read a sector from a disc using the traditional BIOS call.
* For BIOSCALL(0x13/AH=0x02):
* rAH 0x02
* rAL number of sectors to read (1)
* rCH low 8 bits of cylinder
* rCL high 2 bits of cylinder (7-6), sector (5-0)
* rDH head
* rDL drive
* rES:rBX buffer address
*/
_readsector2:
LXB(0x01, xDI, rDH) /* head */
LXW(0x02, xDI, rCX) /* save active cylinder/sector */
/*
* Jump to the loaded PBS.
* rDL and rSI should still contain the drive
* and partition table pointer respectively.
*/
MW(rDI, rSI)
FARJUMP16(0x0000, 0x7C00)
_bbnotok:
LWI(invalidPBS(SB), rSI)
TEXT buggery(SB), $0
CALL16(BIOSputs(SB))
LWI(reboot(SB), rSI)
CALL16(BIOSputs(SB))
_wait:
CLR(rAX) /* wait for any key */
BIOSCALL(0x16)
_reset:
CLR(rBX) /* set ES segment for BIOS area */
MTSR(rBX, rES)
/*
* Output a string to the display.
* String argument is in rSI.
*/
TEXT BIOSputs(SB), $0
PUSHA
CLR(rBX)
_BIOSputs:
LODSB
ORB(rAL, rAL)
JEQ _BIOSputsret