The DK'tronics Joystick interface plugs into the Expansion port and maps itself to two locations in Page 3.
| Page 3 Address | Joystick |
|---|---|
| $0310 | Port 1 (Left) |
| $0320 | Port 2 (Right) |
This unfortunately prohibits the interface to be used with the Microdisc Disk Interface since this maps to the same address space.
Note all drivers use a common label list that is found here generic_joystick_drivers
The following code provides a standard output for detection of joystick movements in your own code.
GenericReadDKTronics
LDX dkt_LeftJoy
JSR ReformatJoystickBits
STA joy_Left
LDX dkt_RightJoy
JSR ReformatJoystickBits
STA joy_Right
RTS
temp01 .byt 0
ReformatJoystickBits
;Reformat Fire
TXA
AND #4
ASL
ASL
ASL
STA temp01
;Reformat Left/Right
TXA
AND #24
LSR
LSR
LSR
ORA temp01
STA temp01
;Reformat Up
TXA
AND #1
ASL
ASL
ASL
ASL
ORA temp01
STA temp01
;Reformat Down
TXA
AND #2
ASL
ASL
ORA temp01
RTS
This provides the following bits to joystick movements.
| Bit | Value | Joystick Movement |
|---|---|---|
| 0 | 1 | Left |
| 1 | 2 | Right |
| 2 | 4 | |
| 3 | 8 | Down |
| 4 | 16 | Up |
| 5 | 32 | Fire |
1) It is unknown if the DK'tronics interface Joystick ports supported autofire.