Diagnostic buttons, the 8x8 switch matrix, and synthetic flipper-button positions
pinmame.input.switch
- -7 … -35 slots
- 1 … 6464 slots
- 81 … 888 slots
- libpinmamechannel=switch
- controller_plugingroup_id=1 · contract_revision=a6f6d7266d30
Technical details for Diagnostic buttons, the 8x8 switch matrix, and synthetic flipper-button positionsSource-derived address behavior and exceptions
Matrix conversion
src/wpc/s7.c MACHINE_DRIVER_START(s7) imports PinMAME and installs no switch or lamp converter of its own, so System 7 inherits PinMAME's sequential core_swSeq2m/core_m2swSeq (src/wpc/core.c). Public switches are sequential matrix positions addressed column-major, not column-times-ten notation:
| Value | Calculation |
|---|---|
| Column | ((n-1)/8)+1 |
| Row | ((n-1)%8)+1 |
Column 1 is public 1-8 and column 8 is public 57-64. The ROM strobes one column at a time through PIA 4 port B (pia4b_w) and reads the eight rows back through port A (pia4a_r, which returns core_getSwCol unchanged).
Column 1 and the diagnostic column
Column 1 (public 1-8) is an ordinary matrix column that carries the cabinet switches. When PinMAME's own keyboard handling is enabled, SWITCH_UPDATE(s7) overwrites it every frame from the S7_COMPORTS port (src/wpc/s7.h): tilt 1, ball tilt 2, start 3, coin 1-3 4-6, slam tilt 7, high-score reset 8. With keyboard handling off, as under LibPinMAME and VPinMAME, the consumer writes these addresses directly.
The five negative addresses are internal matrix column 0 through the same n+7 formula and come from the upper byte of the same port:
| Address | Constant | Hardware |
|---|---|---|
-7 |
S7_SWADVANCE |
Advance button, sampled into PIA 3 CA1 on every IRQ (s7_irqline) |
-6 |
S7_SWUPDN |
Auto-Up/Manual-Down toggle, sampled into PIA 3 CB1; public level 1 is Auto-Up |
-5 |
S7_SWCPUDIAG |
CPU-board diagnostic button, wired to the NMI line |
-4 |
S7_SWSOUNDDIAG |
Sound-board diagnostic button |
-3 |
S7_ENTER |
Master Command Enter; s7_dips_r returns the DIP banks only while it is held |
They are service controls in the coin door or on the boards, never playfield positions.
Flipper buttons
System 7 flippers are not CPU-driven: the cabinet buttons switch the coils directly and the ROM only enables them through the game-on line. PinMAME still keeps its generic flipper column at internal column 11, which the sequential converter publishes at 81-88; CORE_SWLRFLIPBUTBIT is public 82 and CORE_SWLLFLIPBUTBIT is public 84 (src/wpc/core.h). s7_vblank calls core_updateSw(s7locals.ssEn), which copies those two bits into the matrix addresses a game names with FLIP_SWNO(left,right) (a zero argument means no copy) and fabricates the synthetic flipper outputs 45-48 from them while the game-on enable is set (see the solenoid group). No System 7 driver declares FLIP_SOL or an FLIP_EOS bit, so the end-of-stroke positions 81, 83, 85 and 87 and the upper-flipper buttons 86 and 88 carry nothing; a game with upper flippers wires them to the same cabinet buttons.
Polarity
core_setSw writes each switch into the matrix through the per-game inverted-switch mask (coreGlobals.invSw, copied from core_gameData->wpc.invSw), and pia4a_r hands the ROM that matrix byte unchanged through core_getSwCol. INITGAMEFULL in src/wpc/s7games.c aggregate-initializes the mask as {{0}}, so for every game declared through it PinMAME normalizes nothing and the public level is the raw closed-equals-1 level of the switch. Some drivers declare their own core_tGameData instead: Hyperball, Spellbinder, Defender and Rat Race in src/wpc/s7games.c (Hyperball, Spellbinder and Rat Race with a nonzero mask), and Black Knight and Time Fantasy in their simulator files under src/wpc/sims/s7/full/. Read each game's own game data for its mask before relying on this.