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>
This commit is contained in:
brad ArantandClaude Opus 5.5 committed 2026-11-29 09:21:02 -08:00
1 parent 13373244e8
commit 743071cff3
19 files changed
+3544 -1306

No files matched your search

+20
View File
@@ -398,6 +398,17 @@ module tb_terminal;
errors = errors + 1;
end
// ---- held keys: Ctrl and right Shift (they type nothing) read on
// port 136 as fire (16) + shift (64), and right Shift on port 137
ps2_send(8'h14); ps2_send(8'h59);
#2_000_000;
uart_str("CLS:OUT 137,89:LOCATE 30,1:PRINT INP(136);INP(137)\015");
wait_row(29, " 80 1");
ps2_send(8'hF0); ps2_send(8'h14); ps2_send(8'hF0); ps2_send(8'h59);
#2_000_000;
uart_str("CLS:LOCATE 30,1:PRINT INP(136);INP(137)\015");
wait_row(29, " 0 0");
// ---- files in the flash, and the bitstream protection
uart_str({"CLS:DATE \"2026-11-28 09:30\":NEW\01510 PRINT \"SAVED\";6*7\015SAVE \"TEST1\"\015NEW\015",
"LOAD \"TEST1\"\015RUN\015DIR\015"});
@@ -504,6 +515,15 @@ module tb_terminal;
wait_at(29, 40, "ASSEMBLED F000-F019");
uart_str("A F100\015LD A,42H\015\015");
wait_at(5, 2, "F100 3E 42");
// an Intel HEX record and the end record
uart_str(":03F10000AABBCCDB\015:00000001FF\015");
wait_at(29, 40, "HEX LOADED F100-F102");
if (dut.z80.ram[16'hF100] == 8'hAA && dut.z80.ram[16'hF101] == 8'hBB && dut.z80.ram[16'hF102] == 8'hCC)
$display("PASS hex record in memory");
else begin
$display("FAIL hex record: %h %h %h", dut.z80.ram[16'hF100], dut.z80.ram[16'hF101], dut.z80.ram[16'hF102]);
errors = errors + 1;
end
uart_str("X\015");
#3_000_000;
uart_str("CLS:CALL 61440\015");