From 96dcfa48bbb885460e296a5f57790f30b3c20858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Wed, 30 Jun 2021 22:56:15 +0300 Subject: [PATCH] Add support for 360K disk images as well --- Makefile | 8 +++++--- README.md | 8 ++++++++ bootsect.asm | 22 ++++++++++++++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index fed4dfc..542177d 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +FLOPPY = 1440 + .SUFFIXES: .SUFFIXES: .bin .asm @@ -5,15 +7,15 @@ all: nor86.img nor86.img: bootsect.bin kernel.bin CC0 README.md rm -f $@ - mkdosfs -C $@ 1440 + mkdosfs -C $@ $(FLOPPY) rw -i bootsect.bin -o $@ mcopy -i $@ CC0 :: mcopy -i $@ README.md :: mcopy -i $@ kernel.bin :: .asm.bin: - nasm -fbin -o $@ $< - nasm -MD $@.d -fbin -o $@ $< + nasm -fbin -d F$(FLOPPY) -o $@ $< + nasm -MD $@.d -d F$(FLOPPY) -fbin -o $@ $< clean: rm -f *.bin *.img *.bin.d diff --git a/README.md b/README.md index 2bb1e9a..5988bab 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,11 @@ Nor86 operating system Nor86 is a real-mode operating system targeting IBM PC compatibles with 64K or more RAM. It is inspired by [EttinOS](https://ahti.space/git/crazyettin/EttinOS). + +Floppy sizes +------------ + +You can build either a 1440K or a 360K floppy image from Nor86 sources, the +default being 1440K. To build a 360K floppy instead, run: + + make FLOPPY=360 diff --git a/bootsect.asm b/bootsect.asm index 61dd4df..cbb3122 100644 --- a/bootsect.asm +++ b/bootsect.asm @@ -4,6 +4,7 @@ org 0x7c00 jmp short _code nop +%ifdef F1440 ; 1440K floppy ; BPB oemidentifier db "nor86 " @@ -20,6 +21,27 @@ heads dw 2 hiddensectors dd 0 totalsectorslarge dd 0 +%elifdef F360 +; 360K floppy +; BPB +oemidentifier db "nor86 " +byterpersector dw 512 +sectorspercluster db 2 +reservedsectors dw 1 +fats db 2 +rootdirentries dw 112 +totalsectors dw 720 +mediadescription db 0xfd +sectorsperfat dw 2 +sectorspertrack dw 9 +heads dw 2 +hiddensectors dd 0 +totalsectorslarge dd 0 + +%else +%error "No valid floppy format specified, specify -d F1440 or -d F360" +%endif + ; EBPB drivenumber db 0 ; useless on-disk, used as a variable reserved db 0 ; winnt flags