initial commit
authorJohn Tsiombikas <nuclear@member.fsf.org>
Thu, 16 Jun 2022 02:09:22 +0000 (05:09 +0300)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Thu, 16 Jun 2022 02:09:22 +0000 (05:09 +0300)
.gitignore [new file with mode: 0644]
Makefile [new file with mode: 0644]
bootcard.asm [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..52f0c45
--- /dev/null
@@ -0,0 +1,3 @@
+*.swp
+*.img
+*.bin
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..014f1ca
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,20 @@
+bin = bootcard.img
+
+$(bin): bootcard.asm
+       nasm -f bin -o $@ $<
+
+.PHONY: clean
+clean:
+       rm -f $(bin)
+
+.PHONY: run
+run: $(bin)
+       qemu-system-i386 -hda $<
+
+.PHONY: debug
+debug: $(bin)
+       qemu-system-i386 -S -s -hda $<
+
+.PHONY: disasm
+disasm: $(bin)
+       ndisasm -o 0x7c00 $< >dis
diff --git a/bootcard.asm b/bootcard.asm
new file mode 100644 (file)
index 0000000..eb9b704
--- /dev/null
@@ -0,0 +1,42 @@
+; ---- boot me! ----
+; nasm -f bin -o bootcard.img bootcard.asm
+; cat bootcard.img >/dev/<usbstickdevice>
+; reboot
+
+       org 7c00h
+       bits 16
+
+       xor ax, ax
+       mov ds, ax
+       mov ss, ax
+
+       mov ax, 13h
+       int 10h
+
+       mov ax, 0a000h
+       mov es, ax
+       mov ax, 0303h
+       mov cx, 32000
+       rep stosw
+
+infloop:
+       hlt
+       jmp infloop
+
+       times 446-($-$$) db 0
+       db 80h          ; active partition
+       db 20h          ; start head
+       db 21h          ; start cylinder
+       db 0            ; start sector
+       db 0ch          ; type
+       db 28h          ; last head
+       db 20h          ; last cylinder
+       db 08h          ; last sector
+       dd 00000800h    ; first lba
+       dd 0001f800h    ; number of sectors (lba)
+
+
+       times 510-($-$$) db 0
+       dw 0aa55h
+
+; vi:ft=nasm ts=8 sts=8 sw=8: