The ALTAI interface connects to the Printer port which is also used when transferring data to the sound chip. Sound corruption is therefore in most cases unavoidable.
Note all drivers use a common label list that is found here generic_joystick_drivers
The Altai (Commonly mistaken for a PASE interface) was the most common joystick interface and supported in many games. However it affected sound badly as it acted directly on the Parralel port.
The Altai interface connected to the Centronics Parralel port.
B7 Select Left Joystick(Though neither sockets were distinguishable) B6 Select Right Joystick B5 Fire(Inverted) B4 Up(Inverted) B3 Down(Inverted) B2 - B1 Right(Inverted) B0 Left(Inverted)
DDRA must be set to 11000000 whilst reading Joystick. Please note that setting both top bits does not permit both joystick ports to be read at the same time. I have now tested this and it doesn't work :(
The First Driver is the code taken directly out of the leaflet that came with the ALTAI interface, disassembled, corrected and optimised.
LDA #%11000000 STA via_ddra lda #%10000000 STA via_porta LDA via_porta STA joy_Left LDA #%01000000 STA via_porta LDA via_porta STA joy_Right LDA #%11111111 STA via_ddra RTS
Each joystick movements will produce the following codes.
Left Joystick Movement | Value(Decimal) | Value(Binary) |
---|---|---|
191 | 10111111 | |
Up | 175 | 10101111 |
Up Right | 173 | 10101101 |
Right | 189 | 10111101 |
Right Down | 181 | 10110101 |
Down | 183 | 10110111 |
Down Left | 182 | 10110110 |
Left | 190 | 10111110 |
Up Left | 174 | 10101110 |
Fire | 159 | 10011111 |
Right Joystick Movement | Value(Decimal) | Value(Binary) |
---|---|---|
127 | 01111111 | |
Up | 111 | 01101111 |
Up Right | 109 | 01101101 |
Right | 125 | 01111101 |
Right Down | 117 | 01110101 |
Down | 119 | 01110111 |
Down Left | 118 | 01110110 |
Left | 126 | 01111110 |
Up Left | 110 | 01101110 |
Fire | 95 | 01011111 |
As the Bit pattern suggests when a joystick is moved, its corresponding bit is reset. Also Bit7 selects the Left joystick and Bit6 selects the right joystick.
The following code provides a standard output for detection of joystick movements in your own code. Whilst the corresponding bits remain the same they are inverted to conform to the Generic Format.
GenericReadAltai LDA #%11000000 STA via_ddra lda #%10000000 STA via_porta LDA via_porta AND #%00111111 EOR #%00111111 STA joy_Left LDA #%01000000 STA via_porta LDA via_porta AND #%00111111 EOR #%00111111 STA joy_Right 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 |