diff --git a/boot.asm b/boot.asm index 7cc5e13..d32bcde 100644 --- a/boot.asm +++ b/boot.asm @@ -1,18 +1,20 @@ -; SPDX-License-Identifier: MPL-2.0 -; SPDX-FileCopyrightText: (c) 2025 A.M. Rowsell -.section "boot","acrx" -.global zone_setup -.global os_warm_boot -.extern os_main_loop + ; SPDX-License-Identifier: MPL-2.0 + ; SPDX-FileCopyrightText: (c) 2025 A.M. Rowsell + .section "boot", "acrx" + .global zone_setup + .global os_warm_boot + .extern os_main_loop + + ; ================================== + ; This is the cold boot entry point! + ; It is linked to land at 0xC3C3 + ; ================================== -; ================================== -; This is the cold boot entry point! -; It is linked to land at 0xC3C3 -; ================================== _start: zone_setup: - ld sp, 0x6FFF - jp os_main_loop + ld a, ixl + ld sp, 0x6FFF + jp os_main_loop os_warm_boot: - ret + ret diff --git a/zone.asm b/zone.asm index b8adfea..39a949a 100644 --- a/zone.asm +++ b/zone.asm @@ -4,33 +4,30 @@ ; ZONE OS main section ; ============================================================ .section "zone", "acrx" - .global zone_start .global os_print_vec .global os_getch_vec .global os_outbyte_vec .global os_inbyte_vec .global os_main_loop + .local os_print_signon .set UARTSTATUS, 6 .set UARTDATA, 7 -zone_start: - ret - os_print_vec: ; this takes a character in a and sends it to the UART push af push bc push de ld d, a - ld bc, UARTSTATUS + 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 bc, UARTDATA + ld c, UARTDATA out (c), a; send byte to uart pop de pop bc @@ -38,6 +35,17 @@ $1: ret os_getch_vec: + ; 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: @@ -63,13 +71,43 @@ os_inbyte_vec: ret 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: - .string "ZONE OS ver. 0.01" + .byte "ZONE OS ver. 0.01" + .byte 10, 13, 0 zoneCopyright: - .string "(c) A.M. Rowsell, license MPLv2" + .byte "(c) A.M. Rowsell, license MPLv2" + .byte 10, 13, 0 zonePrompt: .string "z] "