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

+32 -10
View File
@@ -56,8 +56,7 @@ module basys3_terminal #(
input PS2Clk,
input PS2Data,
output QspiCSn,
inout [3:0] QspiDB,
output [3:0] JA // PmodAMP2: audio in, gain, -, shutdown (low)
inout [3:0] QspiDB
);
localparam [7:0] XON = 8'h11, XOFF = 8'h13;
@@ -127,9 +126,34 @@ module basys3_terminal #(
.clk(clk), .rst(rst | ~rv_mode), .code(scan), .code_valid(scan_valid), .down(keys_down)
);
// Ctrl-Alt-Del in computer mode restarts the computer, like BTND (held 1 us)
// Ctrl-Alt-Del in computer mode enters the monitor (an NMI, like Pause).
// It restarts the computer instead, like BTND (held 1 us), when the monitor
// is already running or an NMI is still waiting to be taken (the CPU is
// wedged), or when it comes again within 2 s. A press counts only after
// Delete has been up for 5 ms, so holding the keys (which repeats Delete)
// is one press. Port 62 (the monitor's RESET) restarts the computer too.
wire mon_busy, reset_t;
(* ASYNC_REG = "TRUE" *) reg [1:0] busy_s = 2'd0;
(* ASYNC_REG = "TRUE" *) reg [2:0] rreq_s = 3'd0;
always @(posedge clk) begin
busy_s <= {busy_s[0], mon_busy};
rreq_s <= {rreq_s[1:0], reset_t};
end
reg [19:0] del_up = 20'd0; // how long Delete has been up
reg [27:0] cad_win = 28'd0; // counts down 2 s after a press
reg cad_nmi_t = 1'b0; // toggles: enter the monitor
wire del_held = keys_down[8'h71] | keys_down[8'hF1];
wire cad_new = cad && rv_mode && del_up[19];
wire cad_rst = cad_new && (busy_s[1] || cad_win != 0);
reg [6:0] cad_t = 7'd0;
always @(posedge clk) cad_t <= cad && rv_mode ? 7'd100 : cad_t - (cad_t != 0);
always @(posedge clk) begin
if (rst || del_held || (cad && rv_mode)) del_up <= 20'd0;
else del_up <= del_up + {19'd0, !del_up[19]};
if (rst) cad_win <= 28'd0;
else cad_win <= cad_new ? CLK_HZ * 2 : cad_win - (cad_win != 0);
if (cad_new && !cad_rst) cad_nmi_t <= ~cad_nmi_t;
cad_t <= cad_rst || (rreq_s[2] ^ rreq_s[1]) ? 7'd100 : cad_t - (cad_t != 0);
end
// ----------------------------------------------------------- host input
// Keyboard bytes and terminal replies go to the host: the PC's UART, or in
@@ -345,6 +369,8 @@ module basys3_terminal #(
always @(posedge clk) if (scan_valid && scan == 8'hE1 && rv_mode) brk_t <= ~brk_t;
(* ASYNC_REG = "TRUE" *) reg [2:0] brk_s = 3'd0;
always @(posedge cpu_clk) brk_s <= {brk_s[1:0], brk_t};
(* ASYNC_REG = "TRUE" *) reg [2:0] cad_s = 3'd0;
always @(posedge cpu_clk) cad_s <= {cad_s[1:0], cad_nmi_t};
wire wide; // DECCOLM from the terminal (term_ctrl below)
rv32_system #(.MEM_FILE(MEM_FILE), .MEM_HI_FILE(MEM_HI_FILE), .MON_FILE(MON_FILE), .CPU_HZ(CPU_HZ), .ROM_TOP(ROM_TOP)) sys (
@@ -352,19 +378,15 @@ module basys3_terminal #(
.rx_req(zrx_req), .rx_data(zrx_data), .rx_ack(zrx_ack),
.tx_req(ztx_req), .tx_data(ztx_data), .tx_ack(ztx_ack), .wide(wide),
.seg_val(rv_seg), .halted(), .brk_key(brk_s[2] ^ brk_s[1]),
.cad_key(cad_s[2] ^ cad_s[1]), .mon_busy(mon_busy), .reset_t(reset_t),
.vclk(pix_clk), .gfx_vaddr(gfx_addr), .gfx_vpix(gfx_pix),
.scroll_x(scroll_x), .scroll_y(scroll_y), .g_border(g_border),
.g_hires(g_hires), .g_cols(g_cols),
.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), .keys(keys_down),
.fl_cs_n(QspiCSn), .fl_sck(fl_sck), .fl_mosi(QspiDB[0]), .fl_miso(QspiDB[1]),
.audio(JA[0])
.fl_cs_n(QspiCSn), .fl_sck(fl_sck), .fl_mosi(QspiDB[0]), .fl_miso(QspiDB[1])
);
// PmodAMP2 on JA's top row: gain high is 6 dB (low would be 12 dB), and
// the amplifier is on unless its shutdown pin is low.
assign JA[3:1] = 3'b101;
// The flash clock is the configuration clock pin, reached through STARTUPE2.
// DQ2/DQ3 (write protect, hold) stay high.
assign QspiDB[1] = 1'bz;