Allow arbitrary floppy sizes

This commit is contained in:
Nero 2019-03-31 13:22:24 +00:00
parent 208b2f95b5
commit dad80532ab
2 changed files with 11 additions and 7 deletions

View File

@ -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