First commit

This commit is contained in:
Juhani Krekelä 2021-06-28 21:33:23 +03:00
commit 521fd1be2b
3 changed files with 60 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.bin
*.img

15
Makefile Normal file
View File

@ -0,0 +1,15 @@
.SUFFIXES:
.SUFFIXES: .bin .asm
all: bootsector.bin
.asm.bin:
nasm -fbin -o $@ $<
clean:
rm -f *.bin *.img
run: bootsector.bin
qemu-system-i386 -fda $<
.PHONY: all clean run

43
bootsector.asm Normal file
View File

@ -0,0 +1,43 @@
cpu 8086
org 0x7c00
jmp short _code
nop
; 1440K floppy
; BPB
oemidentifier db "nor86 "
byterpersector dw 512
sectorspercluster db 1
reservedsectors dw 1
fats db 2
rootdirentries dw 224
totalsectors dw 2880
mediadescription db 0xf0
sectorsperfat dw 9
sectorspertrack dw 18
heads dw 2
hiddensectors dd 0
totalsectorslarge dd 0
; EBPB
drivenumber db 0 ; useless
reserved db 0 ; winnt flags
signature db 0x29 ; mkdosfs uses this, dunno how 0x28 differs
serial dd 0
volumelabel db "nor86 boot "
fstype db "FAT12 "
_code:
jmp 0:_start
_start:
mov ax, 0x0e40
int 0x10
hang:
hlt
jmp hang
times 510-($-$$) db 0
db 0x55, 0xaa