Skip to content

Instantly share code, notes, and snippets.

@ghaiklor
Created October 21, 2017 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghaiklor/89e243a3463569480d01188c9e55e077 to your computer and use it in GitHub Desktop.
Save ghaiklor/89e243a3463569480d01188c9e55e077 to your computer and use it in GitHub Desktop.
Simple boot sector
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