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:
1 parent
8b8cf72d1f
commit
cb40fed3b9
126 files changed
+12795
-528
No files matched your search
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Create a checked, copyable MiSTer FAT-volume overlay from a standalone build."""
|
||||
import argparse,datetime,hashlib,json,shutil,subprocess,zipfile
|
||||
from pathlib import Path
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
SSC={'pic-7040-510.bin':(4096,'0013cd78482cc5f2360fdf584e9ba51d34861e8ccd9d88247f1a54039c16c365'),
|
||||
'sp0256-al2.bin':(2048,'98c280fd082169c54081e503dfe7d7d9a6fd46d4ffcc973e199ea0e1d9bc1ac9')}
|
||||
BOOT={'boot0.rom':(32768,'ad358430568250eb8330a37f85361d9ce67e5ae6d5a28c17b31802cd3953a5d2'),
|
||||
'boot1.rom':(8192,'1c40c5a74e72edaeecc2511fee1aab347eae2c3d5fc6778cb622e3df14d63157')}
|
||||
def sha(p):return hashlib.sha256(p.read_bytes()).hexdigest()
|
||||
def checked(p,size,digest):
|
||||
if not p.is_file() or p.stat().st_size!=size or sha(p)!=digest:raise RuntimeError('Missing or incorrect input: '+str(p))
|
||||
return p
|
||||
def default_config(ssc):
|
||||
# Main serializes cur_status[16] in byte order, low bits first.
|
||||
# Audio / SDC / ROM / Floppy, startup Slot4, 512K; migrated-layout marker.
|
||||
layout=6+(3<<3)+(1<<6)+(2<<9)
|
||||
status=(1<<63)|(layout<<43)|(3<<12)|((1<<42) if ssc else 0)
|
||||
return status.to_bytes(16,'little')
|
||||
def make_release(output,build,roms,ssc,without_ssc=False,public=False):
|
||||
record=json.loads((build/'build.json').read_text())
|
||||
if not record.get('passed'):raise RuntimeError('Successful standalone FPGA build required')
|
||||
rbf=checked(build/'project/output_files/CoCo3.rbf',record['rbf_bytes'],record['rbf_sha256'])
|
||||
for n,h in record['inputs'].items():
|
||||
if sha(ROOT/n)!=h:raise RuntimeError('Source differs from built input: '+n)
|
||||
inputs={} if public else {f'games/coco3plus/{n}':checked(roms/n,*identity) for n,identity in BOOT.items()}
|
||||
if not without_ssc and not public:inputs.update({f'games/coco3plus/{n}':checked(ssc/n,*v) for n,v in SSC.items()})
|
||||
if subprocess.check_output(['git','status','--porcelain','--untracked-files=no'],cwd=ROOT).strip():raise RuntimeError('Commit reviewed changes before creating a distributable source package')
|
||||
source_revision=subprocess.check_output(['git','rev-parse','HEAD'],cwd=ROOT).decode().strip()
|
||||
if output.exists():raise RuntimeError('Preserve previous release: '+str(output))
|
||||
fat=output/'fat';fat.mkdir(parents=True)
|
||||
core=f'_Computer/.coco3plus/{record["rbf_sha256"][:12]}/coco3plus.rbf';inputs[core]=rbf
|
||||
for name in ('NOTICE.md','LICENSING.md','COPYRIGHT.md'):
|
||||
inputs['games/coco3plus/licenses/'+name]=ROOT/name
|
||||
for folder in (ROOT/'LICENSES',):
|
||||
for file in folder.glob('*'):
|
||||
if file.is_file():inputs['games/coco3plus/licenses/'+file.name]=file
|
||||
inputs['games/coco3plus/licenses/SSC-BSD-3-Clause.txt']=ROOT/'rtl/ssc/LICENSE'
|
||||
for n,p in inputs.items():
|
||||
target=fat/n;target.parent.mkdir(parents=True,exist_ok=True);shutil.copyfile(p,target)
|
||||
launcher=fat/'_Computer/Coco 3 Plus.mgl';launcher.parent.mkdir(exist_ok=True)
|
||||
launcher.write_text(f'<mistergamedescription>\n <rbf>{core[:-4]}</rbf>\n <setname>coco3plus</setname>\n</mistergamedescription>\n',newline='\n')
|
||||
config=fat/'config';config.mkdir()
|
||||
(config/'coco3plus_v51.CFG').write_bytes(default_config(not without_ssc))
|
||||
if not without_ssc:
|
||||
for index,n in ((4,'pic-7040-510.bin'),(5,'sp0256-al2.bin')):
|
||||
value=f'/media/fat/games/coco3plus/{n}'.encode()
|
||||
(config/f'coco3plus.f{index}').write_bytes(value.ljust(1024,b'\0'))
|
||||
manifest=dict(format=1,created_utc=datetime.datetime.now(datetime.timezone.utc).isoformat(),public_package=public,
|
||||
rbf_sha256=record['rbf_sha256'],ssc_included=not without_ssc and not public,roms_required_separately=public,
|
||||
files={p.relative_to(fat).as_posix():dict(bytes=p.stat().st_size,sha256=sha(p),
|
||||
policy='create-if-missing' if p.name=='coco3plus_v51.CFG' else 'backup-and-replace') for p in sorted(fat.rglob('*')) if p.is_file()})
|
||||
if public:manifest['required_roms']={n:dict(bytes=v[0],sha256=v[1]) for n,v in {**BOOT,**({} if without_ssc else SSC)}.items()}
|
||||
(output/'manifest.json').write_text(json.dumps(manifest,indent=2)+'\n')
|
||||
(output/'SHA256SUMS.txt').write_text(''.join(f'{v["sha256"]} fat/{n}\n' for n,v in manifest['files'].items()))
|
||||
(output/'README.txt').write_text('Coco 3 Plus FAT-volume overlay. This is not a bootable disk image.\nCopy fat/ CONTENTS to the MiSTer FAT-volume root with MiSTer shut down.\nPreserve existing config/coco3plus_v51.CFG. Back up files before replacing.\nOriginal CoCo3 and other cores are not replaced. Start Computer/Coco 3 Plus.\nSSC ROMs, when included, are separately supplied local inputs; do not redistribute without permission.\n')
|
||||
if public:
|
||||
with (output/'README.txt').open('a') as file:file.write('PUBLIC CORE/SOURCE PACKAGE: no CoCo boot or SSC ROMs included.\nBefore launching, supply boot0.rom and boot1.rom in games/coco3plus and the SSC ROMs if using SSC.\nSee roms/README.md and docs/INSTALL.md in corresponding-source.zip for exact identities and source-build installation.\nThis incomplete-ROM public package is not accepted directly by the SSH installer. Build a complete local package using your own verified ROM inputs.\n')
|
||||
# Git's reviewed committed tree is the only source-export allowlist. Untracked
|
||||
# notes, .env files and ignored ROM/cache inputs can never enter this archive.
|
||||
with (output/'corresponding-source.zip').open('xb') as file:
|
||||
subprocess.run(['git','archive','--format=zip','--prefix=coco3plus/',source_revision],cwd=ROOT,stdout=file,check=True)
|
||||
manifest['source_revision']=source_revision
|
||||
manifest['corresponding_source_sha256']=sha(output/'corresponding-source.zip')
|
||||
(output/'manifest.json').write_text(json.dumps(manifest,indent=2)+'\n')
|
||||
archive_path=output.with_name(output.name+'.zip')
|
||||
if archive_path.exists():raise RuntimeError('Preserve previous release archive: '+str(archive_path))
|
||||
with zipfile.ZipFile(archive_path,'x',zipfile.ZIP_DEFLATED) as archive:
|
||||
for file in sorted(output.rglob('*')):
|
||||
if file.is_file():archive.write(file,file.relative_to(output).as_posix())
|
||||
archive_path.with_suffix('.zip.sha256').write_text(sha(archive_path)+' '+archive_path.name+'\n')
|
||||
return manifest
|
||||
def main():
|
||||
p=argparse.ArgumentParser(description=__doc__)
|
||||
p.add_argument('--output',type=Path,default=ROOT/'dist/coco3plus')
|
||||
p.add_argument('--build',type=Path,default=ROOT/'build/fpga')
|
||||
p.add_argument('--roms',type=Path,default=ROOT/'build/roms')
|
||||
p.add_argument('--ssc',type=Path,default=ROOT/'roms/ssc')
|
||||
p.add_argument('--without-ssc',action='store_true')
|
||||
p.add_argument('--public',action='store_true',help='Omit ALL separately obtained/assembled ROMs; core/source distribution only')
|
||||
a=p.parse_args();m=make_release(a.output.resolve(),a.build.resolve(),a.roms.resolve(),a.ssc.resolve(),a.without_ssc,a.public)
|
||||
print('Release '+str(a.output.resolve())+'; RBF SHA-256 '+m['rbf_sha256'])
|
||||
if __name__=='__main__':main()
|
||||
Reference in new issue
Block a user