Compare commits

...

2 Commits

Author SHA1 Message Date
Juhani Krekelä 7e41612687 Add OS selector to bootloader 2021-06-30 22:56:42 +03:00
Juhani Krekelä 96dcfa48bb Add support for 360K disk images as well 2021-06-30 22:56:15 +03:00
3 changed files with 59 additions and 5 deletions

View File

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

View File

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

View File

@ -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
@ -45,6 +67,28 @@ _start:
; Save bootdrive
mov [drivenumber], dl
select_os:
mov ah, 0xe
mov si, prompt
.print:
lodsb
test al, al
jz .end
int 0x10
jmp .print
.end:
xor ax, ax
int 0x16
cmp al, 'e'
jne calc_constants
mov si, ettinos_kernel_name
mov di, kernel_name
mov cx, 11
rep movsb
calc_constants:
; Disk organization:
; Reserved sectors (MBR)
@ -288,9 +332,9 @@ chs:
pop ax
ret
%include "hexprint.inc"
prompt: db "Select OS. 'e' for EttinOS, any other key Nor86.", 0
kernel_name: db "KERNEL BIN"
ettinos_kernel_name: db "SYSTEM BIN"
times 510-($-$$) db 0
db 0x55, 0xaa