Kempston Joystick 2, Joystick I/O: Difference between revisions

From SpecNext Wiki
Jump to: navigation, search
Created page with "{{Port |Number=$xx37 |ShortDesc=Reads movement of joystick using Kempston interface (second joystick variant). |Readable=Yes |Writable=No |Subsystem=Input }}"
 
Ped7g (talk | contribs)
mNo edit summary
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Port
{{Port
|Number=$xx37
|Number=$xx37
|ShortDesc=Reads movement of joystick using Kempston interface (second joystick variant).
|NumberDec=55
|ShortDesc=Kempston interface second joystick variant and controls joystick I/O.
|Readable=Yes
|Readable=Yes
|Writable=No
|Writable=Yes
|Subsystem=Input
|Subsystem=Input
}}
}}
For READ functionality the details are identical with {{PortNo|$xx1F}}
Since core3.1.5 there is option to do I/O operations through joystick ports.
The I/O mode should be set by writing this port first followed by enabling I/O mode on the joysticks with a write to {{NextRegNo|$05}}.
The WRITE functionality:
{| class="wikitable"
! Bit !! Function
|-
| 7-6 || select I/O mode: %00 = bit bang, %01 = clock, %10 = uart
|-
| 5 || Reserved must be 0
|-
| 4 || 0 to read "input" part of I/O from left joystick socket, 1 to read from right joystick socket
The program can still change the active joystick via bit 4 of port 0x37 at any time but for uart mode this should be done during a quiet time in communication.  Any output always appears on pin 7 of both joystick connectors.
|-
| 3-1 || Reserved must be 0
|-
| 0 || parameter bit controls state of pin 7 on both joystick connectors:
bit bang: bit 0 is copied to pin 7<br>
clock: 0 = place slow clock on pin 7 (Fsys/2048 = 13.672kHz), 1 = place fast clock on pin 7 (Fsys/8 = 3.5MHz) &dagger;<br>
uart: 0 = redirect esp uart to joystick connector, 1 = redirect pi uart to joystick connector (Tx appears on pin 7, Rx taken from pin 9)
|}
&dagger; A runt clock pulse may appear in the first cycle, minimum pulse width is 1/Fsys = 35.7ns

Latest revision as of 11:15, 4 May 2020

Number PortNumber::$xx37
Decimal NumberDec::55
Short desc. ShortDesc::Kempston interface second joystick variant and controls joystick I/O.
Bit Mask PortMask::
Readable Readable::Yes
Writable Writable::Yes
Subsystem Subsystem::Input

For READ functionality the details are identical with {{#ask: PortNumber::$xx1F }} ($xx1F{{#ask: PortNumber::$xx1F |mainlabel=- |headers=hide |intro= /  |?NumberDec#- }})

Since core3.1.5 there is option to do I/O operations through joystick ports.

The I/O mode should be set by writing this port first followed by enabling I/O mode on the joysticks with a write to {{#ask: TBRegisterNumber::$05 }} ($05).

The WRITE functionality:

Bit Function
7-6 select I/O mode: %00 = bit bang, %01 = clock, %10 = uart
5 Reserved must be 0
4 0 to read "input" part of I/O from left joystick socket, 1 to read from right joystick socket

The program can still change the active joystick via bit 4 of port 0x37 at any time but for uart mode this should be done during a quiet time in communication. Any output always appears on pin 7 of both joystick connectors.

3-1 Reserved must be 0
0 parameter bit controls state of pin 7 on both joystick connectors:

bit bang: bit 0 is copied to pin 7
clock: 0 = place slow clock on pin 7 (Fsys/2048 = 13.672kHz), 1 = place fast clock on pin 7 (Fsys/8 = 3.5MHz) †
uart: 0 = redirect esp uart to joystick connector, 1 = redirect pi uart to joystick connector (Tx appears on pin 7, Rx taken from pin 9)

† A runt clock pulse may appear in the first cycle, minimum pulse width is 1/Fsys = 35.7ns