rtl/sprites.v draws sprites between the graphics and the text from a pair
of line buffers filled one graphics line ahead. Ports 70h-77h set
position, shape, flip and on/off and load shapes; 78h is a frame counter;
80h-87h report sprite-sprite and sprite-graphics collisions per frame.
The graphics fill (CLS) turns sprites off unless bit 7 is set.
Testbench checks pixels, priority, flip, edge clipping, collisions and
CLS. Manual, README and basic/examples/sprites.bas demo.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two-pass table-driven assembler in the monitor: assembles BASIC-saved
source files from the file system, or one line at a time with A addr.
Labels, EQU/ORG/DB/DW/DS/END, expressions. Table generated from the
disassembler (tools/gen-asmtab.py); round-trip and sdasz80 tests, plus a
Z-80 build run in z80emu. Monitor RAM grows to 6000-7FFF for the symbol
table. Works around an SDCC 4.5 inline strcpy bug with s_copy().
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Monitor: the CPU gets an NMI (taken at an instruction start, or from
HALT) raised by the Pause key, BASIC's MONITOR, two hardware breakpoint
comparators or a step counter. It enters through a trampoline at 0066h
(the same bytes in BASIC's ROM and the monitor's, basic/tramp.s) that
switches in a 32 KB monitor bank over 0000-7FFF. The monitor (monitor/,
C) runs on the terminal's new alternate screen (CSI ?47 h/l, a second
screen page; graphics hidden) and shows registers, flags, a disassembly
from PC, the stack and memory. Commands: Enter/S n step, O step over,
G/X go, B breakpoint, D/M windows, E edit, R registers, and SAVE/LOAD/
DIR for memory files. The disassembler covers every opcode;
monitor/test-disasm.py round-trips all forms through sdasz80. Lockstep
CPU tests still match the reference emulator.
BASIC: MONITOR, CALL addr, BSAVE "N",start,len and BLOAD "N"[,addr]
(memory files: load address then bytes). The DATE clock moves to
F3F8h so the monitor can date files. F000-F3F7 is kept free for
machine code (program area 21076 bytes).
Serial: SW1:0 = 10 is now 921600 and 11 is 3 Mbaud. A 17 KB burst to
BASIC lists back identical at both on the board. send-bas.py reads
the echo while sending; unread, it could stall the PC's flow control.
Ctrl-Alt-Del in Z-80 mode restarts the Z-80 like BTND.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BASIC gets SAVE, LOAD, RUN "NAME", DIR and DEL, storing program listings
in the configuration flash from 240000h (448 x 4 KB blocks, 64 files,
32 KB each). The directory is kept in two alternating blocks with a
sequence number and checksum, new data is written before the directory
switches to it, and every page is verified after programming.
rtl/flash_spi.v drives the flash through STARTUPE2 on ports 40h/41h. It
only passes read, status, WREN/WRDI, RDID, page program and 4 KB erase,
and abandons any program or erase below 240000h before the address
reaches the chip. Tested on the board: an erase at 0 and a write at
200000h were refused and left the flash unchanged.
With SW14 up, the Z-80's output is also copied to the PC's serial port,
and tools/get-bas.py uses that to LIST a program into a file or run
commands and print the replies.
Also fixes port 10h returning the previous millisecond latch (the first
read after reset was undefined). Simulation adds a model flash and a
save/load/run/protection test. Manual and README updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- z80_system: dual-clock graphics RAM behind ports 30h-34h (X/Y, plot
with auto-increment, read-back, hardware fill); text_display overlays it
under the text, colour 0 transparent.
- BASIC: CLS COLOR PLOT LINE RECT FILL CIRCLE POINT, LOCATE and INK;
faster keyword tokenizing.
- docs/basic-manual.md (+ PDF via docs/build-manual.sh).
- basic/examples/graphics-demo.bas and tools/send-bas.py to load programs
over the serial port.
- Simulation checks drawing and saves a frame; the emulator models the
graphics and timer ports and can stop when BASIC waits for input.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SW15 switches the terminal from the PC's serial line to a Z-80 running at
90 MHz from its own clock, with 64 KB of block RAM preloaded with BASIC.
- rtl/z80_cpu.v: Z-80 built for speed (one clock per memory access, next
byte read during decode), full documented instruction set plus the
common undocumented forms; no interrupts.
- rtl/z80_system.v: RAM, console/timer/7-segment ports, toggle handshakes
to the terminal clock.
- basic/: BASIC interpreter in C for SDCC, start-up code, prebuilt image.
- tools/z80emu.py, tools/cputest.py, scripts/cpusim.sh: reference emulator
and random tests comparing the CPU after every instruction.
- SW14 feeds the PC's UART into the Z-80 for pasting programs; BTND
resets the Z-80 only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>