Search code examples
assemblybiososdevbochs

BIOS INT13h AH=42h with BOCHS


I got trouble with my bootloader code. I try to use the INT 13h AH=42h: "Extended Read Sectors From Drive" BIOS function of version 3.0 (EDD-3.0) with BOCHS to copy my kernel code from a hard disk image to a memory location above 0x100000 in real mode.

When I use the INT13 AH=41h BX=55AAh function to check for support of EDD-3.0 I get a positive result. I'm using BOCHS 2.6.8.

Disk Address Packet:
db  0x1C    ; size of packet (I tried 18h as well)
db  0x00    ; reserved
db  0x04    ; # blocks to transfer
db  0x00    ; reserved
dw  0xFFFF  ; offset
dw  0xFFFF  ; segment
dq  0x1     ; starting absolute block number (LBA)
dq  0x100000; 64-bit flat target address

I use this DAP. What BOCHS does is copy 4 blocks from disk to FFFF:FFFF mod 100000h = FFEFh. What am I doing wrong? I use Ralf Brown's Interrupt List (http://www.ctyme.com/intr/rb-0708.htm) as reference.


Solution

  • Old BIOSs did not support the "extended disk bios" functions at all.

    Later BIOSs did not support all the features that the latest BIOS versions have.

    I'm sure that even some modern BIOSs do not support "flat target addresses" but only the segment:offset addresses - and the segment:offset field in your structure is 0xFFFF:0xFFFF.

    Such BIOSs will recognize the address 0xFFFF:0xFFFF then.

    Maybe the BIOS in the BOCHS emulator is of that kind.

    BTW: I had a computer where the function did not work correctly if the ES register was not identical to the segment given in the control packet!

    Some other things that may not work with some BIOSs are overflows in the offset part (reading N bytes to address A:B so that (B+N)>0x10000) as well as accessing memory above 0x100000 ((0x10*A+B+N)>0x100000).