Introduce Coco 3 Plus for MiSTer

Add original-firmware Sound & Speech, four configurable Multi-Pak sockets,
bounded per-slot ROM allocation and a nine-page menu organized around devices
and media. Repair inherited clock/reset/CPU-memory/video paths and add explicit
conditional external-I/O timing contracts. Preserve native Main startup-file
ordering, saved layouts, stock-core separation and the coco3plus media profile.

Provide native Windows tool downloads, pinned ToolShed ROM assembly, fresh
Quartus builds, functional and fitted timing checks, reviewed release packaging
and passwordless SSH installation with backups. Retain original component
notices, document contribution copyright and keep SSC ROM inputs outside Git.

Validation: Quartus17.0.2 Build602 seed5, zero errors; 15 functional jobs,
368 both-corner timing scopes and eight tooling-integrity checks pass.
The renamed build reaches Disk BASIC, PRINT1+1 returns2 and SSC loads ready.
Physical cold power cycling and conditional board-delay assumptions remain
separate. Full original upstream histories are preserved before this single
consolidated implementation commit.
This commit is contained in:
bholman committed 2026-11-18 16:00:45 -07:00
1 parent 8b8cf72d1f
commit cb40fed3b9
126 files changed
+12795 -528

No files matched your search

+51 -14
View File
@@ -1,3 +1,5 @@
// Original Coco 3 Plus contributions: Copyright (c) 2026 Brian K. Holman.
// Original component notices/terms retained; see COPYRIGHT.md and LICENSING.md.
`timescale 1ns / 1ns
//////////////////////////////////////////////////////////////////////////////////
// Company:
@@ -191,14 +193,14 @@ reg [15:0] ea_p1;
// NMI is supposed to be masked - despite the name - until the 6809 loads a value into S.
// Frankly, I'm cheating slightly. If someone does a LDS #$0, it won't disable the mask. Pretty much anything else
// that changes the value of S from the default (which is currently $0) will clear the mask. A reset will set the mask again.
reg NMIMask;
(* keep *) wire NMIMask;
reg NMILatched;
(* keep *) wire NMILatched;
reg rnRESET=0; // The latched version of /RESET, useful 1 clock after it's latched
reg NMISample;
reg NMISample2;
reg NMIClear;
reg NMIClear_nxt;
wire wNMIClear = NMIClear;
reg IRQLatched;
@@ -534,14 +536,52 @@ endgenerate
///////////////////////////////////////////////////////////////////////
always @(negedge NMISample2 or posedge wNMIClear)
// Research: registered observations replace event clocks and next-S logic.
// S and its prior master-cycle value expose the actual CPU register update,
// avoiding the long instruction/ALU -> s_nxt comparator in the NMI mask path.
reg [15:0] NMIStackPrevious;
reg NMIMaskStored = 1'b1;
reg NMIEdge = 1'b0;
reg NMIPending = 1'b0;
function NMIStackDiff;
input [15:0] previous_value, current_value;
begin
NMIStackDiff = 1'b0;
if (previous_value != current_value) NMIStackDiff = 1'b1;
end
endfunction
wire NMIStackChanged = NMIStackDiff(NMIStackPrevious, s);
assign NMIMask = NMIMaskStored && !NMIStackChanged;
reg NMIQualifiedEdge;
always @* begin
NMIQualifiedEdge = 1'b0;
if (NMIEdge)
if (NMIClear == 1'b1) NMIQualifiedEdge = 1'b0;
else if (NMIMask == 1'b0) NMIQualifiedEdge = 1'b1;
end
// The same-event view uses new registered mask/clear values after NBA updates.
// Pending state retains that view on the next master edge; CPU-visible timing
// therefore has no extra E-cycle, including back-to-back CPU enables.
reg NMIVisible;
always @* begin
NMIVisible = 1'b1;
if (NMIClear == 1'b1) NMIVisible = 1'b1;
else if (NMIPending || NMIQualifiedEdge) NMIVisible = 1'b0;
end
assign NMILatched = NMIVisible;
always @(negedge MASTER)
begin
if (wNMIClear == 1)
NMILatched <= 1;
else if (NMIMask == 0)
NMILatched <= 0;
else
NMILatched <= 1;
NMIStackPrevious <= s;
if (!nRESET || !rnRESET) begin
NMIMaskStored <= 1'b1;
NMIEdge <= 1'b0;
NMIPending <= 1'b0;
end else begin
NMIEdge <= E && NMISample2 && !NMISample;
if (NMIStackChanged) NMIMaskStored <= 1'b0;
if (NMIClear == 1'b1) NMIPending <= 1'b0;
else if (NMIQualifiedEdge) NMIPending <= 1'b1;
end
end
//
@@ -579,7 +619,6 @@ begin
end
end
reg rnRESET=0; // The latched version of /RESET, useful 1 clock after it's latched
always @(negedge MASTER)
begin
if (E)
@@ -635,13 +674,11 @@ begin
IntType <= IntType_nxt;
if (s != s_nxt) // Once S changes at all (default is '0'), release the NMI Mask.
NMIMask <= 1'b0;
end
else
begin
CpuState <= CPUSTATE_RESET;
NMIMask <= 1'b1; // Mask NMI until S is loaded.
NMIClear <= 1'b0; // Mark us as not having serviced NMI
end
end