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>
This commit is contained in:
brad ArantandClaude Opus 5.5 committed 2026-11-27 21:09:43 -08:00
1 parent 59d5e617f2
commit dc7c7c22c5
14 files changed
+5205 -4141

No files matched your search

+17 -1
View File
@@ -169,7 +169,7 @@ module tb_terminal;
endtask
// check VGA timing on the outputs
realtime t_hs = 0, t_vs = 0;
realtime t_hs = 0, t_vs = 0, t_cmd;
always @(negedge hs) begin
if (t_hs != 0 && ($realtime - t_hs) != 32000) $display("HSYNC period %0t", $realtime - t_hs);
t_hs = $realtime;
@@ -264,6 +264,22 @@ module tb_terminal;
expect_row(10, " 1 4 9");
expect_row(11, "READY");
// ---- graphics
uart_str({"CLS:INK 11:CIRCLE 160,120,50,12:FILL 10,10,40,30,4:",
"LINE 0,0,319,239,14:PRINT POINT(160,70)\015"});
t_cmd = $realtime;
while (cellraw(0, 2) != "2" && $realtime - t_cmd < 20_000_000) #10_000;
$display("graphics line ran in %0.2f ms", ($realtime - t_cmd) / 1e6);
expect_row(0, " 12");
if (dut.z80.gfx[70 * 320 + 160] == 12 && dut.z80.gfx[20 * 320 + 20] == 4 &&
dut.z80.gfx[120 * 320 + 160] == 14 && dut.z80.gfx[5 * 320 + 100] == 0)
$display("PASS graphics memory");
else begin
$display("FAIL graphics memory");
errors = errors + 1;
end
capture_frame("frame_3.ppm");
dump_screen;
if (errors == 0) $display("ALL TESTS PASSED");
else $display("%0d TESTS FAILED", errors);