assembly Tutorials
Creating disk image
nasm boot.asm -f bin -o boot.bin
dd if=boot.bin of=/dev
Running the binary in QEMU
If you don't have an old machine with floppy drive you can still go through the tutorial by using QEMU.
qemu-system-i386 -fda boot.bin
Use the QEMU monitor command to send Ctrl-Alt-Del to the VM:
sendkey ctrl-alt-delete
汇编语言hello world入门
[ORG 0x7c00] xor ax, ax ;make it zero mov ds, ax cld ;Clear Direction Flag mov si, msg call bios_print hang: jmp hang msg: db 'Hello World', 13, 10, 0 bios_print: lodsb or al, al ;zero=end of str jz done ;get out mov ah, 0x0E mov bh, 0 int 0x10 jmp bios_print done: ret times 510-($-$$) db 0 ;NASM's way of saying fill up 512 bytes with zeroes db 0x55,0xAA ;boot signature
制作make文件
#vim Makefile boot.bin:boot.asm nasm boot.asm -f bin -o boot.bin run:boot.bin qemu-system-i386 -fda boot.bin
程序启动命令
make run

浙公网安备 33010602011771号