Skip to content

Instantly share code, notes, and snippets.

@mutoo
Created May 21, 2013 05:13
Show Gist options
  • Save mutoo/5617603 to your computer and use it in GitHub Desktop.
Save mutoo/5617603 to your computer and use it in GitHub Desktop.
the simplest operating system that only shows the words "Hello,OS!" on screen after computer startup
org 07c00h ; tell the complier put this code to 0x7c00
%endif
mov ax, cs
mov ds, ax
mov es, ax
call DispStr ; call sub-func
jmp $ ; while(1); $ means current address;
DispStr:
mov ax, BootMessage
mov bp, ax
mov cx, 16
mov ax, 01301h
mov bx, 000ch
mov dl, 0
int 10h
ret
BootMessage: db "Hello, OS!"
times 510-($-$$) db 0 ; $$ means the beginning of this section
; in this case is 0x07cc
dw 0xaa55 ; end flag; known as boot section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment