Commit Graph
16 Commits
Author SHA1 Message Date
brad ArantandClaude Opus 5.5 62d0883a7f Bastion Raid: isometric scrolling shooter, graphics scroll and border
Ports 35h-37h scroll the graphics layer (wrapping at 320 x 240); bit 1 of
36h hides a border (4 columns, 2 rows) where a program draws the strip
coming into view unseen. The video loads its own column/row counters from
the scroll registers each line and frame. CLS resets both. Testbench
checks scroll, wrap and border.

games/raid: an original Zaxxon-style game in C - fly over a fortress that
scrolls diagonally, climb over low walls and through doorways in tall
ones, shoot turrets, fuel tanks, radar and fighters, destroy the reactor.
The world is drawn pixel by pixel from a formula, two columns and a row a
frame (about 40% of the Z-80). test-raid.py flies the level with an
autopilot and checks the frame budget; tools/boardemu.py is now shared by
both games' tests. send-hex.py sets the date before saving.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 10:00:25 -08:00
brad ArantandClaude Opus 5.5 743071cff3 The Iron Keep: a top-down escape game, held-key ports, monitor HEX loader
games/keep: an original game in C for the Z-80 using the sprites - twelve
rooms, guards that patrol, see along rows and columns and shoot, keys and
locked doors, gold, ammunition and a crown to steal. gen.py holds the art
and castle map and checks reachability; test-keep.py runs it in z80emu on
a model of the board's ports, takes screenshots and has a bot play it
through. keep.bas loads KEEPGAME at 8600h and CALLs it.

Ports 88h/89h read keys held down (ps2_keystate), the monitor writes
Intel HEX records typed at its prompt, and tools/send-hex.py sends a
whole file and saves it as a memory file. Testbench covers both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 09:21:02 -08:00
brad ArantandClaude Opus 5.5 13373244e8 Hardware sprites: 32 x 16x16 from 64 shapes, collisions, frame counter
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>
2026-11-29 08:36:41 -08:00
brad ArantandClaude Opus 5.5 c78073320b Add MIT license
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 07:37:46 -08:00
brad ArantandClaude Opus 5.5 af9f381ec8 Manual: 80x32/132x64 limits, fast baud rates, smooth scroll; drop duplicate PC section
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 07:13:56 -08:00
brad ArantandClaude Opus 5.5 fe1daf180d Monitor: Z-80 assembler (ASM "file", A addr)
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>
2026-11-28 16:42:42 -08:00
brad ArantandClaude Opus 5.5 88b5942da5 1280x1024 display: 80x32 big font or 132x64 (DECCOLM)
The display runs at 1280x1024 60 Hz from a second MMCM (108 MHz pixel
clock), one pixel per clock through a four-stage pipeline. 80 columns
show 80x32 cells of 16x32 pixels (the 8x16 font doubled); CSI ?3 h
switches to 132x64 cells of 8x16 pixels, centred, and CSI ?3 l back,
both clearing the screen and margins as a VT100 does. The 320x240
graphics layer is drawn 4x4 in the top 960 lines, so 80-column row r
still meets graphics line 8(r-1).

The terminal engine has 6-bit rows and 8-bit columns, a 132-cell row
stride in both layouts (so the copy engine is unchanged), 132 tab stops
and 3-digit cursor reports. The character RAM holds two 132x64 pages
(normal and alternate) and is read on the pixel clock.

BASIC's LOCATE takes rows up to 64 and columns up to 132. terminfo has
basys3 (80x32) and basys3-w (132x64). The testbench reads the 132-cell
layout, checks 1280x1024 sync timing, captures 1280x1024 frames and
tests DECCOLM both ways.

Timing met (0.044 ns at 90 MHz CPU, 108 MHz pixel); 46 of 50 BRAMs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 12:24:21 -08:00
brad ArantandClaude Opus 5.5 634e314010 Machine-code monitor, fast serial, memory files, Ctrl-Alt-Del
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>
2026-11-28 11:17:54 -08:00
brad ArantandClaude Opus 5.5 767377f38d BASIC: file dates and data files
DATE "YYYY-MM-DD[ HH:MM[:SS]]" sets a clock kept from the millisecond
counter, DATE prints it and DATE$ returns it. Directory entries now
record each file's creation date (format BFS2; a BFS1 directory is
widened when read), and DIR shows it. send-bas.py and get-bas.py set
the date from the PC when they connect (--no-date to skip).

