Trouble with INT 13, AH=42, copying sectors from CDROM
Posted: Mon Jun 17, 2019 10:28 pm
I'm writing a boot loader, attempting to load the next few sectors from the boot CD. I've got a handful of things working (printing to screen via bios, etc).
So far, I have:
I've tried specifying a couple of different sector numbers to copy, which have non-zero values in the first byte, so that I can easily spot them, but no luck.
I'm trying to use 0x500 as the destination address for the sector read, as that's where I'm going to continue the loader.
I've also tried specifying the destination address as 0x00500000 (50:0000 in segment form should equal 0x500, correct?)
Here are the relevant bits of code:
Is there anything glaringly wrong here? Any advice would be much appreciated. If I've left out any crucial information, please let me know.
So far, I have:
- Built my .iso in non-emulation mode, and assuming 2048-byte sectors
- Checked the drive id left in DL by the bios, and it's 0xE0 (indicating the CDROM drive, according to various references)
- Set cs/ds/es/ss to 0x7c0 (using org 0)
- Checked that int 13 extensions are available using int 13, AH=0x41 (They are. The feature mask is 7, indicating full support)
- Set up a disk access packet structure and populated it with the values for the int 13, AH=0x42 call
- Checked that the carry is not set (it's not), and that the return code in AH is 0 (it is)
I've tried specifying a couple of different sector numbers to copy, which have non-zero values in the first byte, so that I can easily spot them, but no luck.
I'm trying to use 0x500 as the destination address for the sector read, as that's where I'm going to continue the loader.
I've also tried specifying the destination address as 0x00500000 (50:0000 in segment form should equal 0x500, correct?)
Here are the relevant bits of code:
Code: Select all
mov ax, 0x4200
mov dl, [driveid]
mov byte [dap.size], 0x10
mov byte [dap.unused], 0
mov word [dap.nsectors], 1 ; 1 sector should be 2048 bytes
mov dword [dap.dst], 0x00000500
mov dword [dap.start_sector], 16 ; Sector 16 (the boot sector, just for testing purposes, starting at 0x8000 on the .iso)
mov si, dap
int 0x13
; carry / AX indicate no errors
cmp word [0x500], 0x0143 ; these happen to be the first 2 bytes from 0x8000 on the .iso
; ...but the word at 0x500 isn't 0x0143, it's 0.
; ...
dap:
.size resb 1
.unused resb 1
.nsectors resw 1
.dst resd 1
.start_sector resq 1