Expand description
Optional non-standard input-device overlays for the $4016/$4017
controller ports: the Arkanoid “Vaus” paddle and the NES Zapper light gun.
These are opt-in overlays. The bus holds an Option<InputDevice> per
port; when a port has no overlay device (the default) the standard
controller / Four Score serial path runs completely unchanged, so the
default + Four Score reads stay byte-identical and the determinism
contract is preserved. A device is only consulted when explicitly attached
via crate::Nes::set_paddle / crate::Nes::set_zapper.
§Vaus paddle (Arkanoid controller)
Per the NESdev “Arkanoid controller” page (NES 7-pin version), the device
reports on the player-2 port ($4017):
7 bit 0
---- ----
xxxD Bxxx
| |
| +---- Fire button (1: pressed) -> bit 3
+------ Serial control knob data -> bit 4
(8/9-bit, inverted, MSb first)A write of $4016 bit 0 = 1 -> 0 (the standard controller strobe) starts a
“conversion”: the 8-bit potentiometer value is latched MSb-first into the
shift register. Each $4017 read shifts out the next bit (on bit 4),
inverted on the wire. After the register empties, reads repeat the
serial-in bit (the 9th / LSb). The fire button (bit 3) is returned directly
and is unaffected by the strobe.
The in-tree vaus-test ROM (Damian Yerrick) documents the NES wiring as
$4017 D3: Button, $4017 D4: Position (8 bits, MSB first) — matching the
wiki layout above.
§Zapper light gun
Per the NESdev “Zapper” page (NES variant), the device reports on its port:
7 bit 0
---- ----
xxxT Wxxx
| |
| +---- Light sensed (0: detected; 1: NOT detected) -> bit 3
+------ Trigger (1: pulled/half-pulled; 0: released) -> bit 4Note the inverted light polarity: bit 3 is 0 while light is detected and 1 otherwise. The light sensor stays active for roughly 19-26 scanlines after seeing a bright pixel (the photodiode capacitor drains exponentially); we use a simpler frame-granular model: a luminance threshold sampled at the aim point once per completed frame (sufficient because games re-sample every frame). The Zapper has no shift register — its byte is read in parallel and is independent of the strobe.
Structs§
- Bandai
Hyper Shot State - The Bandai Hyper Shot (Exciting Boxing punching bag) overlay state (v1.3.0 Workstream F1).
- Family
Keyboard State - The Famicom Family BASIC keyboard overlay state.
- Konami
Hyper Shot State - The Konami Hyper Shot overlay state (v1.3.0 Workstream F1).
- Power
PadState - The NES Power Pad (a.k.a. Family Fun Fitness / Family Trainer mat) overlay.
- Snes
Mouse State - The (Hyperkin / Nintendo) mouse overlay state — the SNES-style serial mouse
as wired to an NES
$4016/$4017port (D0 serial-out). - Vaus
State - The Arkanoid “Vaus” paddle overlay state.
- Zapper
State - The NES Zapper light-gun overlay state.
Enums§
- Input
Device - An optional non-standard device overlaid on a controller port. When set,
the bus’s
$4016/$4017read path returns this device’s byte instead of the standard controller / Four Score serial byte.
Constants§
- FAMILY_
KEYBOARD_ KEYS - Number of physical keys on the Famicom Family BASIC keyboard matrix
(
9 rows x 8 columns / 2halves; 72 keys, with a handful of unused matrix positions reported as1/ not-pressed).