Skip to content

Instantly share code, notes, and snippets.

@segfo
Last active August 29, 2015 14:02
Show Gist options
  • Save segfo/0887479489c144fc2823 to your computer and use it in GitHub Desktop.
Save segfo/0887479489c144fc2823 to your computer and use it in GitHub Desktop.
.text
.code16gcc // 16bit-realmode
.intel_syntax noprefix // Intel Syntax
_start:
//Boot Parameter Block start
JMPInstruction: jmp short entry
NoOperation: nop
OEM_name: .ascii "tankaX86"
sect_size: .word 512
culst_size: .byte 1
rsvd_sects: .word 1
fat_cont: .byte 2
root_ents: .word 224
total_sect: .word 2880
media_type: .byte 0xf0
fat_size: .word 9
trk_size: .word 18
head_cont: .word 2
hidd_sect: .long 0
huge_sect: .long 0
boot_dev: .byte 0
reserved: .byte 0
signature: .byte 0x29
vol_ID: .long 0xffffffff
vol_label: .ascii "DISK "
fat_name: .ascii "FAT12 "
//Boot Parameter Block end
entry:
// code located at 0000:7C00,
// CS=0 and IP=0x7c00.
// Stack = 0x7bfe.
xor ax, ax // 31 c0
mov ds, ax // 8e d8
nop // 90
// 5
mov ss,ax // 8e d0
mov sp, 0x7bfe // bc fe 7b
mov al,0x13 // b0 13
// 7
int 0x10 // cd 10
xor ebx,ebx // 66 31 db
//5
mov bl,0xa // b3 0a
shl ebx,16 // 66 c1 e3 10
vwrite:
inc bx // 43
//7
mov al,bh // 88 f8
mov [ebx],ax // 67 89 03
jmp vwrite // eb f8
//7
//IPL 512bytes signature.
//8bytes alignments.
.align 8
// boot signeture
.org 510
.byte 0x55,0xaa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment