Created
October 21, 2017 09:16
-
-
Save ghaiklor/89e243a3463569480d01188c9e55e077 to your computer and use it in GitHub Desktop.
Simple boot sector
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
org 0x7C00 ; BIOS loads our programm at this address | |
bits 16 ; We're working at 16-bit mode here | |
start: | |
cli ; Disable the interrupts | |
mov si, msg ; SI now points to our message | |
mov ah, 0x0E ; Indicate BIOS we're going to print chars | |
.loop lodsb ; Loads SI into AL and increments SI [next char] | |
or al, al ; Checks if the end of the string | |
jz halt ; Jump to halt if the end | |
int 0x10 ; Otherwise, call interrupt for printing the char | |
jmp .loop ; Next iteration of the loop | |
halt: hlt ; CPU command to halt the execution | |
msg: db "Hello, World!", 0 ; Our actual message to print | |
;; Magic numbers | |
times 510 - ($ - $$) db 0 | |
dw 0xAA55 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment