# How the Mega Duck relates to the Game Boy family Read 2026-11-26: gameboy-python `ff3c643` (`machines.py`, `board.py` `_io_read`/`_io_write`, `cartridge/__init__.py`, docs/provenance.md), sm83-python `40c387f`, gb-apu-python `d886019`. ## What is the same, what differs | | Same as DMG (evidence) | Different (evidence) | | --- | --- | --- | | CPU | SM83 at 4.194304 MHz (MAME, MDI "mostly identical") | silicon unidentified (U1) | | PPU behaviour | DMG PPU (MAME's device; MDI names no behavioural change) | register addresses `$FF10-$FF1B`, LCDC bit order (registers.md) | | APU behaviour | DMG APU (MAME's device; MDI's porting notes) | addresses; NR12/22/42/43 nybble swap; NR32 volume code (registers.md) | | Timer, joypad, serial, IF/IE, HRAM, wave RAM | same addresses (HWINC; MDI for serial) | - | | Memory map | VRAM, WRAM, OAM, HRAM (HWINC) | entry `$0000`; no boot ROM, no `$FF50` | | Cartridge | ROM in `$0000-$7FFF`, RAM window `$A000` | connector; no header; mappers MD0/MD1/MD2 (cartridges.md) | | Power-on | - | no boot ROM: power-on state, not a skip-boot state | Every difference is wiring (address decode, data lines, the cartridge's latch). Nothing known is a different behaviour of a DMG part. This is the HYPOTHESIS the whole plan rests on (U1, U4); the census and MAME are consistent with it (games written for a DMG-like machine run on MAME's unchanged DMG devices). ## Option A (recommended): a machine row of gameboy-python gameboy-python's `machines.py` holds "one row per model and revision", built "so that adding it later is data, not a refactor". The Duck would be a row `megaduck` (`model="megaduck"`, `boot_rom=None`, the DMG-B quirk flags, `certified=False`) plus three hooks in gameboy-python, written there first because hardware behaviour is defined in the specification: 1. **An I/O decode table** on the machine row: Duck address -> (DMG register, data permutation). `_io_read`/`_io_write` look the low byte up once before their existing dispatch, and apply the bit permutation (LCDC, NR12/22/42/43 nybbles, NR32 code) on the way in and its inverse on the way out. The DMG rows carry the identity table, so their traces do not change (gameboy-rust's lockstep gate proves it when carried down). 2. **Headerless cartridges**: `MD1`, `MD2` (and later `MD0` with its RAM) classes beside `MBC1..MMM01` in `cartridge/mbc.py`, chosen by the Duck row from a SHA-1 table or an explicit argument (a Duck image has no header for `load_cartridge` to read). 3. **Power-on without a boot ROM**: PC `$0000`, registers and VRAM per a board option (memory-map.md); `boot_mapped` false from the start. The laptops (Super Quique, Super Junior) are a second row later, with the system ROM (MD0) and a serial-port peripheral socket (keyboard, RTC, speech), like the SGB row's `sgb.py` beside the board. Why: one specification of the DMG's PPU, APU, timer and DMA serves both machines; a fix found on either lands once, upstream, and flows to gameboy-rust and -fast by the usual merges. The Duck's Rust tiers come free with gameboy-rust's carry-down (no new Rust repo), and play-gb could offer it. Cost: one table lookup per I/O access in the Python board (a dict or a 128-entry list: measured cost to be shown by the build on gameboy-python's own benchmark, kept only if it does not slow the DMG rows, per the speed rule) and a gate run in gameboy-rust when carried down. Then **this repository** stays as what it is now: the Duck's research, census, references and brief, with no board code (or is folded into gameboy-python's docs and archived: decision 2). ## Option B: its own board, `megaduck_python`, pinning gameboy-python A board importing `gameboy_python`'s `PPU`, timer, DMA and `sm83_python`/`gb_apu_python`, with its own bus, I/O decode and cartridges. gameboy-python is a board, not a core: its PPU and timer are not a published interface, so B either needs gameboy-python to declare one (a library boundary a board has never had in the family) or copies code (forbidden: "never copy code between repos"). It would also need its own Rust transcription and fast fork to reach a site, duplicating gameboy-rust's board loop. The chip rule points the same way: the DMG PPU is a single-machine chip inside its board until a second board needs it, and a second board here would make it a core extraction (`dmg-ppu-python`), which is far more work than a row for one machine with 25 games. ## Author respect carried over gameboy-python's furrtek-lineage audit (provenance.md, 2026-11-26) stays in force: the Duck row inherits gameboy-python's facts, each already re-sourced or marked (its facts 5 and 9 need new evidence). No Duck source found here is in the lineage (provenance.md). Facts the row adds come from MDI, HWINC, SR and the games, none of which cite furrtek's work, msinger's, GateBoy, emu-russia/dmgcpu or SonoSooS (searched 2026-11-26).