Test native x86 programs, building bootable images/drives

旧街凉风 提交于 2019-12-04 20:21:58

Just do this:
nasm -f bin -o boot.bin boot.asm
qemu -boot order=a -fda boot.bin

And you should see the message. For other emulators you'll want to pad the image to 1474560 bytes.

boot.asm:

        BITS 16
        ORG 0
        jmp 0x07c0:start

start:
        mov ax, cs
        mov ds, ax

        mov si, msg
        call print_string

hang:
        jmp hang

print_string:
        cld
        lodsb
        or al, al
        jz .done
        mov ah, 0x0E
        int 0x10
        jmp print_string
.done:
        ret

msg:    db 'Hello World!', 13, 10, 0

        times 510-($-$$) db 0
        dw 0xAA55
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!