Difference between revisions of "Peripheral 1 Register"
(core 3.1.4 changes/refresh) |
(core 3.1.4 changes/refresh) |
||
Line 42: | Line 42: | ||
|- | |- | ||
| %111 || I/O Mode (since core3.1.4 (but needs fixing)) | | %111 || I/O Mode (since core3.1.4 (but needs fixing)) | ||
− | Affects both joysticks if any of them is set into I/O mode. | + | Affects both joysticks if any of them is set into I/O mode.<br> |
+ | <br> | ||
+ | Configure the I/O mode by writing to {{PortNo|$xx37}} first! | ||
|} | |} | ||
Revision as of 10:17, 15 April 2020
Number | $05 |
---|---|
Readable | Yes |
Writable | Yes |
Short Description | Sets joystick mode, video frequency and Scandoubler. |
Bit | Function |
---|---|
7-6 | Joystick 1 mode (LSB) |
5-4 | Joystick 2 mode (LSB) |
3 | Joystick 1 mode (MSB) |
2 | 50/60 Hz mode (0 = 50Hz, 1 = 60Hz) (0 after a PoR or Hard-reset) |
1 | Joystick 2 mode (MSB) |
0 | Enable Scandoubler (1 = enabled) (1 after a PoR or Hard-reset) |
Joystick modes are as follows:
Code | Effect |
---|---|
%000 | Sinclair Joystick 2 (maps to keys 1,2,3,4,5) |
%001 | Kempston Joystick 1 (uses port Kempston Joystick ($xx1F / 31)) |
%010 | Cursor Joystick (maps to keys 5,6,7,8,0) |
%011 | Sinclair Joystick 1 (maps to keys 6,7,8,9,0) |
%100 | Kempston Joystick 2 (uses port Kempston Joystick 2, Joystick I/O ($xx37 / 55)) |
%101 | MD 1 (3 or 6 button joystick port Kempston Joystick ($xx1F / 31)) |
%110 | MD 2 (3 or 6 button joystick port Kempston Joystick 2, Joystick I/O ($xx37 / 55)) |
%111 | I/O Mode (since core3.1.4 (but needs fixing))
Affects both joysticks if any of them is set into I/O mode. |
since core3.1.4: both joysticks are placed in I/O Mode if either is set to I/O Mode. The underlying joystick type is not changed and reads of this register will continue to return the last joystick type. Whether the joystick is in I/O mode or not is invisible but this state can be cleared either through reset or by re-writing the register with joystick type not equal to 111. Recovery time for a normal joystick read after leaving I/O Mode is at most 64 scan lines.
(since core 3.0) both joysticks set to the same type is now confirmed as valid configuration. The result is combined readings from both joysticks to single output.
"MD" above refers to controllers compatible with SEGA Mega Drive system. The 6 (and 3) button variant is mapped onto Kempston port this way (mirroring XYZ buttons on the ABC buttons, so only 4 distinct buttons are supported) (new mapping since core3.1.4):
Bit | Joystick action |
---|---|
7 | "start" button (pin 9) |
6 | A button (pin 6) |
5 | C button (pin 9) |
4 | B button (pin 6) |
3 | Up (pin 1) |
2 | Down (pin 2) |
1 | Left (pin 3) |
0 | Right (pin 4) |
The pin 6 and 9 reading depends on pin 7 being GND/+5V and it is driven by the FPGA internally (scanning both and building state), the Z80 SW reads final 8bit state from ports 0x1F and/or 0x37 (not driving the pin 7).
(core 3.1.1) the sinclair joystick modes are swapped, "sinclair 2" are keys 1,2,3,4,5 and "sinclair 1" are keys 6,7,8,9,0.