From 725213b581d43be372cd6835564be5a092a02e49 Mon Sep 17 00:00:00 2001 From: Nero <41307858+nero@users.noreply.github.com> Date: Sat, 11 Dec 2021 16:46:00 +0000 Subject: [PATCH] sys: parse drive number and load BPB --- Makefile | 13 ++-- src/@rdos.asm | 4 ++ {com => src}/hello.asm | 0 src/parse.inc | 63 +++++++++++++++++ src/print.inc | 75 ++++++++++++++++++++ src/symbols.inc | 157 +++++++++++++++++++++++++++++++++++++++++ src/sys.asm | 87 +++++++++++++++++++++++ src/testsym.asm | 42 +++++++++++ 8 files changed, 436 insertions(+), 5 deletions(-) create mode 100644 src/@rdos.asm rename {com => src}/hello.asm (100%) create mode 100644 src/parse.inc create mode 100644 src/print.inc create mode 100644 src/symbols.inc create mode 100644 src/sys.asm create mode 100644 src/testsym.asm diff --git a/Makefile b/Makefile index b4c5854..bb1e6d9 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ PRODUCT = rdos LABEL = $(PRODUCT) $(VERSION) NASM = nasm -NASM_ARGS = -s -Ilib -DPRODUCT=$(PRODUCT) -DVERSION=$(VERSION) +NASM_ARGS = -s -Ilib --before "cpu 8086" -DPRODUCT=$(PRODUCT) -DVERSION=$(VERSION) QEMU_ARGS += $(shell test -w /dev/kvm && echo --enable-kvm) @@ -28,7 +28,7 @@ SYS = host/sys.elf FIXROM = host/fix-rom.elf .PHONY: default clean qemu-floppy5 qemu-floppy3 -.PRECIOUS: $(DISTFILES) +.PRECIOUS: %.com default: fd1440.img @@ -37,7 +37,7 @@ host/%.elf: host/%.c $(CC) -o $@ $< # COM programs -%.com: com/%.asm +%.com: src/%.asm src/*.inc $(NASM) $(NASM_ARGS) -o $@ $< # Bootloaders, first sector on partition @@ -86,5 +86,8 @@ qemu-hdd: hdd.img $(ROMS) qemu-uartctrl: uartctrl.rom chartab.bs $(QEMU) $(QEMU_ARGS) -option-rom uartctrl.rom -serial stdio -hda chartab.bs -dosbox-%: %.com - dosbox -c "mount P $(CURDIR)" -c "P:" -c "$< $(ARGS)" +dosbox-%: %.com fd1440.img + dosbox -c "mount P $(CURDIR)" -c "P:" -c "IMGMOUNT A: FD1440.IMG -t floppy" -c "$< $(ARGS)" -c "pause" -c "exit" + +emu2-%: %.com + emu2 $< $(ARGS) diff --git a/src/@rdos.asm b/src/@rdos.asm new file mode 100644 index 0000000..cd4f9f8 --- /dev/null +++ b/src/@rdos.asm @@ -0,0 +1,4 @@ + mov ax, 0x0e38 + int 0x10 +halt hlt + jmp halt diff --git a/com/hello.asm b/src/hello.asm similarity index 100% rename from com/hello.asm rename to src/hello.asm diff --git a/src/parse.inc b/src/parse.inc new file mode 100644 index 0000000..1330b75 --- /dev/null +++ b/src/parse.inc @@ -0,0 +1,63 @@ + ; make a char uppercase + ; IN al char + ; OUT al char + ; do nothing if >z +ucase cmp al, 0x7B + jnc .ret + ; do nothing if