Add a three-voice sound chip for the PmodAMP2 on JA

Ports 90h-9Dh: three square-wave voices and a noise source, a mixer,
16 log volumes with attack/decay envelopes, summed and played through a
sigma-delta output on JA[0]. CLS and reset hush it. Includes a
testbench (scripts/sim-sound.sh), a BASIC example and manual section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
brad ArantandClaude Opus 5.5 committed 2026-11-30 11:13:37 -08:00
1 parent b629cbec00
commit 2d1be15786
11 files changed
+428 -3

No files matched your search

+12 -1
View File
@@ -85,7 +85,9 @@ module z80_system #(
output fl_cs_n,
output fl_sck,
output fl_mosi,
input fl_miso
input fl_miso,
// sound, for a PmodAMP2
output audio
);
wire [15:0] ma, io_addr, pc_dbg;
wire we, io_rd, io_wr, ins_start;
@@ -186,6 +188,13 @@ module z80_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[7:0] == 8'h34 && !io_wd[7]),
.io_wr(io_wr), .io_port(io_addr[7:0]), .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.
@@ -296,6 +305,8 @@ module z80_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