From dad80532abb43ca6256a08fd3b21aacf0f013b22 Mon Sep 17 00:00:00 2001 From: Ain <41307858+nero@users.noreply.github.com> Date: Sun, 31 Mar 2019 13:22:24 +0000 Subject: [PATCH] Allow arbitrary floppy sizes --- Makefile | 18 +++++++++++------- boot/{fat12vbr.asm => floppy.asm} | 0 2 files changed, 11 insertions(+), 7 deletions(-) rename boot/{fat12vbr.asm => floppy.asm} (100%) diff --git a/Makefile b/Makefile index 0ef9e4b..f558602 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,19 @@ +FD_CYLINDERS = 40 +FD_HEADS = 2 +FD_SECTORS = 9 + default: kernel.com -boot.bin: kernel/*.asm +kernel.bin: kernel/*.asm nasm -s -o $@ -I kernel kernel/main.asm -%.bin: boot/%.asm +boot/%.bin: boot/%.asm nasm -s -o $@ -I lib $< -fdimage.img: fat12vbr.bin boot.bin - dd if=/dev/zero bs=512 count=720 of=$@ - mformat -i $@ -f 360 -B fat12vbr.bin :: - mcopy -i fdimage.img boot.bin ::boot.bin +fdimage.img: boot/floppy.bin kernel.bin + dd if=/dev/zero bs=512 count=$$(( $(FD_CYLINDERS) * $(FD_HEADS) * $(FD_SECTORS) )) of=$@ + mformat -i $@ -t $(FD_CYLINDERS) -h $(FD_HEADS) -n $(FD_SECTORS) -B boot/floppy.bin :: + mcopy -i fdimage.img kernel.bin ::boot.bin clean: - rm -f *.com *.bin *.img + rm -f *.com *.bin *.img boot/*.bin diff --git a/boot/fat12vbr.asm b/boot/floppy.asm similarity index 100% rename from boot/fat12vbr.asm rename to boot/floppy.asm