From: John Tsiombikas Date: Thu, 16 Jun 2022 02:09:22 +0000 (+0300) Subject: initial commit X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=bootcard;a=commitdiff_plain;h=b8755ce740a1c9a75d44c9f5ac694b04defe15cd initial commit --- b8755ce740a1c9a75d44c9f5ac694b04defe15cd diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..52f0c45 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.swp +*.img +*.bin diff --git a/Makefile b/Makefile new file mode 100644 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 index 0000000..eb9b704 --- /dev/null +++ b/bootcard.asm @@ -0,0 +1,42 @@ +; ---- boot me! ---- +; nasm -f bin -o bootcard.img bootcard.asm +; cat bootcard.img >/dev/ +; 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: