Compare commits

...

5 commits

6 changed files with 1669 additions and 1491 deletions

2
.gitignore vendored
View file

@ -11,6 +11,6 @@
*.srec *.srec
*.s19 *.s19
*.elf *.elf
*.map
AGENTS.md AGENTS.md
.pre-commit-config.yaml .pre-commit-config.yaml

View file

@ -2,12 +2,16 @@
# SPDX-FileCopyrightText: (c) 2025 A.M. Rowsell # SPDX-FileCopyrightText: (c) 2025 A.M. Rowsell
ASM=vasm_z80_std ASM=vasm_z80_std
LINK=vlink LINK=vlink
MAP=zone.map
ASMFLAGS=-Fvobj ASMFLAGS=-Fvobj
LINKFLAGS=-b ihex -T linker.cmd 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 $@ $<
@ -21,9 +25,12 @@ boot.o: boot.asm
$(ASM) $(ASMFLAGS) -o $@ $< $(ASM) $(ASMFLAGS) -o $@ $<
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 $(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 rm -f float.o vectorTable.o zone.o boot.o zone.hex zone.bin $(MAP)
.PHONY: all clean .PHONY: all clean

View file

@ -1,13 +1,20 @@
; 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
.section "boot","acrx" .section "boot", "acrx"
.global zone_setup .global zone_setup
.global os_warm_boot .global os_warm_boot
.extern os_main_loop .extern os_main_loop
; ==================================
; This is the cold boot entry point!
; It is linked to land at 0xC3C3
; ==================================
_start:
zone_setup: zone_setup:
ld sp, 0x6FFF ld a, ixl
jp os_main_loop ld sp, 0x6FFF
jp os_main_loop
os_warm_boot: os_warm_boot:
ret ret

2809
float.asm

File diff suppressed because it is too large Load diff

View file

@ -2,10 +2,10 @@
/* SPDX-FileCopyrightText: (c) 2025 A.M. Rowsell */ /* SPDX-FileCopyrightText: (c) 2025 A.M. Rowsell */
SECTIONS SECTIONS
{ {
.zone 0xA000 : { *(.zone) *(zone) } .zone 0xA000 : { zone.o(zone) float.o(zone) *(.zone) *(zone) }
.boot 0xC3C3 : { *(.boot) *(boot) } .boot 0xC3C3 : { *(.boot) *(boot) }
.text 0xE000 : { *(.text) *(.float) *(float) }
.vectors 0xF000 : { *(.vectors) } .vectors 0xF000 : { *(.vectors) }
.data 0x7000 : { *(.data) } .data 0x7000 : { *(.data) }
.bss : { *(.bss) } __data_end = .;
.bss __data_end : { *(.bss) }
} }

143
zone.asm
View file

@ -1,30 +1,135 @@
; 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 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 .local os_print_signon
zone_start: .set UARTSTATUS, 6
ret .set UARTDATA, 7
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 c, 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 c, UARTDATA
out (c), a; send byte to uart
pop de
pop bc
pop af
ret
os_getch_vec: os_getch_vec:
ret ; this gets a character from the UART and puts in in a
push bc
ld c, UARTSTATUS
a2:
in a, (c); get status byte
bit 1, a
jr z, a2
ld c, UARTDATA
in a, (c)
pop bc
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 call os_print_signon
os_busy_loop:
jp os_busy_loop
; ======================
; non-vectored functions
; ======================
os_print_signon:
ld hl, zoneSignon
ld a, (hl)
$2:
call os_print_vec
inc hl
ld a, (hl)
jr nz, $2
$3:
ld hl, zoneCopyright
ld a, (hl)
$4:
call os_print_vec
inc hl
ld a, (hl)
jr nz, $4
ret
zoneSignon:
.byte "ZONE OS ver. 0.01"
.byte 10, 13, 0
zoneCopyright:
.byte "(c) A.M. Rowsell, license MPLv2"
.byte 10, 13, 0
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