From f9788348578f3dec38f89ea9079141bbebf4d1ff Mon Sep 17 00:00:00 2001 From: Gale Faraday Date: Wed, 15 Oct 2025 17:51:02 -0500 Subject: [PATCH] feat(bios): BIOS interface accessible through SWI3 --- linkscript | 10 +++++----- src/reset.s | 1 - src/utils.s | 53 ++++++++++++++++++++++++++++++++++++++--------------- src/vecs.s | 17 +++++++++-------- 4 files changed, 52 insertions(+), 29 deletions(-) diff --git a/linkscript b/linkscript index 621478d..55017bc 100644 --- a/linkscript +++ b/linkscript @@ -2,15 +2,15 @@ section RESET load 8000 section SERIAL +; BIOS Interface and Utilities +section BIOSINT load 8800 +section MEMTEST + ; BUZBEE Monitor section BUZBEE section BBHASHES -; Utility functions -section MEMTEST load 8800 -section INTEGRITY - -; Static data +; Static Data section VECTORS high 100000 section VERSION high diff --git a/src/reset.s b/src/reset.s index 6b71523..0eb3e02 100644 --- a/src/reset.s +++ b/src/reset.s @@ -4,7 +4,6 @@ INCLUDE "buzbee.inc" INCLUDE "hardware.inc" - INCLUDE "memtest.inc" INCLUDE "serial.inc" INCLUDE "version.inc" diff --git a/src/utils.s b/src/utils.s index a433dc8..d3d3746 100644 --- a/src/utils.s +++ b/src/utils.s @@ -6,6 +6,44 @@ INCLUDE "serial.inc" INCLUDE "version.inc" +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; CHIBI/O Stable BIOS Interface +;; +;; Called through SWI3 +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + SECTION BIOSINT + + EXPORT CHIBIO + +; CHIBI/O Entrypoint -- Stable, but defined by linkerscript $8800 +; @param A: Function ID +CHIBIO + tfr a,d ; 8-to-16 tfr, fill both a and b + clra ; Clear MSB + asld ; Convert to word offset + tfr d,x ; Put in X for indexing mode + jmp [CHIBIOPTRTBL,x] ; Jump! + +; Jump table TODO: Document function IDs and pointers +CHIBIOPTRTBL + fdb IOPRINTVER ; Print the firmware version string + fdb $0000 ; TODO: Interactive BIOS setup utilitiy call + fdb ROBIT ; Access the ROBIT memory test + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; CHIBI/O Function Implementations +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Prints the firmware's version information +IOPRINTVER + PZSTR VERMSG + rti + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Memory Testing Routines @@ -59,18 +97,3 @@ LOOP@ MSG_FINISH fcc "Memory test finished! Please reset" fcb $0D,$0A,$00 - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; CHIBI PC-09 Integrity Functions -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - SECTION INTEGRITY - - EXPORT PRINTVER - -; Prints the ROM's version string -PRINTVER - PZSTR VERMSG - rts diff --git a/src/vecs.s b/src/vecs.s index 09e6035..40b5a6e 100644 --- a/src/vecs.s +++ b/src/vecs.s @@ -3,6 +3,7 @@ ; Licensed under MIT INCLUDE "reset.inc" + INCLUDE "utils.inc" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; @@ -13,11 +14,11 @@ SECTION VECTORS VECTORS - fdb $0000 ; Exception - fdb $0000 ; SWI3 - fdb $0000 ; SWI2 - fdb $0000 ; FIRQ - fdb $0000 ; IRQ - fdb $0000 ; SWI - fdb $0000 ; NMI - fdb RESET ; Reset + fdb $0000 ; Exception + fdb CHIBIO ; SWI3 + fdb $0000 ; SWI2 + fdb $0000 ; FIRQ + fdb $0000 ; IRQ + fdb $0000 ; SWI + fdb $0000 ; NMI + fdb RESET ; Reset