|
DevelopmentSega Master System / Mark III / Game Gear |
Home - Forums - Games - Scans - Maps - Cheats - Credits |
The keyboard, like gamepads and cassette/printer interface, are handled through an 8255 PPI. This chip has three 24 I/O pins which are arranged into 3 8-bit I/O ports called A, B, and C. It also has a control register which defines if the ports are outputs or inputs, amongst other things.
Port A (input) ($DC):
D7 | Keyboard/gamepad input data |
D6 | Keyboard/gamepad input data |
D5 | Keyboard/gamepad input data |
D4 | Keyboard/gamepad input data |
D3 | Keyboard/gamepad input data |
D2 | Keyboard/gamepad input data |
D1 | Keyboard/gamepad input data |
D0 | Keyboard/gamepad input data |
Pins PA7-PA0 have pull-up resistors and are active low inputs.
Port B (input) ($DD):
D7 | From CASSETTE-IN miniplug jack |
D6 | BUSY input from printer port |
D5 | FAULT input from printer port |
D4 | /CONT input from B11 on cartridge connector |
D3 | Keyboard/gamepad input data |
D2 | Keyboard/gamepad input data |
D1 | Keyboard/gamepad input data |
D0 | Keyboard/gamepad input data |
Pins PB6-PB0 have pull-up resistors and are active-low inputs, PB7 is an active-high input.
With no external devices attached, bits 7,6,5 return 0,1,1 respectively.
Port C (output) ($DE):
D7 | To printer port pin 3 (/FEED output) |
D6 | To printer port pin 5 (/RESET output) |
D5 | To printer port pin 2 (DATA output) |
D4 | Unused (not connected to anything) |
D3 | To CASSETTE-OUT miniplug jack |
D2 | To 74LS145 to select 1 of 8 keyboard rows (bit 2) |
D1 | To 74LS145 to select 1 of 8 keyboard rows (bit 1) |
D0 | To 74LS145 to select 1 of 8 keyboard rows (bit 0) |
The descriptions of the PPI ports were taken from Marc Le Dourain’s SF-7000 page, which I believe were in turn taken from a SF-7000 manual. So I can't really elaborate much more on what each bit does, beyond what I’ve checked myself.
The SC-3000H has a 64-key keyboard, and two gamepad ports. One of the keys is called "RESET" and generates a NMI on the Z80 when pressed.
Bits 7-0 of port A and 3-0 of port B are used to return data from the keyboard and gamepads. This data is broken down into 8 groups, with seven for the keyboard rows and one for the two gamepads.
The keyboard rows are assigned to the following keys, where each bit returns one for a pressed key and zero if the key has not been pressed.
PPI | Port | A | Port | B | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Rows | D0 | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D0 | D1 | D2 | D3 |
0 | '1' | 'Q' | 'A' | 'Z' | ED | ',' | 'K' | 'I' | '8' | — | — | — |
1 | '2' | 'W' | 'S' | 'X' | SPC | '.' | 'L' | 'O' | '9' | — | — | — |
2 | '3' | 'E' | 'D' | 'C' | HC | '/' | ';' | 'P' | '0' | — | — | — |
3 | '4' | 'R' | 'F' | 'V' | ID | PI | ':' | '@' | '-' | — | — | — |
4 | '5' | 'T' | 'G' | 'B' | — | DA | ']' | '[' | '^' | — | — | — |
5 | '6' | 'Y' | 'H' | 'N' | — | LA | CR | — | YEN | — | — | FNC |
6 | '7' | 'U' | 'J' | 'M' | — | RA | UA | — | BRK | GRP | CTL | SHF |
7 | 1U | 1D | 1L | 1R | 1TL | 1TR | 2U | 2D | 2L | 2R | 2TL | 2TR |
ED = "ENG DIER'S"
SPC = (Spacebar)
HC = "HOME CLR"
ID = "INS DEL"
PI = (PI symbol)
DA = (Down arrow on keypad)
LA = (Left arrow on keypad)
RA = (Right arrow on keypad)
CR = "CR" (Enter)
UA = (Up arrow on keypad)
YEN = (Yen symbol)
BRK = "BREAK"
GRP = "GRAPH"
CTL = "CTRL"
FNC = "FUNC"
SHF = "SHIFT"
1U = Joystick #1 up
1D = Joystick #1 down
1L = Joystick #1 left
1R = Joystick #1 right
1TL = Joystick #1 left trigger
1TR = Joystick #1 right trigger
2U = Joystick #2 up
2D = Joystick #2 down
2L = Joystick #2 left
2R = Joystick #2 right
2TL = Joystick #2 left trigger
2TR = Joystick #2 right trigger
--- = Key is unused, always returns 1
The keys are arranged in an 8x12 matrix as shown above. Some combinations of key presses will cause other keys to appear to be pressed. There are two rules which define this behavior:
If two or more keys on any keyboard row are pressed, pressing any key on another row that occupies the same columns will cause all other keys in the same columns to appear to be pressed. For example, if keys 1, Q, A, Z are pressed, pressing 2 will also make keys W, S, and X appear to be pressed.
If two or more keys on any keyboard column are pressed, pressing any key on another column that occupies the same rows will cause all other keys in the same rows to appear to be pressed.
For example, if keys 1, 2, 3, 4 are pressed, pressing Q will also make keys W, E, and R appear to be pressed.
The two joystick ports are affected by this behavior too.
Most software writes $92 to the PPI control register and $07 to PPI port C, which configures ports A and B as inputs and all bits of port C as outputs, as well as selecting row 7 of the keyboard matrix to access the gamepads.
When port C is configured as an output, reading it returns the last value written to port C. The PPI control register cannot be read, and always returns $FF.
(copied from http://www.smspower.org/uploads/Development/sc3000h-20040729.txt )
----