My code works perfectly in virtualbox but not when booted on a real PC (from a USB pen drive which BIOS detects as a USB Hard Drive.)
In virtualbox; the code reads sector 2&3 of the disk to memory, prints the first 128 bytes (as a debug step) then executes the code stored in those sectors.
On my real PC, it successfully prints the correct bytes to screen (so obviously is reading the disk correctly, and writing it to the expected place in memory) but then stops execution at that point rather than jumping.
Why would it be different, and what could I be doing wrong?
ORG 0x7C00;
; Load Sector 2&3 from disk to 0x1000
mov bx , 0x1000
mov ah , 0x02
mov al , 0x02
mov ch , 0x00
mov dh , 0x00
mov cl , 0x02
int 0x13;
;Print 0x1000 + 128 bytes
mov ah, 0x0e
mov bx ,0x1000;
loop2:
mov al, [bx]
cmp bx, 0x1000+128
je end2
int 0x10
add bx , 1;
jmp loop2;
end2:
; Run our code
call 0x1000
jmp $;
TIMES 510 - ($ - $$) DB 0
DW 0xAA55