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

+7 -1
View File
@@ -117,6 +117,12 @@ module basys3_terminal #(
.ascii(key), .ascii_valid(key_valid), .caps(caps), .cad(cad)
);
// keys held down, for the Z-80's game ports (nothing is held outside Z-80 mode)
wire [255:0] keys_down;
ps2_keystate kbd_state (
.clk(clk), .rst(rst | ~z80_mode), .code(scan), .code_valid(scan_valid), .down(keys_down)
);
// Ctrl-Alt-Del in Z-80 mode restarts the Z-80, like BTND (held 1 us)
reg [6:0] cad_t = 7'd0;
always @(posedge clk) cad_t <= cad && z80_mode ? 7'd100 : cad_t - (cad_t != 0);
@@ -338,7 +344,7 @@ module basys3_terminal #(
.seg_val(z80_seg), .halted(), .brk_key(brk_s[2] ^ brk_s[1]),
.vclk(pix_clk), .gfx_vaddr(gfx_addr), .gfx_vpix(gfx_pix),
.sp_go(sp_go), .sp_line(sp_line), .sp_buf(sp_buf), .sp_x(sp_x), .sp_on(sp_on),
.sp_pix(sp_pix), .sp_ftick(pix_frame),
.sp_pix(sp_pix), .sp_ftick(pix_frame), .keys(keys_down),
.fl_cs_n(QspiCSn), .fl_sck(fl_sck), .fl_mosi(QspiDB[0]), .fl_miso(QspiDB[1])
);