Metadata-Version: 2.5 Name: segacd-python Version: 0.0.0.dev0 Summary: Readable, pure-Python Sega CD / Mega-CD board for megadrive-python's expansion port Author: alewman License: MIT License Copyright (c) 2026 alewman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. License-File: LICENSE License-File: NOTICE Classifier: Development Status :: 1 - Planning Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: System :: Emulators Requires-Python: >=3.11 Requires-Dist: m68000-python @ git+https://github.com/alewman/m68000-python@4454d5457842fabe0fac92272589945c1eed7234 Requires-Dist: megadrive-python @ git+https://github.com/alewman/megadrive-python@63036136aa938e46a32e7a922fff54bd70a7ccd3 Requires-Dist: sn76489-python Requires-Dist: ym2612-python Provides-Extra: dev Requires-Dist: pytest>=8; extra == 'dev' Requires-Dist: ruff==0.16.8; extra == 'dev' Description-Content-Type: text/markdown # segacd-python A readable, pure-Python **Sega CD / Mega-CD** board that will plug into [megadrive-python](https://github.com/alewman/megadrive-python)'s expansion port. Its sub CPU is a second instance of [m68000-python](https://github.com/alewman/m68000-python). **Status (2026-11-19): restarted and rebuilt through milestone 4 (in part).** This repository restarts from the end of Phase 0 under the family's source rules ([docs/restart.md](docs/restart.md)). Built: the memories, the gate array, the sub CPU and its scheduler, the graphics unit, the CD-ROM decoder, the drive's protocol (high level), PCM and CD-DA. Your own BIOS plays Sonic CD (USA) into its first zone (after `scripts/format_backup_ram.py` has your BIOS format the backup RAM); mcd-verificator passes 16 of its 18 rows as BIOS and as a mode-1 cartridge. Numbers and what is open: [docs/status.md](docs/status.md); sources: [docs/provenance.md](docs/provenance.md); sessions: [docs/worklog.md](docs/worklog.md). Local repository; nothing is pushed. The Sega CD is its own board, not a variant of the Mega Drive: a second 68000 on its own 50 MHz crystal, 512 KB of PRG RAM, 256 KB of word RAM shared by a hand-over protocol, a rotation and scaling unit, a CD-ROM decoder, a drive behind a 10-nibble protocol, PCM and CD-DA. It pins megadrive-python by git revision and copies nothing from it; the sockets it needs are designed in megadrive-python's `docs/expansion-sockets.md`, and [docs/sockets.md](docs/sockets.md) says what the CD needs from each and where that design is wrong or incomplete. ## Read - [docs/restart.md](docs/restart.md): the rules, what was carried over, the scrub record. - [docs/manual-registers.md](docs/manual-registers.md): the machine's registers, from Sega's hardware manual. - [docs/sockets.md](docs/sockets.md): the contract with the Mega Drive board. - [docs/validation.md](docs/validation.md): every oracle, its tier, and what ran here. - [docs/mame-oracle.md](docs/mame-oracle.md): MAME as a detector. - [docs/handoff-brief.md](docs/handoff-brief.md): the milestones, and the open decisions. The machine overview, the timing document and the quirks list of Phase 0 are to be rewritten from permitted sources during the rebuild. ## BIOS and discs: bring your own Sega's BIOS is **never fetched, committed or vendored**, and neither is any commercial disc. `.gitignore` refuses `bios/`, `*.bin`, `*.cue`, `*.chd` and the rest. KRIKzz's mcd-verificator can stand in for the BIOS (it was written to), so the first milestones need no Sega code at all. ## What is fetched Nothing third-party is committed. `scripts/fetch_references.py` rebuilds `reference/` from `scripts/pinned_files.json` (33 files pinned by SHA-256: Sega's hardware, software, PCM and BIOS manuals, the Model 1 and Model 2 service manuals, the LC8951 and LC7883 datasheets, the CUE specification, forum threads) and `scripts/pinned_repos.json` (21 repositories at full commit SHAs, sparse: mcd-verificator and its real-hardware CDD logs, the MiSTer core's SignalTap captures of a real Mega-CD, Genesis Plus GX, BlastEm, ares, jgenesis, clownmdemu, MAME, PicoDrive, KRIKzz's FPGA core, test programs, a BIOS disassembly with the BIOS image itself left out). Several of these are fetched only so the runners can build and run them as closed boxes; which may be read is in [docs/restart.md](docs/restart.md). ```sh python scripts/fetch_references.py # everything missing (~140 MB) python scripts/fetch_references.py --verify # check what is present python scripts/build_referees.py # Genesis Plus GX and BlastEm libretro cores python scripts/libretro_run.py gpgx DISC.chd --bios-is-verificator --frames 600,7200 python scripts/mame_cd.py DISC.chd --rompath ROMS --frames 300 --trace ``` They need `git`, `make`, a C compiler and, for MAME runs, MAME 0.285. No sudo. ## Licence MIT (see `LICENSE`). The fetched references keep their own licences. The GPL, AGPL and non-commercial ones (Genesis Plus GX, PicoDrive, BlastEm, jgenesis, clownmdemu-core, the FPGA cores' HDL, mcd-verificator's source, MAME's GPL files) are built and run as closed boxes only, never read; permissive ones (MAME's BSD-3 Sega CD files, ares, the 0BSD and MIT test programs) may be read and keep their notices where anything is taken from them.