Expand description
Game Genie cheat-code decoding.
The Game Genie is a pass-through cartridge adapter that substitutes bytes
the console reads from PRG-ROM ($8000-$FFFF). A 6-character code is an
unconditional (address, data) substitution; an 8-character code adds a
compare byte so the substitution only fires when the original byte
matches (this lets one code target a specific bank in a mirrored address).
Codes are a runtime overlay applied on the CPU read path in
crate::LockstepBus; they are not part of emulation state (not
serialized into save states), so with no codes active every read is
byte-identical to a build without this feature — the determinism contract
is preserved. The frontend persists the user’s code strings per-ROM.
The 6/8-character decode is the canonical NES Game Genie algorithm
(nesdev wiki “Game Genie”). This is a clean-room reimplementation
cross-checked against the reference codes YYKPOYZZ (The Legend of Zelda
— $9F41, data $77, compare $22) and SXIOPO (Super Mario Bros.
infinite lives — $91D9, data $AD, no compare), and against the
structure of TetaNES tetarustynes-core/src/genie.rs (MIT).
Structs§
- Genie
Code - A decoded Game Genie code: an address in
$8000-$FFFF, a substitute data byte, and an optional compare byte (present only for 8-character codes).
Enums§
- Genie
Error - Error returned when a Game Genie code string cannot be decoded.