dev: started to add OS functions

This commit is contained in:
A.M. Rowsell 2026-01-12 13:09:50 -05:00
commit fc244f8481
Signed by: amr
GPG key ID: E0879EDBDB0CA7B1
4 changed files with 1607 additions and 1474 deletions

View file

@ -6,9 +6,12 @@ MAP=zone.map
ASMFLAGS=-Fvobj ASMFLAGS=-Fvobj
LINKFLAGS=-b ihex -T linker.cmd -M LINKFLAGS=-b ihex -T linker.cmd -M
BINLINKFLAGS=-b rawbin -T linker.cmd -M
all: zone.hex all: zone.hex
binary: zone.bin
float.o: float.asm float.o: float.asm
$(ASM) $(ASMFLAGS) -o $@ $< $(ASM) $(ASMFLAGS) -o $@ $<
@ -24,7 +27,10 @@ boot.o: boot.asm
zone.hex: float.o vectorTable.o zone.o boot.o linker.cmd zone.hex: float.o vectorTable.o zone.o boot.o linker.cmd
$(LINK) $(LINKFLAGS) -o $@ float.o vectorTable.o zone.o boot.o > $(MAP) $(LINK) $(LINKFLAGS) -o $@ float.o vectorTable.o zone.o boot.o > $(MAP)
zone.bin: float.o vectorTable.o zone.o boot.o linker.cmd
$(LINK) $(BINLINKFLAGS) -o $@ float.o vectorTable.o zone.o boot.o > $(MAP)
clean: clean:
rm -f float.o vectorTable.o zone.o boot.o zone.hex $(MAP) rm -f float.o vectorTable.o zone.o boot.o zone.hex zone.bin $(MAP)
.PHONY: all clean .PHONY: all clean

View file

@ -9,6 +9,7 @@
; This is the cold boot entry point! ; This is the cold boot entry point!
; It is linked to land at 0xC3C3 ; It is linked to land at 0xC3C3
; ================================== ; ==================================
_start:
zone_setup: zone_setup:
ld sp, 0x6FFF ld sp, 0x6FFF
jp os_main_loop jp os_main_loop

2809
float.asm

File diff suppressed because it is too large Load diff

103
zone.asm
View file

@ -1,30 +1,97 @@
; SPDX-License-Identifier: MPL-2.0 ; SPDX-License-Identifier: MPL-2.0
; SPDX-FileCopyrightText: (c) 2025 A.M. Rowsell ; SPDX-FileCopyrightText: (c) 2025 A.M. Rowsell
; ============================================================ ; ============================================================
; ZONE OS main section ; ZONE OS main section
; ============================================================ ; ============================================================
.section "zone","acrx" .section "zone", "acrx"
.global zone_start .global zone_start
.global os_print_vec .global os_print_vec
.global os_getch_vec .global os_getch_vec
.global os_outbyte_vec .global os_outbyte_vec
.global os_inbyte_vec .global os_inbyte_vec
.global os_main_loop .global os_main_loop
.set UARTSTATUS, 6
.set UARTDATA, 7
zone_start: zone_start:
ret ret
os_print_vec: os_print_vec:
ret ; this takes a character in a and sends it to the UART
push af
push bc
push de
ld d, a
ld bc, UARTSTATUS
$1:
in a, (c); get status byte
bit 0, a; test bit 0
jr z, $1; jump back if UART not ready
ld a, d
ld bc, UARTDATA
out (c), a; send byte to uart
pop de
pop bc
pop af
ret
os_getch_vec: os_getch_vec:
ret ret
os_outbyte_vec: os_outbyte_vec:
ret ; this takes a byte in a and sends it to port in hl
push af
push bc
push hl
ld c, l
out (c), a
pop hl
pop bc
pop af
ret
os_inbyte_vec: os_inbyte_vec:
ret ; this gets a byte from port in hl and returns it in a
push bc
push hl
ld c, l
in a, (c)
pop hl
pop bc
ret
os_main_loop: os_main_loop:
jp os_main_loop jp os_main_loop
zoneSignon:
.string "ZONE OS ver. 0.01"
zoneCopyright:
.string "(c) A.M. Rowsell, license MPLv2"
zonePrompt:
.string "z] "
; error messages
errorSyntax:
.string "Syntax error!"
errorTimeout:
.string "Command timed out."
errorNotFound:
.string "Command/file not found."
errorHardware:
.string "Hardware error!"
errorRAMFailed:
.string "RAM test failed!"
stringTable:
.word zoneSignon, zoneCopyright, zonePrompt
.word errorSyntax, errorTimeout, errorNotFound
.word errorHardware, errorRAMFailed