Game Genie

From NESdev Wiki
Revision as of 23:41, 21 September 2014 by Zzo38 (talk | contribs)
Jump to navigationJump to search

The Game Genie is a enhancement cart for the NES designed by Camerica and distributed by Galoob and Camerica. It functions as a pass-thru, with a 72 pin cartridge connector connecting it to the NES, and a 72 pin cartridge slot for a game to be inserted into. When plugged in between a game and the NES and turned on, it provides a simple interface to enter up to three cheat codes, which then modify the behavior of the game.

Game Genie is assigned to iNES mapper #4096.

Technical

The Game Genie works by intercepting CPU reads and replacing the game cart's response with its own response. It can intercept any three addresses in CPU $8000:$FFFF and respond with a single replacement for each. To make the tool more compatible with bank-switching, each of the three codes has an option compare value which can be used to only replace the byte if the original byte matches the compare, hopefully limiting the cheat to functioning on the desired bank.

When first booted, the Game Genie presents its own 4KiB PRG ROM and a series of simple gates masquerading as a CHR ROM. The included PRG ROM runs code to show a simple code entry user interface. When the user presses Start, the cheat values are written to memory mapped registers, and then another register is written which switches the Game Genie into game mode, where the attached game cart's CHR and PRG is passed through, save whatever code replacements were defined. The Game Genie remains in game mode until power cycled, and will respond to no further writes.

Registers

Master Control ($8000)

7  bit  0
---- ----
.DDD CCCE
 ||| ||||
 ||| |||+- Master enable: write 1 then 0 to switch into game mode.
 ||| +++-- Compare enable for each of the three codes
 +++------ Disable each of the three codes

Bit 1 and 4 correspond to the code at $8001:$8004.

Address High ($8001, $8005, $8009)

7  bit  0
---- ----
.AAA AAAA
 ||| ||||
 +++-++++- Bits 8:14 of address for this cheat (Bit 15 fixed to 1)

Address Low ($8002, $8006, $800a)

7  bit  0
---- ----
AAAA AAAA
|||| ||||
++++-++++- Bits 0:7 of address for this cheat

Compare ($8003, $8007, $800b)

7  bit  0
---- ----
CCCC CCCC
|||| ||||
++++-++++- Compare value for this cheat (write 0 if unused?)

Replace ($8004, $8008, $800c)

7  bit  0
---- ----
RRRR RRRR
|||| ||||
++++-++++- Replacement value for this cheat

Unknown ($FFF0, $FFF1)

The Game Genie rom writes 0 to $FFF0, $FFF1, $FFF0 in that sequence.

Pattern Tables

When game mode is inactive, the Game Genie generates pattern tables through PPU $0000:$1fff by the following method:

When PPU A2 = 1:
  PPU A4 => PPU D4:D7
  PPU A5 => PPU D0:D3
When PPU A2 = 0:
  PPU A6 => PPU D4:D7
  PPU A7 => PPU D0:D3