Skip to content

Instantly share code, notes, and snippets.

@nramsbottom
Created January 18, 2021 20:32
Show Gist options
  • Save nramsbottom/dbff2f718e9cf863c98e5e50d83bc13f to your computer and use it in GitHub Desktop.
Save nramsbottom/dbff2f718e9cf863c98e5e50d83bc13f to your computer and use it in GitHub Desktop.
Simple Bootloader
; dd if=/dev/zero of=boot.img count=1440 bs=1k
; nasm boot.asm -f bin -o boot.bin
; dd if=boot.bin bs=512 of=boot.img conv=notrunc
; od -t x1 -A n boot.bin
; A simple boot sector that prints a message to the screen using a BIOS routine.
;
mov ah,0x0e ; int 10/ ah = 0eh -> scrolling teletype BIOS routine
mov al,'H'
int 0x10
mov al,'e'
int 0x10
mov al,'l'
int 0x10
mov al,'l'
int 0x10
mov al,'o'
int 0x10
mov ah, 0x00
int 0x16
mov ah, 0x0e
int 0x10
jmp $ ; Jump to the current address ( i.e. forever ).
;
; Padding and magic BIOS number.
;
times 510 -($-$$) db 0 ; Pad the boot sector out with zeros
dw 0xaa55 ; Last two bytes form the magic number ,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment