Namco Pac-Man/Memory Mapped I/O

From Obscure Wiki
< Namco Pac-Man
Revision as of 09:43, 14 May 2023 by Lockster (talk | contribs) (included some diagrams for INP0 and INP1 as well as the sprite attribute and position registers)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


Sprite Attributes (read/write, $4FF2-4FFD)

The twelve bytes from $4FF2 through 4FFD choose sprite pattern number, palette, and flip mode.

First byte/MSB ($4FF2, $4FF4, $4FF6, $4FF8, $4FFA, $4FFC)
7  bit  0
---- ----
SSSS SSXY
|||| ||||
|||| |||+- Y/Vertical flip
|||| ||+-- X/Horizontal flip
++++-++--- Pattern Number (00-3F)

Second byte/LSB ($4FF3, $4FF5, $4FF7, $4FF9, $4FFB, $4FFD)
7  bit  0
---- ----
...P PPPP
   | ||||
   +-++++- Palette entry (00-1F)

$4FF0, $4FF1, $4FFE, and $4FFF are never drawn because the video hardware is drawing 36 columns of tiles instead of 32.

IN0 (read-only, $5000-503F)

Reads return Player 1's joystick, "rack" test switch, coin acceptors, and "credit" button inputs

7  bit  0
---- ----
cCsT DRLU
|||| ||||
|||| |||+- Player 1 Joystick Up      (0 = up, 1 = down)
|||| ||+-- Player 1 Joystick Left    (0 = up, 1 = down)
|||| |+--- Player 1 Joystick Right   (0 = up, 1 = down)
|||| +---- Player 1 Joystick Down    (0 = up, 1 = down
|||+------ Rack Test switch          (0 = on, 1 = off)
||+------- Coin slot 1               (trigger by alternating bit to 0 then 1)
|+-------- Coin slot 2               (trigger by alternating bit to 0 then 1)
+--------- Credit button             (0 = up, 1 = down)

IN1 (read-only, $5040-507F)

Reads return Player 2's joystick, service mode switch, start buttons, and cabinet mode switch inputs

7  bit  0
---- ----
CsSM DRLU
|||| ||||
|||| |||+- Player 2 Joystick Up    (0 = up, 1 = down)
|||| ||+-- Player 2 Joystick Left  (0 = up, 1 = down)
|||| |+--- Player 2 Joystick Right (0 = up, 1 = down)
|||| +---- Player 2 Joystick Down  (0 = up, 1 = down)
|||+------ Service mode switch     (0 = on, 1 = off)       
||+------- Start button 1          (0 = up, 1 = down)
|+-------- Start button 2          (0 = up, 1 = down)
+--------- Cabinet mode            (0 = cocktail, 1 = upright)

DIPSW (read-only, $5080-50BF)

Reads return six DIP switches and two solder jumpers

Open bus (read-only, $50C0-50FF)

Reads aren't driven.

Interrupt enable and acknowledge (write-only, $5000, $5008, ... $5038)

If high, start of vblank asserts Z80 /IRQ input. If low, /IRQ input is reset and start of vblank cannot assert Z80 /IRQ input.

Mute (write-only, $5001, $5009, ... $5039)

If low, sound generator DAC and volume multipler is forced to zero. If high, sound generator DAC works normally

Ignored (write-only, $5002, $5004, $5005, $5006, $500A, ... $503E)

These four latched bits exist, but are connected to nothing.

Screen rotation (write-only, $5003, $500B, ... $503B)

If high, the tilemap, sprites, and tiles are rotated 180 degrees. For use in cocktail cabinets.

Coin counter (write-only, $5007, $500F, ... $503F)

If high, the coin counter pin is pulled low.

Sound RAM 1 (write-only, $5040-504F)

RAM is only 4 bits wide: top 4 bits are ignored.

The exact interpretation of these nybbles depends on the contents of the sound sequencer ROM.

The stock ROM uses

  • $5045: Voice 1 waveform selector (bottom 3 bits)
  • $504A: Voice 2 waveform selector
  • $504F: Voice 3 waveform selector

Sound RAM 2 (write-only, $5050-505F)

RAM is only 4 bits wide: top 4 bits are ignored.

The exact interpretation of these nybbles depends on the contents of the sound sequencer ROM.

The stock ROM uses:

  • $5050-5054: 20 bits of waveform pitch as a fraction of 96kHz
  • $5055: Voice 1 volume
  • $5056-5059: 16 bits of waveform pitch
  • $505A: Voice 2 volume
  • $505B-505E: 16 bits of waveform pitch.
  • $505F: Voice 3 volume

Sprite coordinates (write-only, $5062-506D)

Big number = top right corner.

First byte/MSB ($5062, $5064, $5066, $5068, $506A, $506C)
7  bit  0
---- ----
XXXX XXXX
|||| ||||
+++--++++- Sprite X-axis/Horizontal position (00-FF)

Second byte/LSB ($5063, $5065, $5067, $5069, $506B, $506D)
7  bit  0
---- ----
YYYY YYYY
|||| ||||
+++--++++- Sprite Y-axis/Vertical position (00-FF)

Bytes at $5060, 5061, 506E, 506F exist but aren't used

Ignored (write-only, $5070-50BF)

No hardware listens to writes in these addresses

Watchdog reset (write-only, $50C0-50FF)

A counter is incremented every vblank. Writes to this address clear this counter. When 15, the CPU and the registers at $5000-5007 are reset.