So far, I have this:
Code: Select all
mov si, Code ;set SI to code area
mov di, 0x0600 ;set DI to some location (destination)
push word 0x0000 ;segment
push word 0x0600 ;offset
cld
mov cx, 0x0200
rep movsb
retf
Code:
[i]More code here - print to screen and hang[/i]
This seems to work fine, as it prints to screen and hangs as expected.
The problem comes with my next phase. I am using int13 and ah=42h to read a sector into memory. This is just a 'garbage' sector for now (I don't jump to it), as I'm just testing. Whenever I read a sector to 0x7c00, it doesn't print to screen, or prints garbage. Reading to other locations is fine.
I think I'm not relocating my boot sector correctly, and int13 is overwriting running code in memory. Does this sound right? Any pointers to get me in the right direction?
For reference, here is the DAP:
Code: Select all
DAPSize db 0x10 ;byte - size of packet (16 bytes)
DAPNULL db 0x00 ;byte - NULL
DAPSectors dw 0x0001 ;word - number of sectors to transfer
DAPOffset dw 0x7e00 ;dword - buffer (segment:offset) - remember little-endian, and align to word boundary
DAPSegment dw 0x0000
DAPLBA dd 0x0000003f ;dword - starting LBA
DAPLBA48 dd 0x00000000 ;dword - used for 48-bit LBA