Hi,
The BIOS functions usually use 8 bit ISA DMA transfers, which can't cross a 64 Kb boundary. If the DMA tried to do your transfer it'd fill from 0x0001FA00 to 0x0001FFFF with the first 3 sectors. Then it'd wrap around to the start of the 64 Kb area, and fill from 0x00010000 to 0x00011DFF with the remaining 15 sectors.
To avoid this problem the BIOS returns an error instead. In this case the error code (returned in AH when carry is set) would be 0x09 - "DMA across 64 Kb boundary".
To fix it you could split your read into 2 parts:
Code: Select all
readtrack7a:
mov ax, 0x1fa0
mov es, ax
mov bx, 0x00
mov ah, 0x02
mov al, 3
mov ch, 3
mov cl, 1
mov dh, 1
mov dl, 0
int 13h
jc readtrack7a
readtrack7b:
mov ax, 0x2000
mov es, ax
mov bx, 0x00
mov ah, 0x02
mov al, 15
mov ch, 3
mov cl, 4
mov dh, 1
mov dl, 0
int 13h
jc readtrack7b
Although it might be a good idea to handle disk errors properly, for e.g.:
Code: Select all
readdata:
mov si, 3
.retry:
pusha
mov ah, 2
mov es, di
mov bx, 0
mov dl, 0
int 0x13
jnc .ok
sub si, 1
jb .error
popa
jmp .retry
.error:
printf("Error %d reading boot image\n", AH);
popa
jmp abortboot
.ok:
popa
ret
abortboot:
printf("Boot aborted, press control+alt+del to reboot\n");
.die:
jmp .die
Then you could use:
Code: Select all
mov di, 0x1fa0
mov al, 3
mov ch, 3
mov cl, 1
mov dh, 1
call readdata
mov di, 0x2000
mov al, 15
mov ch, 3
mov cl, 4
mov dh, 1
call readdata
Cheers,
Brendan