NASM Boot Loader weird behavior

I am trying to write a bootloader, but none of my experiments worked until I found this question: Why does this bootloader code not work?

I simplified this program only to write char to the screen.

[ORG 0x7C00] [BITS 16] realstart: jmp start nop start: xor ax,ax mov ds,ax mov es,ax xor bx,bx mov ah, 0x0e print: mov al, "A" int 0x10 end: cli hlt times 510 - ($-$$) db 0 dw 0xAA55 

It compiles fine, but objdump does not have any int 0x10 command.

If I leave the lines ( this file ), everything works fine.

Where is the catch?

(Compilation with NASM 2.08.02-1 on Cygwin Win7 SP1)

+4
source share
2 answers

There seems to be nothing wrong with the code. It would be very strange if disassembling the code using ndisasm would produce a result with no int 0x10. So, I think you are talking about dumping code at runtime. Bootsector usually contains a boot record immediately after the jump instruction (which tells the bootloader about the size of the media and the like). Perhaps the BIOS, for some reason, interferes with what, in his opinion, is a boot record?

0
source
 Bits 16 org 0x7c00 start: xor ax,ax mov ah,0x0E mov al,'A' int 10h mov al,10h int 16h int 19h hlt times 510-($-$$) db 0 dw 0xAA55 

Try this code. If it does not work, let me know.

0
source

All Articles