Files
z80_monitor/README.md
T

45 lines
1.9 KiB
Markdown

# Z80 UART monitor
This ROM provides a small interactive monitor on the UART/CTC card at I/O base
`20`. At reset, a small ROM bootstrap copies the monitor into the top 16 KiB of
RAM at `C000-FFFF` and starts it there. Only the occupied vector/code bytes are
stored and copied; uninitialized data is cleared directly in high RAM. The low ROM can subsequently be disabled
without taking the monitor, its data, or its interrupt table away. Runtime code
and vectors occupy the lower part of this window, globals begin at `F000`, and
the stack grows downward from `FFFF`; no RAM below `C000` is used.
Connect a terminal at **2400 baud, 8 data bits, no parity, 1 stop bit**.
Commands are case-insensitive and all numeric arguments are hexadecimal; an
optional `0x` prefix is accepted.
| Command | Action |
| --- | --- |
| `D 8000` | Dump 40 bytes starting at address 8000 |
| `D 8000 20` | Dump 20 bytes starting at address 8000 |
| `W 8000 3E 41 D3 25 C9` | Write bytes starting at address 8000 |
| `I 20` | Read I/O port 20 |
| `O 20 57` | Write 57 to I/O port 20 |
| `G 8000` | Execute code at address 8000 |
| `HELP` | Show the command summary |
`G` transfers control with a return address on the stack, so code ending in
`RET` returns to the monitor. Code that changes the stack pointer, interrupt
mode, or UART/CTC setup must restore it before returning.
Build the ROM and programmer-format images with:
```sh
make
```
The outputs are `build/metal/monitor.bin` (32 KiB ROM image) and
`build/metal/monitor.prog.bin` (compact programmer image). The ROM layout is:
- `0000-007F`: reset/copy bootstrap
- `0080...`: compact vector/code image copied to RAM starting at `C000`
- Remaining bytes: unused and available for additional ROM content
The monitor executable starts at `C080`; its IM 2 vector table is at `C040`.
`monitor.prog.bin` ends immediately after the occupied payload, while
`monitor.bin` remains a complete 32 KiB chip image.