Skip to content

Instantly share code, notes, and snippets.

@andydude
Last active August 14, 2024 01:05
Show Gist options
  • Save andydude/3c599caa975f62bc886feb1b77133931 to your computer and use it in GitHub Desktop.
Save andydude/3c599caa975f62bc886feb1b77133931 to your computer and use it in GitHub Desktop.
First attempt at a master boot record.
[bits 16]
[org 0x7C00]
start:
cli
xor si,si
mov ss,si
mov sp,0x7DBE
popa
mov es,si
mov ax,0x201
int 0x13
jmp 0x0:0x7E00
times 0x1BC - ($-$$) db 0
mbr:
dw 0x7E00
dw 0x0180
dw 0x0001
dw 0x7F0B
dw 0xFDBF
dw 0x003F
dw 0x0000
dw 0x40C1
dw 0x005E
times 0x1FE - ($-$$) db 0
sig:
dw 0xAA55
@Googulator
Copy link

Not sure about the purpose, but if you ever plan to use this for anything serious, some BIOSes require the first instruction (first 2 bytes) to be "33 C0" ("xor ax, ax", but alternatively encoded) to identify the MBR as "modern" and disable workarounds for old DOS variants. Learned this the hard way with builder-hex0.

@andydude
Copy link
Author

I believe the original purpose was to load a VBR and jump do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment