
Unlike the ALTAI Joystick Interface, the IJK interface avoided corruption of the sound by using the strobe and Ack lines provided on the Printer Port.
The code may be modified to set both top bits low and therefore permit the combined detection of either joystick movements.
Note all drivers use a common label list that is found here generic_joystick_drivers
The IJK joystick connects to the parallel port and uses the strobe line in a clever way so that it could be prevented from corrupting sound. It was supported in most IJK games afaik. Unfortunately though it is quite rare.
When the Strobe bit was set to Output(In DDRB) and low(PB4) then it enabled the interface.
B7 Select Right Joystick(Sockets were clearly identified) B6 Select Left Joystick(Unlike Altai setting 11 will disable joys) B5 Low whenever IJK joystick attached so could detect IJK Interface B4 Up(Inverted) B3 Down(Inverted) B2 Fire(Inverted) B1 Left(Inverted) B0 Right(Inverted)
It used very low power radio transistors to avoid overloading the bits on the unpowered Printer Port.
The following code provides a standard output for detection of joystick movements in your own code. The bits corresponding to joystick movement use a look up table to make them comply with the Generic Format.
GenericIJKBits
.byt 0,2,1,3,32,34,33,0,8,10,9,0,40,42,41,0
.byt 16,18,17,0,48,50,49,0,0,0,0,0,0,0,0,0
GenericReadIJK
;Ensure Printer Strobe is set to Output
LDA #%10110111
STA via_ddrb
;Set Strobe Low
LDA #%00000000
STA via_portb
;Set Top two bits of PortA to Output and rest as Input
LDA #%11000000
STA via_ddra
;Select Left Joystick
LDA #%01111111
STA via_porta
;Read back Left Joystick state
LDA via_porta
;Mask out unused bits
AND #%00011111
;Invert Bits
EOR #%00011111
;Index table to conform to Generic Format
TAX
LDA GenericIJKBits,X
STA joy_Left
;Select Right Joystick
LDA #%10111111
STA via_porta
;Read back Right Joystick state and rejig bits
LDA via_porta
AND #%00011111
EOR #%00011111
TAX
LDA GenericIJKBits,X
STA joy_Right
;Restore VIA PortA state
LDA #%11111111
STA via_ddra
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 |
The following routine may be used to detect the presence of the IJK joystick interface.
Please note it has not been tested against having other Joystick interfaces plugged into the printer port instead.
LDA #%11000000
STA via_ddra
STA via_porta
LDA via_porta
AND #%00100000
BNE ijkPresent
The above code has not been tested.
Thanks to Fabrice Frances for the autodetection technique.
Diagrams by “Silicebit”.