Compare commits
23 Commits
8f615e1bd8
...
docs
| Author | SHA1 | Date | |
|---|---|---|---|
| 904578e2b1 | |||
| ec43c11443 | |||
| e71c23da39 | |||
| e33f6dc6eb | |||
| 22c1f7b0b8 | |||
| aba1a50e0f | |||
| e055d9b300 | |||
| f978834857 | |||
| 0c4055d685 | |||
| 1ebd112da5 | |||
| 23febee616 | |||
| 4e90117d06 | |||
| edd448b006 | |||
| a7a9404bdd | |||
| f227ae6db6 | |||
| c9b665d509 | |||
|
3943b5502a
|
|||
|
f68fa4c0a6
|
|||
|
d92b8f6ba4
|
|||
|
96a5804467
|
|||
|
9ab92eb8a5
|
|||
|
a6a93e656a
|
|||
|
b5cfd501c5
|
@@ -25,7 +25,7 @@ int main(void) {
|
|||||||
; Copyright (c) 2025 Gale Faraday\n\
|
; Copyright (c) 2025 Gale Faraday\n\
|
||||||
; Licensed under MIT\n\
|
; Licensed under MIT\n\
|
||||||
\n\
|
\n\
|
||||||
; This file generated by bbmkcmds.c\n\
|
; This file generated by bbmkhash.c\n\
|
||||||
\n\
|
\n\
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\
|
||||||
;;\n\
|
;;\n\
|
||||||
@@ -40,10 +40,10 @@ int main(void) {
|
|||||||
|
|
||||||
/* Command count.
|
/* Command count.
|
||||||
* NOTE: This is a u16 because it gets emitted into the output assembly. */
|
* NOTE: This is a u16 because it gets emitted into the output assembly. */
|
||||||
uint16_t cCmds = sizeof(s_ppszCmds) / sizeof(char *);
|
uint16_t cCmds = sizeof(s_ppszCmds) / sizeof(char *);
|
||||||
|
|
||||||
/* Emit command count */
|
/* Emit command count */
|
||||||
printf("BBCHTC\n fdb $%.4X\n", cCmds);
|
printf("BBCHTC\n fdb $%.4X\n", cCmds);
|
||||||
|
|
||||||
/* Emit table data */
|
/* Emit table data */
|
||||||
puts("\nBBCHT");
|
puts("\nBBCHT");
|
||||||
|
|||||||
@@ -1,26 +1,22 @@
|
|||||||
#set document(
|
#set document(
|
||||||
title: "BUZBEE Manual",
|
title: "CHIBI PC-09 Firmware Manual",
|
||||||
author: "Gale Faraday",
|
author: "Gale Faraday",
|
||||||
description: "CHIBI PC-09 machine language monitor BUZBEE technical and user manual",
|
description: "CHIBI PC-09 Firmware: BIOS, CHIBIO, and BUZBEE documentation",
|
||||||
)
|
)
|
||||||
|
|
||||||
#import "style.typ": conf
|
#import "style.typ": conf
|
||||||
#show: conf.with(
|
#show: conf.with(
|
||||||
title: [BUZBEE User Manual and Technical Reference],
|
title: [CHIBI PC-09 Firmware Manual and Technical Reference],
|
||||||
subtitle: [A CHIBI PC-09 Machine Language Monitor],
|
subtitle: [A Complete Firmware Package for the CHIBI PC-09],
|
||||||
author: [Gale Faraday],
|
author: [Gale Faraday],
|
||||||
)
|
)
|
||||||
|
|
||||||
= Introduction <intro>
|
= Introduction <intro>
|
||||||
|
|
||||||
BUZBEE is a "machine language monitor" styled after Steve Wozniak's WOZMON for
|
This is the complete, stock firmware package for Amber Zeller's CHIBI PC-09
|
||||||
the CHIBI PC-09 hobby computer platform. It is the stock bootloader and
|
hobby computer. Featuring Gale Faraday's BUZBEE machine language monitor
|
||||||
interface for the PC-09. This manual goes over the usage of BUZBEE, and some of
|
(@bb-intro), the CHIBI/O BIOS interface (@chibio-intro), and several inbuilt
|
||||||
the technical internals of how it works and how to hack on it.
|
programs (@programs).
|
||||||
|
|
||||||
BUZBEE was created primarily to debug prototype versions of the CHIBI PC-09.
|
|
||||||
BUZBEE will grow alongside the CHIBI PC-09 project. It also functions as a
|
|
||||||
reference implementation of an OS using the CHIBI PC-09 BIOS.
|
|
||||||
|
|
||||||
The CHIBI PC-09 name and platform is copyright 2024-2025 Amber Zeller. The CHIBI
|
The CHIBI PC-09 name and platform is copyright 2024-2025 Amber Zeller. The CHIBI
|
||||||
PC-09 BIOS is copyright 2024-2025 Gale Faraday and Amber Zeller. BUZBEE is
|
PC-09 BIOS is copyright 2024-2025 Gale Faraday and Amber Zeller. BUZBEE is
|
||||||
@@ -29,217 +25,6 @@ MIT license.
|
|||||||
|
|
||||||
#pagebreak()
|
#pagebreak()
|
||||||
|
|
||||||
= BUZBEE Functions <bbfunc>
|
|
||||||
|
|
||||||
BUZBEE is at its core a chain loader or bootloader. This means that most of the
|
|
||||||
functionality of the CHIBI starts with using BUZBEE. BUZBEE functions are broken
|
|
||||||
into two categories: _Internal Functions_ or "IFs" defined in @if-top, and
|
|
||||||
_External Functions_ or "EFs" in @ef-top. IFs are native routines mapped to
|
|
||||||
textual commands entered at the BUZBEE prompt. EFs are native routines called
|
|
||||||
through IFs. EFs can either be any user supplied code, or one of a set of
|
|
||||||
routines in the BIOS/BUZBEE ROM or "firmware".
|
|
||||||
|
|
||||||
#pagebreak()
|
|
||||||
|
|
||||||
== Internal Functions (IFs) <if-top>
|
|
||||||
|
|
||||||
Internal Functions are the textual commands that BUZBEE interprets from the
|
|
||||||
command line to execute the user's wish. Internal Functions are canonically
|
|
||||||
listed in alphabetical order. Below in @if-table is a list of available IFs.
|
|
||||||
|
|
||||||
#figure(
|
|
||||||
table(
|
|
||||||
columns: (1fr, auto),
|
|
||||||
inset: 10pt,
|
|
||||||
align: center,
|
|
||||||
fill: (_, y) =>
|
|
||||||
if calc.odd(y) { luma(250) }
|
|
||||||
else { white },
|
|
||||||
table.header(
|
|
||||||
[*Name* (pg. no.)], [*Description*]
|
|
||||||
),
|
|
||||||
[`CALL` (#ref(<if-call>, form: "page"))],
|
|
||||||
[Call a resident routine in the MPU's address space.],
|
|
||||||
[`HELP` (#ref(<if-help>, form: "page"))],
|
|
||||||
[Display a summary of known commands.],
|
|
||||||
[`PEEK` (#ref(<if-peek>, form: "page"))],
|
|
||||||
[Dumps memory from the MPU's address space to the terminal.],
|
|
||||||
[`POKE` (#ref(<if-poke>, form: "page"))],
|
|
||||||
[Overwrites memory in the MPU's address space.],
|
|
||||||
[`SREC` (#ref(<if-srec>, form: "page"))],
|
|
||||||
[Switches into Motorola S-Record receive mode.],
|
|
||||||
),
|
|
||||||
caption: [Table of IFs],
|
|
||||||
) <if-table>
|
|
||||||
|
|
||||||
In the following pages these IFs are described in specific.
|
|
||||||
|
|
||||||
IFs are tokenized from their textual form into a binary "bytecode" form. This
|
|
||||||
bytecode is not reliably stable between versions, so it isn't described here in
|
|
||||||
specific, but a general breakdown is provided.
|
|
||||||
|
|
||||||
First the text command name (eg. `CALL`) is hashed in some way into a token.
|
|
||||||
Then conditional processing on the remainder of the line occurs. Values given in
|
|
||||||
hex are encoded as their corresponding bytes directly. The token buffer
|
|
||||||
mechanics are described more in @internals. Subcommands are also hashed into
|
|
||||||
tokens.
|
|
||||||
|
|
||||||
#pagebreak()
|
|
||||||
|
|
||||||
// Function for creating IF page headers
|
|
||||||
#let _ifpagehead(
|
|
||||||
desc: none,
|
|
||||||
syntax: none,
|
|
||||||
params: (),
|
|
||||||
) = {
|
|
||||||
smallcaps[#desc]
|
|
||||||
parbreak()
|
|
||||||
[Syntax: #syntax]
|
|
||||||
parbreak()
|
|
||||||
[Parameters: ]
|
|
||||||
if params.len() > 0 {
|
|
||||||
for (param, desc) in params [
|
|
||||||
- #raw("<" + upper(param) + ">"): #desc
|
|
||||||
]
|
|
||||||
} else {
|
|
||||||
text(style: "italic")[N/A]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
=== IF: `CALL` <if-call>
|
|
||||||
|
|
||||||
#_ifpagehead(
|
|
||||||
desc: "Calls a resident routine in the MPU's address space.",
|
|
||||||
syntax: [`CALL <PTR>`],
|
|
||||||
params: (
|
|
||||||
ptr: "An absolute pointer to a position in the 6309 MPU's memory map.",
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
Call takes an absolute pointer into the MPU's address space to call as if it
|
|
||||||
were a subroutine using `JSR`.
|
|
||||||
|
|
||||||
// TODO: For when CHIBI PC-09 Prototype #2 comes out or whenever we get banking
|
|
||||||
// add it here "Special care must be taken to properly bank in the correct
|
|
||||||
// memory banks before executing this command." yadda yadda
|
|
||||||
|
|
||||||
#pagebreak()
|
|
||||||
|
|
||||||
=== IF: `HELP` <if-help>
|
|
||||||
|
|
||||||
#_ifpagehead(
|
|
||||||
desc: "Displays a summary of available IFs.",
|
|
||||||
syntax: [`HELP`],
|
|
||||||
params: ()
|
|
||||||
)
|
|
||||||
|
|
||||||
`HELP` does what it says on the tin. It should be noted that between Git tags of
|
|
||||||
the firmware the message displayed by this may be incomplete or innaccurate.
|
|
||||||
Internally all this does is print a string with the UART using the `POUTZSTR`
|
|
||||||
BIOS routine.
|
|
||||||
|
|
||||||
#pagebreak()
|
|
||||||
|
|
||||||
=== IF: `PEEK` <if-peek>
|
|
||||||
|
|
||||||
#_ifpagehead(
|
|
||||||
desc: "Dumps memory from the MPU's address space to the terminal.",
|
|
||||||
syntax: [`PEEK <BASE> [<HIGH>]`],
|
|
||||||
params: (
|
|
||||||
base: [
|
|
||||||
The address of the byte to dump or the base (lower bound) address of the
|
|
||||||
byte to start dumping from if `<HIGH>` is specified.
|
|
||||||
],
|
|
||||||
high: [
|
|
||||||
An optional operand given as the upper bound of the range to dump. Forms
|
|
||||||
a range together with `<BASE>`.
|
|
||||||
],
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
Peeking memory causes the MPU to read the requested bytes and dump them to the
|
|
||||||
screen.
|
|
||||||
|
|
||||||
#lorem(120)
|
|
||||||
|
|
||||||
#pagebreak()
|
|
||||||
|
|
||||||
=== IF: `POKE` <if-poke>
|
|
||||||
|
|
||||||
#_ifpagehead(
|
|
||||||
desc: "Writes values to the MPU's address space.",
|
|
||||||
syntax: [`POKE <ADDR> <BYTES>`],
|
|
||||||
params: (
|
|
||||||
addr: "The base (low) address to start writing bytes from.",
|
|
||||||
bytes: "The bytes to write into memory separated by whitespace.",
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
#lorem(120)
|
|
||||||
|
|
||||||
#pagebreak()
|
|
||||||
|
|
||||||
=== IF: `SREC` <if-srec>
|
|
||||||
|
|
||||||
#_ifpagehead(
|
|
||||||
desc: "Switches into Motorola S-Record receive mode.",
|
|
||||||
syntax: [`SREC`],
|
|
||||||
params: (),
|
|
||||||
)
|
|
||||||
|
|
||||||
#lorem(120)
|
|
||||||
|
|
||||||
#pagebreak()
|
|
||||||
|
|
||||||
== External Functions (EFs) <ef-top>
|
|
||||||
|
|
||||||
External functions are any native user code that can be called with `CALL` (see
|
|
||||||
@if-call). This mechanism is usable to run any code or routine in memory as
|
|
||||||
though interactively using the MPU's `JSR` instruction.
|
|
||||||
|
|
||||||
=== EFs in ROM <ef-rom>
|
|
||||||
|
|
||||||
Some common EFs to call include the using call to reset the CHIBI PC-09 with
|
|
||||||
`CALL 8000`.
|
|
||||||
|
|
||||||
// TODO: Talk about memory test and BIOS interface
|
|
||||||
|
|
||||||
#pagebreak()
|
|
||||||
|
|
||||||
= BUZBEE Reserved Memory Regions <res-mem>
|
|
||||||
|
|
||||||
BUZBEE uses memory in the 0200-02FF page. A table of the layout of this memory
|
|
||||||
is provided. The memory is laid out in a packed structure starting at 0200.
|
|
||||||
|
|
||||||
#table(
|
|
||||||
columns: (auto, 1fr, auto),
|
|
||||||
inset: 10pt,
|
|
||||||
align: center,
|
|
||||||
fill: (_, y) =>
|
|
||||||
if calc.odd(y) { luma(250) }
|
|
||||||
else { white },
|
|
||||||
table.header(
|
|
||||||
[*Internal Name*], [*Size (Bytes)*], [*Description*]
|
|
||||||
),
|
|
||||||
[`input`],
|
|
||||||
[128],
|
|
||||||
[Text input buffer],
|
|
||||||
[`cchinput`],
|
|
||||||
[2],
|
|
||||||
[Text input buffer character count],
|
|
||||||
[`tokens`],
|
|
||||||
[64],
|
|
||||||
[BUZBEE token buffer],
|
|
||||||
[`cbtokens`],
|
|
||||||
[2],
|
|
||||||
[Count of bytes in `tokens`],
|
|
||||||
[`scratch`],
|
|
||||||
[2],
|
|
||||||
[Internal scratch word used for some operations],
|
|
||||||
)
|
|
||||||
|
|
||||||
#pagebreak()
|
|
||||||
|
|
||||||
= Building CHIBI PC-09 Firmware from Source <building>
|
= Building CHIBI PC-09 Firmware from Source <building>
|
||||||
|
|
||||||
Building the CHIBI PC-09 firmware from source requires LWTOOLS
|
Building the CHIBI PC-09 firmware from source requires LWTOOLS
|
||||||
@@ -270,10 +55,244 @@ Building the documentation can also be accomplished using `make docs`, provided
|
|||||||
|
|
||||||
#pagebreak()
|
#pagebreak()
|
||||||
|
|
||||||
= BUZBEE Internals and Modding <internals>
|
= Programs in ROM <programs>
|
||||||
|
|
||||||
|
Some simple programs are included in the CHIBI PC-09's firmware ROM and can be
|
||||||
|
called through BUZBEE's `CALL` command. Soft reseting the CHIBI PC-09 is also
|
||||||
|
handled through this interface by calling `$8000` or the ROM entrypoint.
|
||||||
|
|
||||||
|
A simple memory test based on ROBIT-2 for the SWTPC is included at `$9000`.
|
||||||
|
|
||||||
|
#pagebreak()
|
||||||
|
|
||||||
|
= CHIBI/O BIOS Interface <chibio-intro>
|
||||||
|
|
||||||
|
#lorem(120)
|
||||||
|
|
||||||
|
#pagebreak()
|
||||||
|
|
||||||
|
= BUZBEE Machine Language Monitor <bb-intro>
|
||||||
|
|
||||||
|
BUZBEE is a "machine language monitor" styled after Steve Wozniak's WOZMON for
|
||||||
|
the CHIBI PC-09 computer platform. It is the stock bootloader and
|
||||||
|
interface for the PC-09. This chapter goes over the usage of BUZBEE, and some of
|
||||||
|
the technical internals of how it works and how to use it.
|
||||||
|
|
||||||
|
BUZBEE was created primarily to debug prototype versions of the CHIBI PC-09.
|
||||||
|
BUZBEE will grow alongside the CHIBI PC-09 project. It also functions as a
|
||||||
|
reference implementation of an OS using the CHIBI PC-09 BIOS.
|
||||||
|
|
||||||
|
#pagebreak()
|
||||||
|
|
||||||
|
== BUZBEE Functions <bbfunc>
|
||||||
|
|
||||||
|
BUZBEE is at its core a chain loader or bootloader. This means that most of the
|
||||||
|
functionality of the CHIBI starts with using BUZBEE. BUZBEE functions are called
|
||||||
|
_Internal Functions_ or "IFs". These are documented in @bbif-top. BUZBEE
|
||||||
|
functions are native functions mapped to textual commands entered at the BUZBEE
|
||||||
|
prompt.
|
||||||
|
|
||||||
|
#pagebreak()
|
||||||
|
|
||||||
|
== Internal Functions (IFs) <bbif-top>
|
||||||
|
|
||||||
|
Internal Functions are the textual commands that BUZBEE interprets from the
|
||||||
|
command line to execute the user's wish. Internal Functions are canonically
|
||||||
|
listed in alphabetical order. Below in @bbif-table is a list of available IFs.
|
||||||
|
|
||||||
|
#figure(
|
||||||
|
table(
|
||||||
|
columns: (auto, auto, 1fr),
|
||||||
|
inset: 10pt,
|
||||||
|
align: center,
|
||||||
|
fill: (_, y) =>
|
||||||
|
if calc.odd(y) { luma(250) }
|
||||||
|
else { white },
|
||||||
|
table.header(
|
||||||
|
[*Name* (pg. no.)], [*Command Token*], [*Description*]
|
||||||
|
),
|
||||||
|
[`CALL` (#ref(<bbif-call>, form: "page"))],
|
||||||
|
[`$00`],
|
||||||
|
[Call a resident routine in the MPU's address space.],
|
||||||
|
[`HELP` (#ref(<bbif-help>, form: "page"))],
|
||||||
|
[`$01`],
|
||||||
|
[Display a summary of known commands.],
|
||||||
|
[`PEEK` (#ref(<bbif-peek>, form: "page"))],
|
||||||
|
[`$02`],
|
||||||
|
[Dumps memory from the MPU's address space to the terminal.],
|
||||||
|
[`POKE` (#ref(<bbif-poke>, form: "page"))],
|
||||||
|
[`$03`],
|
||||||
|
[Overwrites memory in the MPU's address space.],
|
||||||
|
[`SREC` (#ref(<bbif-srec>, form: "page"))],
|
||||||
|
[`$04`],
|
||||||
|
[Switches into Motorola S-Record receive mode.],
|
||||||
|
),
|
||||||
|
caption: [Table of IFs],
|
||||||
|
) <bbif-table>
|
||||||
|
|
||||||
|
In the following pages these IFs are described in specific.
|
||||||
|
|
||||||
|
IFs are tokenized from their textual form into a binary "bytecode" form. This
|
||||||
|
bytecode is described in @bbinternals.
|
||||||
|
|
||||||
|
First the text command name (eg. `CALL`) is hashed in some way into a token.
|
||||||
|
Then conditional processing on the remainder of the line occurs. Values given in
|
||||||
|
hex are encoded as their corresponding bytes directly. The token buffer
|
||||||
|
mechanics are described more in @bbinternals. Subcommands are also hashed into
|
||||||
|
tokens.
|
||||||
|
|
||||||
|
#pagebreak()
|
||||||
|
|
||||||
|
// Function for creating IF page headers
|
||||||
|
#let _ifpagehead(
|
||||||
|
desc: none,
|
||||||
|
syntax: none,
|
||||||
|
params: (),
|
||||||
|
) = {
|
||||||
|
smallcaps[#desc]
|
||||||
|
parbreak()
|
||||||
|
[Syntax: #syntax]
|
||||||
|
parbreak()
|
||||||
|
[Parameters: ]
|
||||||
|
if params.len() > 0 {
|
||||||
|
for (param, desc) in params [
|
||||||
|
- #raw("<" + upper(param) + ">"): #desc
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
text(style: "italic")[N/A]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
==== IF: `CALL` <bbif-call>
|
||||||
|
|
||||||
|
#_ifpagehead(
|
||||||
|
desc: "Calls a resident routine in the MPU's address space.",
|
||||||
|
syntax: [`CALL <PTR>`],
|
||||||
|
params: (
|
||||||
|
ptr: "An absolute pointer to a position in the 6309 MPU's memory map.",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
Call takes an absolute pointer into the MPU's address space to call as if it
|
||||||
|
were a subroutine using `JSR`.
|
||||||
|
|
||||||
|
// TODO: For when CHIBI PC-09 Prototype #2 comes out or whenever we get banking
|
||||||
|
// add it here "Special care must be taken to properly bank in the correct
|
||||||
|
// memory banks before executing this command." yadda yadda
|
||||||
|
|
||||||
|
#pagebreak()
|
||||||
|
|
||||||
|
==== IF: `HELP` <bbif-help>
|
||||||
|
|
||||||
|
#_ifpagehead(
|
||||||
|
desc: "Displays a summary of available IFs.",
|
||||||
|
syntax: [`HELP`],
|
||||||
|
params: ()
|
||||||
|
)
|
||||||
|
|
||||||
|
`HELP` does what it says on the tin. It should be noted that between Git tags of
|
||||||
|
the firmware the message displayed by this may be incomplete or innaccurate.
|
||||||
|
Internally all this does is print a string with the UART using the `POUTZSTR`
|
||||||
|
BIOS routine.
|
||||||
|
|
||||||
|
#pagebreak()
|
||||||
|
|
||||||
|
==== IF: `PEEK` <bbif-peek>
|
||||||
|
|
||||||
|
#_ifpagehead(
|
||||||
|
desc: "Dumps memory from the MPU's address space to the terminal.",
|
||||||
|
syntax: [`PEEK <BASE> [<HIGH>]`],
|
||||||
|
params: (
|
||||||
|
base: [
|
||||||
|
The address (two bytes) of the byte to dump or the base (lower bound)
|
||||||
|
address of the byte to start dumping from if `<HIGH>` is specified.
|
||||||
|
],
|
||||||
|
high: [
|
||||||
|
An optional operand given as the upper bound of the range to dump. Forms
|
||||||
|
a range together with `<BASE>`. (two bytes)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
Peeking memory causes the MPU to read the requested bytes and dump them to the
|
||||||
|
screen.
|
||||||
|
|
||||||
|
#pagebreak()
|
||||||
|
|
||||||
|
==== IF: `POKE` <bbif-poke>
|
||||||
|
|
||||||
|
#_ifpagehead(
|
||||||
|
desc: "Writes values to the MPU's address space.",
|
||||||
|
syntax: [`POKE <ADDR> <BYTES>`],
|
||||||
|
params: (
|
||||||
|
addr: "The base (low) address (two bytes) to start writing bytes from.",
|
||||||
|
bytes: "The bytes to write into memory separated by whitespace.",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
Poking memory causes the MPU to overwrite the bytes at `<ADDR>` with the bytes
|
||||||
|
given in `<BYTES>`.
|
||||||
|
|
||||||
|
#pagebreak()
|
||||||
|
|
||||||
|
==== IF: `SREC` <bbif-srec>
|
||||||
|
|
||||||
|
#_ifpagehead(
|
||||||
|
desc: "Switches into Motorola S-Record receive mode.",
|
||||||
|
syntax: [`SREC`],
|
||||||
|
params: (),
|
||||||
|
)
|
||||||
|
|
||||||
|
Motorola S-Record mode is currently a stub.
|
||||||
|
|
||||||
|
#pagebreak()
|
||||||
|
|
||||||
|
=== External Functions (EFs) <bbef-top>
|
||||||
|
|
||||||
|
External functions are any native user code that can be called with `CALL` (see
|
||||||
|
@bbif-call). This mechanism is usable to run any code or routine in memory as
|
||||||
|
though interactively using the MPU's `JSR` instruction.
|
||||||
|
|
||||||
|
== BUZBEE Reserved Memory Regions <res-mem>
|
||||||
|
|
||||||
|
BUZBEE uses memory in the 0200-02FF page. A table of the layout of this memory
|
||||||
|
is provided. The memory is laid out in a packed structure starting at 0200.
|
||||||
|
|
||||||
|
#table(
|
||||||
|
columns: (auto, 1fr, auto),
|
||||||
|
inset: 10pt,
|
||||||
|
align: center,
|
||||||
|
fill: (_, y) =>
|
||||||
|
if calc.odd(y) { luma(250) }
|
||||||
|
else { white },
|
||||||
|
table.header(
|
||||||
|
[*Internal Name*], [*Size (Bytes)*], [*Description*]
|
||||||
|
),
|
||||||
|
[`input`],
|
||||||
|
[128],
|
||||||
|
[Text input buffer],
|
||||||
|
[`cchinput`],
|
||||||
|
[2],
|
||||||
|
[Text input buffer character count],
|
||||||
|
[`tokens`],
|
||||||
|
[64],
|
||||||
|
[BUZBEE token buffer],
|
||||||
|
[`cbtokens`],
|
||||||
|
[2],
|
||||||
|
[Count of bytes in `tokens`],
|
||||||
|
[`scratch`],
|
||||||
|
[2],
|
||||||
|
[Internal scratch word used for some operations],
|
||||||
|
)
|
||||||
|
|
||||||
|
#pagebreak()
|
||||||
|
|
||||||
|
== BUZBEE Internals and Modding <bbinternals>
|
||||||
|
|
||||||
BUZBEE's interpreter works by "compiling" textual user commands into bytecode
|
BUZBEE's interpreter works by "compiling" textual user commands into bytecode
|
||||||
for more simply passing parameters to IFs (see @if-top).
|
for more simply passing parameters to IFs (see @bbif-top). The way that works is
|
||||||
|
the implementation dependent, but each hash is one byte (1B) in size, and
|
||||||
|
corresponds to an IF token, which is the index of the hash.
|
||||||
|
|
||||||
BUZBEE's source, and the surrounding BIOS source is well commented, but a
|
BUZBEE's source, and the surrounding BIOS source is well commented, but a
|
||||||
general summary of the control flow is provided here.
|
general summary of the control flow is provided here.
|
||||||
12
linkscript
12
linkscript
@@ -1,9 +1,19 @@
|
|||||||
|
; BIOS
|
||||||
section RESET load 8000
|
section RESET load 8000
|
||||||
section SERIAL
|
section SERIAL
|
||||||
section MEMTEST
|
|
||||||
|
|
||||||
|
; BIOS Interface and Utilities
|
||||||
|
section BIOSINT
|
||||||
|
|
||||||
|
; BUZBEE Monitor
|
||||||
section BUZBEE
|
section BUZBEE
|
||||||
section BBHASHES
|
section BBHASHES
|
||||||
|
|
||||||
|
; Onboard programs
|
||||||
|
section MEMTEST load 9000
|
||||||
|
|
||||||
|
; Static Data
|
||||||
section VECTORS high 100000
|
section VECTORS high 100000
|
||||||
section VERSION high
|
section VERSION high
|
||||||
|
|
||||||
|
entry 8000
|
||||||
|
|||||||
2
makefile
2
makefile
@@ -34,7 +34,7 @@ LDFLAGS := -f srec -m map.txt -s linkscript
|
|||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
docs: docs/*.typ
|
docs: docs/*.typ
|
||||||
typst compile docs/buzbee.typ
|
typst compile docs/firmware.typ
|
||||||
|
|
||||||
all: $(TARGROM)
|
all: $(TARGROM)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
; CHIBI PC-09 Prototype #1 -- Memory Testing Routines Header
|
; CHIBI PC-09 Prototype #1 -- BIOS Interface Header
|
||||||
; Copyright (c) 2025 Amber Zeller, Gale Faraday
|
; Copyright (c) 2025 Amber Zeller, Gale Faraday
|
||||||
; Licensed under MIT
|
; Licensed under MIT
|
||||||
|
|
||||||
; vim: ft=asm
|
; vim: ft=asm
|
||||||
|
|
||||||
RAMTEST IMPORT
|
CHIBIO IMPORT
|
||||||
52
src/biosint.s
Normal file
52
src/biosint.s
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
; CHIBI PC-09 Prototype #1 Boot ROM -- BIOS Interface
|
||||||
|
; Copyright (c) 2024-2025 Amber Zeller, Gale Faraday
|
||||||
|
; Licensed under MIT
|
||||||
|
|
||||||
|
INCLUDE "serial.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
|
||||||
|
CHIBIOPTRTBL
|
||||||
|
fdb CIOPOUTCHAR ; serial/POUTCHAR wrapper
|
||||||
|
fdb CIOPOUTZSTR ; serial/POUTZSTR wrapper
|
||||||
|
fdb CIOPINCHAR ; serial/CIOPINCHAR wrapper
|
||||||
|
|
||||||
|
; POUTCHAR wrapper
|
||||||
|
; @param B: char to write
|
||||||
|
CIOPOUTCHAR
|
||||||
|
tfr b,a
|
||||||
|
jsr POUTCHAR
|
||||||
|
rti
|
||||||
|
|
||||||
|
; POUTZSTR wrapper
|
||||||
|
; @param X: start of zstring
|
||||||
|
CIOPOUTZSTR
|
||||||
|
jsr POUTZSTR
|
||||||
|
rti
|
||||||
|
|
||||||
|
; PINCHAR
|
||||||
|
; @return A: filled with char from RX buffer or NUL if no char is ready
|
||||||
|
; @return B: filled with LSR status codes masked with $9F
|
||||||
|
CIOPINCHAR
|
||||||
|
jsr PINCHAR
|
||||||
|
rti
|
||||||
157
src/buzbee.s
157
src/buzbee.s
@@ -40,13 +40,14 @@ BBVAR tagbbvar
|
|||||||
EXPORT BUZBEE
|
EXPORT BUZBEE
|
||||||
|
|
||||||
BUZBEE
|
BUZBEE
|
||||||
lbsr NEWLINE ; Setup the new input line and handle display.
|
lbsr NEWLINE ; Setup the new input line and handle display.
|
||||||
bsr INPLOOP ; Fill input buffer.
|
bsr INPLOOP ; Fill input buffer.
|
||||||
cmpy #$0000 ; No data?
|
cmpy #0 ; No data?
|
||||||
beq BUZBEE ; Try again...
|
beq BUZBEE ; Try again...
|
||||||
; TODO: Parse the input buffer into tokens
|
lbsr MKINSENSITIVE ; Make the input buffer case insensitive
|
||||||
lbsr RUNIF
|
lbsr TOKENIZE ; Try to tokenize the input buffer
|
||||||
bra BUZBEE
|
lbsr RUNIF ; Execute token buffer, handling any errors
|
||||||
|
bra BUZBEE ; Repeat
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;
|
;;
|
||||||
@@ -58,7 +59,7 @@ BUZBEE
|
|||||||
; offset in the input buffer of the last char read.
|
; offset in the input buffer of the last char read.
|
||||||
INPLOOP
|
INPLOOP
|
||||||
jsr PINCHAR ; Try to read a char
|
jsr PINCHAR ; Try to read a char
|
||||||
cmpd #$0000 ; If no char keep waitin'
|
cmpd #0 ; If no char keep waitin'
|
||||||
beq INPLOOP
|
beq INPLOOP
|
||||||
bitb #UARTF_LSR_DR ; Is there a char in A?
|
bitb #UARTF_LSR_DR ; Is there a char in A?
|
||||||
beq NOCHAR@
|
beq NOCHAR@
|
||||||
@@ -101,7 +102,7 @@ HCR@
|
|||||||
HESC@
|
HESC@
|
||||||
lda #'^ ; Print a char that signifies that ESC was pressed
|
lda #'^ ; Print a char that signifies that ESC was pressed
|
||||||
jsr POUTCHAR
|
jsr POUTCHAR
|
||||||
ldy #$0000 ; On return we cmpy #$0000 and if eq then newline.
|
ldy #0 ; On return we cmpy #0 and if eq then newline
|
||||||
rts
|
rts
|
||||||
HBACKSPC@
|
HBACKSPC@
|
||||||
clrb ; Clear last char
|
clrb ; Clear last char
|
||||||
@@ -118,13 +119,28 @@ NEWLINE
|
|||||||
PZSTR PROMPTLINE ; Print prompt line
|
PZSTR PROMPTLINE ; Print prompt line
|
||||||
CLRIN ; Label to just clear input buffer without newline
|
CLRIN ; Label to just clear input buffer without newline
|
||||||
clra ; Init A and X
|
clra ; Init A and X
|
||||||
ldx #$0000
|
ldx #0
|
||||||
NEXT@
|
NEXT@
|
||||||
sta BBVAR.input,x ; Clear input buffer
|
sta BBVAR.input,x ; Clear input buffer
|
||||||
leax 1,x
|
leax 1,x
|
||||||
cmpx #BBIN_DEPTH
|
cmpx #BBIN_DEPTH
|
||||||
blo NEXT@
|
blo NEXT@
|
||||||
ldy #$0000 ; Reset buffer fill pointer
|
ldy #0 ; Reset buffer fill pointer
|
||||||
|
rts
|
||||||
|
|
||||||
|
; Makes the input buffer case insensitive
|
||||||
|
MKINSENSITIVE
|
||||||
|
NEXTC@
|
||||||
|
lda BBVAR.input,x
|
||||||
|
cmpa #'z ; Is the char outside the lowercase range?
|
||||||
|
bhi NOTLCASE@ ; Yes? Skip offset part
|
||||||
|
cmpa #'a ; Again on the other side of the range
|
||||||
|
blo NOTLCASE@
|
||||||
|
anda #$DF ; -32
|
||||||
|
NOTLCASE@
|
||||||
|
leax 1,x ; Ready next char
|
||||||
|
cmpx BBVAR.cchinput ; Are we at the end?
|
||||||
|
bne NEXTC@ ; No? Loop
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -143,24 +159,22 @@ PBYTE
|
|||||||
asra
|
asra
|
||||||
asra
|
asra
|
||||||
asra
|
asra
|
||||||
bsr NYB2HEX ; Print A
|
|
||||||
jsr POUTCHAR
|
|
||||||
tfr b,a ; Print B next
|
|
||||||
bsr NYB2HEX ; Print B
|
|
||||||
jsr POUTCHAR
|
|
||||||
puls b
|
|
||||||
rts
|
|
||||||
|
|
||||||
; Converts a nybble into a valid hex digit
|
|
||||||
; @param A: nybble to convert to a char
|
|
||||||
; @return A: resulting char
|
|
||||||
NYB2HEX
|
|
||||||
anda #$0F
|
anda #$0F
|
||||||
ora #'0 ; Add "0"
|
ora #'0 ; Add '0' to offset to digits
|
||||||
cmpa #$3A ; ":" "9"+1
|
cmpa #$3A ; Hex? ':' '9'+1
|
||||||
blo SKIP@
|
blo SKIPA@
|
||||||
adca #6 ; Add offset to "A" in ascii
|
adca #6 ; Hex offset
|
||||||
SKIP@
|
SKIPA@
|
||||||
|
jsr POUTCHAR ; Print char in A
|
||||||
|
andb #$0F
|
||||||
|
orb #'0 ; Add '0' to offset to digits
|
||||||
|
cmpb #$3A ; Hex? ':' '9'+1
|
||||||
|
blo SKIPB@
|
||||||
|
adcb #6 ; Hex offset
|
||||||
|
SKIPB@
|
||||||
|
tfr b,a ; Print char in B
|
||||||
|
jsr POUTCHAR
|
||||||
|
puls b ; Restore B
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Converts a hexadecimal sequence into a byte value
|
; Converts a hexadecimal sequence into a byte value
|
||||||
@@ -203,19 +217,77 @@ BADHEX@
|
|||||||
;;
|
;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
; Attempts to parse the input buffer into tokens depending on the command
|
||||||
|
TOKENIZE
|
||||||
|
ldd BBVAR.cchinput ; Do we have input to work with?
|
||||||
|
cmpd #4 ; Do we have even enough space for a string command
|
||||||
|
blo TOKFAIL@ ; No? GTFO
|
||||||
|
ldy #0 ; Initialize Y; used to track current position in BBVAR.input
|
||||||
|
ldx #0 ; Initialize X; used to track position in BBVAR.tokens
|
||||||
|
bsr SKIPTONEXTC ; Get the next non-whitespace char
|
||||||
|
bsr MKCMDSUM ; Hash the first four non-whitespace chars
|
||||||
|
bsr HASH2TOKEN ; Try to turn that hash into a proper token
|
||||||
|
bcs TOKFAIL@
|
||||||
|
bra STTOK@ ; Store token
|
||||||
|
NEXTHEX@ ; Next hex token
|
||||||
|
bsr SKIPTONEXTC ; Skip to next whitespace
|
||||||
|
ldd BBVAR.input,y ; Get hex value (two digits)
|
||||||
|
bsr HEX2BYT ; Convert hex value to byte value
|
||||||
|
STTOK@
|
||||||
|
sta BBVAR.tokens,x ; Store curent token
|
||||||
|
leax 1,x ; Advance to next token
|
||||||
|
cmpx #BBTOKENS_DEPTH ; Is this next token in bounds?
|
||||||
|
beq FULLBUF@ ; No? handle a full buffer
|
||||||
|
bra NEXTHEX@ ; Try to turn the next character into a hex value
|
||||||
|
FULLBUF@
|
||||||
|
PZSTR EM_FULLTOKBUF ; Print an error message
|
||||||
|
clrd ; Say we wrote no tokens
|
||||||
|
std BBVAR.cbtokens
|
||||||
|
rts
|
||||||
|
TOKFAIL@
|
||||||
|
PZSTR EM_TOKFAIL ; Print tokenization fail
|
||||||
|
clrd ; Say we wrote no tokens
|
||||||
|
std BBVAR.cbtokens
|
||||||
|
rts
|
||||||
|
|
||||||
|
; Converts a runtime command hash into a portable token. Command tokens are
|
||||||
|
; indexes into BBCHT, which is generated at compile-time
|
||||||
|
; @param A: runtime hash
|
||||||
|
; @return A: output token
|
||||||
|
; @return CC.C: set if error state, cleared otherwise
|
||||||
|
HASH2TOKEN
|
||||||
|
pshs x ; Preserve & init X; other routines in this group use it
|
||||||
|
ldx #0
|
||||||
|
NEXTHASH@
|
||||||
|
cmpa BBCHT,x ; Is this hash our hash?
|
||||||
|
beq THISHASH@ ; Yes? turn it into a token
|
||||||
|
leax 1,x ; Begin considering next hash
|
||||||
|
cmpx BBCHTC ; Is the next hash even in the table?
|
||||||
|
blo NEXTHASH@ ; Yes? try this next hash, No? fall through
|
||||||
|
PZSTR EM_BADHASH CALL; Print an error message to the user
|
||||||
|
puls x
|
||||||
|
orcc #1 ; Set CC.C to indicate error
|
||||||
|
rts
|
||||||
|
THISHASH@
|
||||||
|
puls x
|
||||||
|
andcc #$FE ; Clear CC.C to indicate success
|
||||||
|
rts
|
||||||
|
|
||||||
; Makes a hash of four chars in BBIN starting at offset X
|
; Makes a hash of four chars in BBIN starting at offset X
|
||||||
; @param X: offset in BBIN to read the four chars from
|
; @param Y: offset in BBIN to read the four chars from
|
||||||
; @return A: resulting hash
|
; @return A: resulting hash
|
||||||
|
; @return Y: offset after hash processing
|
||||||
MKCMDSUM
|
MKCMDSUM
|
||||||
pshs b
|
pshs b
|
||||||
ldb #4 ; Loop over four chars
|
ldb #4 ; Loop over four chars
|
||||||
clra ; Initialize accumulator
|
clra ; Initialize accumulator
|
||||||
NEXTC@
|
NEXTC@
|
||||||
suba BBVAR.input,x ; Subtract current char from accumulator
|
suba BBVAR.input,y ; Subtract current char from accumulator
|
||||||
leax 1,x ; Next char
|
leax 1,y ; Next char
|
||||||
decb ; Reduce count
|
decb ; Reduce count
|
||||||
cmpb #0 ; Are we at the end?
|
cmpb #0 ; Are we at the end?
|
||||||
bne NEXTC@ ; No? loop
|
bne NEXTC@ ; No? loop
|
||||||
|
puls b
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Skips "whitespace" to the next semantic char
|
; Skips "whitespace" to the next semantic char
|
||||||
@@ -245,24 +317,16 @@ RUNIF
|
|||||||
beq NOTOK@
|
beq NOTOK@
|
||||||
ldx #0 ; Counting up from zero
|
ldx #0 ; Counting up from zero
|
||||||
lda BBVAR.tokens ; Load token
|
lda BBVAR.tokens ; Load token
|
||||||
NEXTHASH@
|
tfr a,d ; Get the index in D
|
||||||
cmpa BBCHT,x ; Is this hash our hash?
|
clra
|
||||||
beq CALCPTR@ ; Yes? skip to next step to put ptr in x
|
|
||||||
leax 1,x ; Begin considering next hash
|
|
||||||
cmpx BBCHTC ; Is this the last byte?
|
|
||||||
blo NEXTHASH@ ; No? try next hash, Yes? fall through
|
|
||||||
PZSTR EM_BADHASH ; Print an error message
|
|
||||||
lbra IFHELP ; Proceed to call "HELP"
|
|
||||||
CALCPTR@
|
|
||||||
tfr x,d ; Swap into d to do a cheap multiply
|
|
||||||
asld ; Cheaply << to get *2, pointer size
|
asld ; Cheaply << to get *2, pointer size
|
||||||
tfr d,x ; Restore x from d and jump to function at index
|
tfr d,x ; Move to X so we can use indexed mode with the offset
|
||||||
jmp [BBCMDPTRTBL,x]
|
jmp [IFPTRTBL,x] ; Select IF
|
||||||
NOTOK@
|
NOTOK@
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; IF pointer table
|
; IF pointer table
|
||||||
BBCMDPTRTBL
|
IFPTRTBL
|
||||||
fdb IFCALL
|
fdb IFCALL
|
||||||
fdb IFHELP
|
fdb IFHELP
|
||||||
fdb IFPEEK
|
fdb IFPEEK
|
||||||
@@ -388,5 +452,8 @@ EM_TOKFAIL
|
|||||||
fcc "!!! Tokenization Failure !!!"
|
fcc "!!! Tokenization Failure !!!"
|
||||||
fcb $0D,$0A,$00
|
fcb $0D,$0A,$00
|
||||||
EM_BADHEX
|
EM_BADHEX
|
||||||
fcc "!!! Maleformed Hex Value !!!"
|
fcc "!!! Malformed Hex Value !!!"
|
||||||
|
fcb $0D,$0A,$00
|
||||||
|
EM_FULLTOKBUF
|
||||||
|
fcc "!!! Token Buffer Overrun !!!"
|
||||||
fcb $0D,$0A,$00
|
fcb $0D,$0A,$00
|
||||||
|
|||||||
@@ -1,23 +1,24 @@
|
|||||||
; CHIBI PC-09 Prototype #1 Boot ROM -- Memory Testing Routines
|
; CHIBI PC-09 Prototype #1 Boot ROM -- Onboard Programs or BUZBEE "EFs"
|
||||||
; Copyright (c) 2024-2025 Amber Zeller, Gale Faraday
|
; Copyright (c) 2024-2025 Amber Zeller, Gale Faraday
|
||||||
; Licensed under MIT
|
; Licensed under MIT
|
||||||
|
|
||||||
|
; These are onboard programs with fixed locations in the linkerscript for
|
||||||
|
; starting from a machine language monitor
|
||||||
|
|
||||||
INCLUDE "hardware.inc"
|
INCLUDE "hardware.inc"
|
||||||
INCLUDE "serial.inc"
|
INCLUDE "serial.inc"
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;
|
;;
|
||||||
;; Memory Testing Routines
|
;; Memory Testing Routine
|
||||||
;;
|
;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
SECTION MEMTEST
|
SECTION MEMTEST
|
||||||
|
|
||||||
EXPORT RAMTEST
|
|
||||||
|
|
||||||
; RAM testing routine. Ported to 6809 from 6800, based on source for ROBIT-2 for
|
; RAM testing routine. Ported to 6809 from 6800, based on source for ROBIT-2 for
|
||||||
; MIKBUG.
|
; MIKBUG.
|
||||||
RAMTEST
|
ROBIT
|
||||||
ldx #STACK_TOP+1 ; bottom of testable SRAM, $0200
|
ldx #STACK_TOP+1 ; bottom of testable SRAM, $0200
|
||||||
AGAIN@ ; Store 1 in memory
|
AGAIN@ ; Store 1 in memory
|
||||||
lda #1 ; Set [X] to 1
|
lda #1 ; Set [X] to 1
|
||||||
@@ -41,4 +42,17 @@ ERR@ ; Write out error indicator
|
|||||||
PASS@ ; Pass test
|
PASS@ ; Pass test
|
||||||
ldb #'P
|
ldb #'P
|
||||||
jsr POUTCHAR
|
jsr POUTCHAR
|
||||||
rts
|
bra HALT
|
||||||
|
|
||||||
|
; Prints a message about completing a memory test prompting the user to reset
|
||||||
|
; then puts the MPU in a loop where it only responds to interrupts, effectively
|
||||||
|
; halting the CHIBI
|
||||||
|
HALT
|
||||||
|
PZSTR MSG_FINISH
|
||||||
|
LOOP@
|
||||||
|
sync
|
||||||
|
bra LOOP@
|
||||||
|
|
||||||
|
MSG_FINISH
|
||||||
|
fcc "Memory test finished! Please reset"
|
||||||
|
fcb $0D,$0A,$00
|
||||||
19
src/reset.s
19
src/reset.s
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
INCLUDE "buzbee.inc"
|
INCLUDE "buzbee.inc"
|
||||||
INCLUDE "hardware.inc"
|
INCLUDE "hardware.inc"
|
||||||
INCLUDE "memtest.inc"
|
|
||||||
INCLUDE "serial.inc"
|
INCLUDE "serial.inc"
|
||||||
INCLUDE "version.inc"
|
INCLUDE "version.inc"
|
||||||
|
|
||||||
@@ -24,7 +23,7 @@ RESET
|
|||||||
CLRSTACK
|
CLRSTACK
|
||||||
; Initialize the system stack
|
; Initialize the system stack
|
||||||
clra ; Init A & X to zero out the stack
|
clra ; Init A & X to zero out the stack
|
||||||
ldx #$0000
|
ldx #0
|
||||||
NEXT@
|
NEXT@
|
||||||
sta STACK_BOTTOM,x ; Write a zero and progress to the next byte
|
sta STACK_BOTTOM,x ; Write a zero and progress to the next byte
|
||||||
leax 1,x
|
leax 1,x
|
||||||
@@ -36,19 +35,14 @@ BOOTSCR
|
|||||||
lda #13 ; 9600 baud
|
lda #13 ; 9600 baud
|
||||||
ldb #%11 ; 8N1
|
ldb #%11 ; 8N1
|
||||||
jsr INITUART ; Initialize serial console
|
jsr INITUART ; Initialize serial console
|
||||||
ldx #VERMSG ; Print version information
|
PZSTR VERMSG ; Since we know the addr of VERMSG at link time we can avoid
|
||||||
jsr POUTZSTR
|
; calling out to CHIBIO
|
||||||
|
|
||||||
; Progress to POST
|
|
||||||
POST
|
|
||||||
jsr RAMTEST
|
|
||||||
|
|
||||||
; Hand off control to the BUZBEE monitor and print notification of leaving the
|
; Hand off control to the BUZBEE monitor and print notification of leaving the
|
||||||
; firmware
|
; firmware
|
||||||
ENTERMON
|
ENTERMON
|
||||||
ldx #TXTRUN
|
PZSTR TXTRUN ; Print run message
|
||||||
jsr POUTZSTR
|
jmp BUZBEE ; Jump into a monitor program
|
||||||
jmp BUZBEE
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;
|
;;
|
||||||
@@ -57,4 +51,5 @@ ENTERMON
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
TXTRUN
|
TXTRUN
|
||||||
fcn "<3RUN<3"
|
fcc "<3RUN<3"
|
||||||
|
fcb $0D,$0A,$00
|
||||||
|
|||||||
17
src/vecs.s
17
src/vecs.s
@@ -2,6 +2,7 @@
|
|||||||
; Copyright (c) 2024-2025 Amber Zeller, Gale Faraday
|
; Copyright (c) 2024-2025 Amber Zeller, Gale Faraday
|
||||||
; Licensed under MIT
|
; Licensed under MIT
|
||||||
|
|
||||||
|
INCLUDE "biosint.inc"
|
||||||
INCLUDE "reset.inc"
|
INCLUDE "reset.inc"
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -13,11 +14,11 @@
|
|||||||
SECTION VECTORS
|
SECTION VECTORS
|
||||||
|
|
||||||
VECTORS
|
VECTORS
|
||||||
fdb $0000 ; Exception
|
fdb $0000 ; Exception
|
||||||
fdb $0000 ; SWI3
|
fdb CHIBIO ; SWI3
|
||||||
fdb $0000 ; SWI2
|
fdb $0000 ; SWI2
|
||||||
fdb $0000 ; FIRQ
|
fdb $0000 ; FIRQ
|
||||||
fdb $0000 ; IRQ
|
fdb $0000 ; IRQ
|
||||||
fdb $0000 ; SWI
|
fdb $0000 ; SWI
|
||||||
fdb $0000 ; NMI
|
fdb $0000 ; NMI
|
||||||
fdb RESET ; Reset
|
fdb RESET ; Reset
|
||||||
|
|||||||
Reference in New Issue
Block a user