Remove the sound chip; Ctrl-Alt-Del opens the monitor

The sound chip (rtl/sound.v, ports 90h-9Dh, the PmodAMP2 on JA) is removed:
its ports now read FFh like any unused port, the JA pins are free, and the
manual, README, example and tests no longer mention it. No game used it.

Ctrl-Alt-Del raises the monitor's NMI (STOPPED BY CTRL-ALT-DEL) instead of
resetting; pressed in the monitor, again within 2 s, or while an NMI is still
pending it restarts the computer. The monitor gains RESET (port 62), and
BASIC returns to the main screen at start-up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
brad ArantandClaude Opus 5.5 committed 2026-12-02 09:08:48 -08:00
1 parent addf0157fc
commit 305c608bb5
19 files changed
+1707 -2021

No files matched your search

+11 -14
View File
@@ -42,8 +42,9 @@
// 40 SPI flash control, 41 SPI flash data (see flash_spi.v)
// 60 out bit 1 = stop again (NMI) after one instruction of the program
// in why the last NMI came: 1 Pause key, 2 port 61, 3 step,
// 4 breakpoint 0, 5 breakpoint 1
// 4 breakpoint 0, 5 breakpoint 1, 6 Ctrl-Alt-Del
// 61 out enter the monitor (NMI)
// 62 out restart the computer (as BTND does; the monitor's RESET)
// 67 out bit 0 = breakpoint 0 on, bit 1 = breakpoint 1 on
// 70-78, 80-87 sprites (see sprites.v)
// 88 in keys held: bit 0 up (W, cursor or keypad 8), 1 down (S, 2), 2 left
@@ -51,7 +52,6 @@
// 7 Esc
// 89 out pick a scan code (set 2; add 128 for an E0 code)
// in 1 if that key is held, else 0
// 90-9D sound (see sound.v)
// The Z-80's debug-read ports (62-64) are gone: the monitor runs in the same
// address space as the program. Its breakpoint addresses are 32 bits, below.
//
@@ -88,6 +88,9 @@ module rv32_system #(
output reg [15:0] seg_val,
output halted,
input brk_key, // pulse: the Pause key, enter the monitor
input cad_key, // pulse: Ctrl-Alt-Del, enter the monitor too
output mon_busy, // the monitor runs, or an NMI waits to be taken
output reg reset_t = 1'b0, // toggles: port 62, restart the computer
// graphics layer read port, on the video clock
input vclk,
input [16:0] gfx_vaddr,
@@ -111,9 +114,7 @@ module rv32_system #(
output fl_cs_n,
output fl_sck,
output fl_mosi,
input fl_miso,
// sound, for a PmodAMP2
output audio
input fl_miso
);
localparam [31:0] MON_BASE = 32'h0002_0000;
assign halted = 1'b0;
@@ -366,13 +367,6 @@ module rv32_system #(
.rd_on(sp_on), .pix(sp_pix), .gfx_pix(gfx_vpix), .ftick(sp_ftick)
);
// ---------------------------------------------------------------- sound
wire [7:0] snd_q;
sound #(.CPU_HZ(CPU_HZ)) snd (
.clk(clk), .rst(rst), .hush(io_wr && io_addr == 8'h34 && !io_wd[7]),
.io_wr(io_wr), .io_port(io_addr), .io_wd(io_wd), .io_q(snd_q), .audio(audio)
);
// ---------------------------------------------------------- held keys
// The keyboard's clock writes these; a bit that changes while it is read
// just reads as before or after.
@@ -447,6 +441,8 @@ module rv32_system #(
if (!nmi_r && !in_mon) begin
if (brk_key) begin
nmi_r <= 1'b1; why_r <= 3'd1;
end else if (cad_key) begin
nmi_r <= 1'b1; why_r <= 3'd6;
end else if (io_wr && io_addr == 8'h61) begin
nmi_r <= 1'b1; why_r <= 3'd2;
end
@@ -459,6 +455,9 @@ module rv32_system #(
end
end
assign mon_busy = nmi_r || in_mon;
always @(posedge clk) if (io_wr && io_addr == 8'h62) reset_t <= ~reset_t;
(* ASYNC_REG = "TRUE" *) reg [1:0] wide_s = 2'b00;
always @(posedge clk) wide_s <= {wide_s[0], wide};
@@ -480,8 +479,6 @@ module rv32_system #(
io_din = spr_q;
8'h88: io_din = joy;
8'h89: io_din = {7'd0, keys[key_sel]};
8'h98, 8'h99, 8'h9A:
io_din = snd_q;
default: io_din = 8'hFF;
endcase
always @* case (io_a[7:0])