Last active
September 3, 2016 07:26
-
-
Save kunst1080/0fad4270b1bc05e2f72c468bab29c144 to your computer and use it in GitHub Desktop.
Hello world
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; boot.asm | |
; setup segment register | |
mov ax, 0x07c0 | |
mov ds, ax | |
; setup display | |
mov ah, 0x0 ;setup video mode | |
mov al, 0x3 ;0x3 = text mode, color, 80x25 | |
int 0x10 ;0x10 = video service | |
mov si, msg ;target of lodsb | |
mov ah, 0x0E ;0x0E = tty | |
print_character_loop: | |
lodsb | |
or al, al | |
jz hang ;jump if zero | |
int 0x10 ;when ah is 0x0E, then print | |
jmp print_character_loop | |
msg: | |
db 'Hello World!', 13, 10, 0 ;13 = \r, 10 = \n, 0 = NULL | |
hang: | |
jmp hang | |
times 510-($-$$) db 0 | |
; this is a comment | |
db 0x55 | |
db 0xAA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boot.bin: boot.asm | |
nasm -f bin boot.asm -o boot.bin | |
qemu: boot.bin | |
qemu-system-x86_64 -curses boot.bin | |
clean: | |
rm *.bin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
参考URL