BIOS HDD write not working (help)
Posted: Sat May 05, 2007 12:02 pm
Why doesn't this piece of code work ?
Im trying to write 6Eh to the hard drive using the BIOS function
AH = 0Bh
AL = number of sectors (01h may be only value supported)
CH = low eight bits of cylinder number
CL = sector number (bits 5-0)
high two bits of cylinder number (bits 7-6)
DH = head number
DL = drive number (80h = first, 81h = second)
ES:BX -> data buffer
I've tried
AH = 03h
AL = number of sectors to write (must be nonzero)
CH = low eight bits of cylinder number
CL = sector number 1-63 (bits 0-5)
high two bits of cylinder (bits 6-7, hard disk only)
DH = head number
DL = drive number (bit 7 set for hard disk)
ES:BX -> data buffer
but when I set the drive number to something other than the floppy drive it doesn't work
any help will be greatly appreciated.
Edit: I got it to work with write disk sectors function... However it doesnt write the byte i specified on BX. I know it accessed the hard drive because my VM tells me but I need to know how to specify that ES:BX so I can tell it what to write.
Code: Select all
install:
mov si, yes
call print
mov ah, 0Bh
mov AL, 01h
mov ch, 01h
mov cl, 02h
mov dh, 00h
mov dl, 80h
mov bx, 6Eh
mov es, bx
int 0x13
jmp $
AH = 0Bh
AL = number of sectors (01h may be only value supported)
CH = low eight bits of cylinder number
CL = sector number (bits 5-0)
high two bits of cylinder number (bits 7-6)
DH = head number
DL = drive number (80h = first, 81h = second)
ES:BX -> data buffer
I've tried
AH = 03h
AL = number of sectors to write (must be nonzero)
CH = low eight bits of cylinder number
CL = sector number 1-63 (bits 0-5)
high two bits of cylinder (bits 6-7, hard disk only)
DH = head number
DL = drive number (bit 7 set for hard disk)
ES:BX -> data buffer
but when I set the drive number to something other than the floppy drive it doesn't work
any help will be greatly appreciated.
Edit: I got it to work with write disk sectors function... However it doesnt write the byte i specified on BX. I know it accessed the hard drive because my VM tells me but I need to know how to specify that ES:BX so I can tell it what to write.