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

+79
View File
@@ -0,0 +1,79 @@
// Original Coco 3 Plus contributions: Copyright (c) 2026 Brian K. Holman.
// Original component notices/terms retained; see COPYRIGHT.md and LICENSING.md.
// SPDX-License-Identifier: BSD-3-Clause
// Coco 3 Plus persistent four-slot layout. Main's normal status exchange owns
// storage; this module migrates old settings and moves singleton devices.
module bh_mpi_config(
input wire clk,reset,input wire [63:0] requested,
output reg [63:0] accepted=0,
output reg [63:0] status_in=0,output reg status_set=0);
// Each slot: 0 empty,1 ROM,2 floppy,3 SDC,4 SSC,5 Orchestra,6 legacy audio,
// 7 RS232. Audio is an explicitly named convenience combination preserving the old
// independent Orchestra plus switchable SSC, not a physical cartridge claim.
localparam [11:0] ORIGINAL={3'd2,3'd1,3'd3,3'd6};
reg [63:0] last_requested=~64'd0;
reg pending=0;
reg host_started=0;
reg [63:0] next_status;
reg [11:0] layout;
reg [4:0] used,mask,remaining;
reg [2:0] kind;
reg has_ssc;
integer i,j,primary,order;
function [4:0] devices(input [2:0] k);
begin case(k)
2:devices=1;3:devices=2;4:devices=4;5:devices=8;
6:devices=12;7:devices=16;default:devices=0;
endcase end
endfunction
always_comb begin
next_status=requested;
if(!requested[63])begin
next_status[63]=1;
next_status[13:12]=requested[13:12]+2'd1;
next_status[54:43]=ORIGINAL;
end
layout=next_status[54:43];primary=0;
// Most recently edited slot wins; a persisted multi-edit has a deterministic
// highest changed slot. Read-only/default fields never move devices.
for(i=0;i<4;i=i+1)
if(layout[i*3+:3]!=accepted[43+i*3+:3])primary=i;
used=0;
for(order=0;order<5;order=order+1)begin
j=(order==0)?primary:order-1;
if(order==0||j!=primary)begin
kind=layout[j*3+:3];mask=devices(kind);remaining=mask&~used;
if(mask!=0&&remaining!=mask)begin
if(kind==6&&remaining==4)kind=4;
else if(kind==6&&remaining==8)kind=5;
else kind=0;
end
layout[j*3+:3]=kind;used=used|devices(kind);
end
end
next_status[54:43]=layout;
has_ssc=0;
for(i=0;i<4;i=i+1)has_ssc=has_ssc||layout[i*3+:3]==4||layout[i*3+:3]==6;
if(!has_ssc)next_status[42]=0;
if(requested[63]&&layout[primary*3+:3]==4&&
accepted[43+primary*3+:3]!=4)next_status[42]=1;
end
always @(posedge clk)begin
status_set<=0;
if(reset)begin
accepted<=0;last_requested<=~64'd0;pending<=0;status_in<=0;host_started<=0;
end else begin
if(requested[0])host_started<=1;
// Main polls status requests after every FC transfer; acknowledgement clears
// bit0. Publishing default migration during initialization would prematurely
// end its reset-held ROM-loading phase. Wait for Main's own final release,
// and never publish a pending snapshot while a newer host value is arriving.
if(host_started&&!requested[0]&&requested==last_requested&&pending&&!status_set)
begin status_set<=1;pending<=0;end
if(requested!=last_requested)begin
last_requested<=requested;accepted<=next_status;
status_in<=next_status;pending<=requested!=next_status;
end
end
end
endmodule