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

+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/env python3
"""Install a verified overlay using existing passwordless OpenSSH access."""
import argparse,datetime,json,re,shlex,subprocess
from pathlib import Path,PurePosixPath
from release import ROOT,make_release,sha
def q(s):return shlex.quote(str(s))
def main():
p=argparse.ArgumentParser(description=__doc__)
p.add_argument('--host',help='IP or DNS hostname; prompted when omitted')
p.add_argument('--user',default='root')
p.add_argument('--release',type=Path,help='Existing tools/release.py output; otherwise package defaults')
p.add_argument('--without-ssc',action='store_true')
p.add_argument('--load',action='store_true',help='Return to MENU then load the new launcher')
a=p.parse_args();a.host=a.host or input('MiSTer IP address or hostname: ').strip()
if not re.fullmatch(r'[A-Za-z0-9][A-Za-z0-9._-]*',a.host) or not re.fullmatch(r'[A-Za-z_][A-Za-z0-9_-]*',a.user):p.error('Use a plain hostname/IP and Unix username')
stamp=datetime.datetime.now(datetime.timezone.utc).strftime('%Y%m%dT%H%M%S%fZ')
release=a.release.resolve() if a.release else ROOT/'dist'/('install-'+stamp)
if not a.release:make_release(release,ROOT/'build/fpga',ROOT/'build/roms',ROOT/'roms/ssc',a.without_ssc)
manifest=json.loads((release/'manifest.json').read_text());fat=release/'fat'
if manifest.get('public_package'):raise RuntimeError('Public core/source package omits required ROMs. Build a complete local package with your verified ROM inputs; see docs/INSTALL.md.')
for n,v in manifest['files'].items():
path=PurePosixPath(n)
if path.is_absolute() or '..' in path.parts or '\\' in n:raise RuntimeError('Unsafe manifest path')
file=fat/n
if not file.is_file() or file.stat().st_size!=v['bytes'] or sha(file)!=v['sha256']:raise RuntimeError('Release changed: '+n)
args=['-o','BatchMode=yes','-o','StrictHostKeyChecking=yes','-o','ConnectTimeout=10']
target=a.user+'@'+a.host
def ssh(script):return subprocess.check_output(['ssh',*args,target,'sh -s'],input=script.encode(),stderr=subprocess.STDOUT).decode()
# No target writes before all local hashes and this read-only preflight pass.
print(ssh('set -eu\ntest -d /media/fat\ntest -w /media/fat\ntest -e /dev/MiSTer_cmd\ncommand -v sha256sum\nid\n').strip())
remote='/media/fat/.coco3plus/install-'+stamp;backup=remote+'/backup';stage=remote+'/stage'
ssh('set -eu\nmkdir -p '+q(stage)+' '+q(backup)+'\n')
# Raw argv paths are intentional: OpenSSH SFTP handles spaces without shell quoting.
subprocess.run(['scp',*args,'-r',str(fat),target+':'+stage+'/'],check=True)
lines=['set -eu']
for n,v in manifest['files'].items():lines.append('test "$(sha256sum '+q(stage+'/fat/'+n)+' | cut -d " " -f 1)" = '+q(v['sha256']))
lines.append("printf 'load_core /media/fat/menu.rbf\\n' > /dev/MiSTer_cmd")
lines.append('sleep 2')
for n,v in manifest['files'].items():
src=stage+'/fat/'+n;dest='/media/fat/'+n;old=backup+'/'+n
lines.append('mkdir -p '+q(str(PurePosixPath(dest).parent))+' '+q(str(PurePosixPath(old).parent)))
if v['policy']=='create-if-missing':lines.append('if [ ! -e '+q(dest)+' ]; then cp '+q(src)+' '+q(dest)+'; fi')
else:
lines.append('if [ -e '+q(dest)+' ]; then cp '+q(dest)+' '+q(old)+'; fi')
lines.append('cp '+q(src)+' '+q(dest))
lines.append('test "$(sha256sum '+q(dest)+' | cut -d " " -f 1)" = '+q(v['sha256']))
lines.append('sync')
if a.load:lines.append("printf 'load_core /media/fat/_Computer/Coco 3 Plus.mgl\\n' > /dev/MiSTer_cmd")
result=ssh('\n'.join(lines)+'\n')
receipt=dict(host=a.host,user=a.user,backup=backup,manifest=manifest,loaded=a.load,remote_output=result)
(release/'install-receipt.json').write_text(json.dumps(receipt,indent=2)+'\n')
print('Installed Coco 3 Plus; backup: '+backup+'; RBF '+manifest['rbf_sha256'])
print('Receipt: '+str(release/'install-receipt.json'))
if __name__=='__main__':main()