Data files: OPEN "NAME" FOR INPUT|OUTPUT|APPEND AS #n (n = 1-3),
PRINT #n, INPUT #n, LINE INPUT [#n,], EOF(n), CLOSE [#n]. SAVE and LOAD
now use the same channel code. A written file replaces the old one only
at CLOSE; APPEND shares the old file's full blocks and copies the last
part block. New errors FILE ALREADY OPEN, FILE NOT OPEN, INPUT PAST END;
PROGRAM TOO BIG TO SAVE becomes FILE TOO BIG.

The program area shrinks from 23000 to 22100 bytes to keep the stack
at about 3 KB beside the file buffers. Code now ends at 7EBFh.

The simulation sets the date, checks it in DIR and round-trips a data
file, waiting for expected rows instead of fixed delays. Tested on the
board: dates, write/append/read, EOF, the BFS1 conversion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 08:50:15 -08:00
brad ArantandClaude Opus 5.5 29a15bf7c7 Flash file system for BASIC, with bitstream write protection
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>
2026-11-28 08:33:52 -08:00
brad ArantandClaude Opus 5.5 dc7c7c22c5 BASIC graphics: 320x240 16-colour layer, manual and demo
- 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>
2026-11-27 21:09:43 -08:00
brad ArantandClaude Opus 5.5 59d5e617f2 Z-80 computer with Dartmouth-style BASIC as the terminal's console
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>
2026-11-27 20:25:41 -08:00
barantandClaude Opus 5.5 1e4e2101b8 Ignore OSC/DCS/APC/PM/SOS strings; ease timing in the terminal engine
Ubuntu's prompt emits OSC 3008 context markers (ESC ] 3008;... ESC \),
which were printed as text. String sequences are now swallowed up to
BEL or ST, like a real terminal.

CSI commands now run one clock after their final byte with registered
counts, and scroll ranges are computed over two clocks, so the design
no longer scrapes by on timing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:32:04 -08:00
barantandClaude Opus 5.5 6e54d75c56 VT220 emulation with ANSI colour, underline and smooth scrolling
- Terminal engine rewritten for VT220: scroll regions, IL/DL/ICH/DCH/ECH,
  SU/SD, origin mode, insert mode, tab stops, DEC special graphics with
  G0/G1 and SO/SI, DECSC/DECRC, DECSTR, RIS, DECALN, DECLL LEDs
- Replies to DA, secondary DA, DSR and CPR over the UART
- 16-colour SGR (256-colour and RGB approximated), bold, underline,
  blink, reverse and conceal; cells are now 18 bits
- Smooth scrolling (SW8 or DECSCLM): the region slides per frame and
  rows are moved during vertical blanking; XON/XOFF holds the host back
- Keyboard: DECCKM, keypad application mode, F5-F12, VT220 Home/End,
  Alt as ESC prefix
- basys3 terminfo entry (vt220 + 16 colours, 30 lines)
- Flash script reboots the FPGA from flash after programming
- Testbench covers replies, modes, attributes, editing and smooth scroll

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:18:36 -08:00
barantandClaude Opus 5.5 a95062f42d Flash programming: support Macronix mx25l3273f (newer Basys 3 boards)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 10:27:46 -08:00
barantandClaude Opus 5.5 0e95a14cfe Basys 3 ASCII terminal: VGA 80x30 text, USB keyboard, UART
- VGA 640x480@60 text display, 8x16 CP437 font ROM from Linux console fonts
- USB HID keyboard (PS/2 via onboard PIC24), scan code set 2 to ASCII
  with xterm sequences for cursor/editing keys
- UART RX/TX with switch-selectable baud, local echo option
- Terminal engine: control codes, deferred wrap, hardware scroll,
  VT100/ANSI subset (cursor moves, erase, reverse video, cursor hide)
- Vivado build/program/flash scripts and xsim whole-design testbench

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 10:26:13 -08:00