The Generic Joystick Drivers provide a set of routines for reading each type of joystick interface but outputting the sensed movement in a common format.
The common format comprises of two memory locations called joy_Left and joy_Right (Zero Page or main memory). Each bit of each byte indicates the joystick movement made.
| Bit | Value | Joystick Movement |
|---|---|---|
| 0 | 1 | Left |
| 1 | 2 | Right |
| 2 | 4 | Secondary Fire Button(Telestrat Only) |
| 3 | 8 | Down |
| 4 | 16 | Up |
| 5 | 32 | Primary Fire Button(All Interfaces) |
The Code for the drivers also use common labels which should use the #DEFINE construct and be placed at the top of your source code. The labels are as follows. You may freely cut and paste the lines below.
#define ayc_Register $FF
#define ayc_Inactive $DD
#define ayc_Write $FD
#define ayc_Read $DF
;
#define via_portb $0300
#define via_porta_hs $0301
#define via_ddrb $0302
#define via_ddra $0303
#define via_t1cl $0304
#define via_t1ch $0305
#define via_t1ll $0306
#define via_t1lh $0307
#define via_t2cl $0308
#define via_t2ll $0308
#define via_t2ch $0309
#define via_sr $030A
#define via_acr $030B
#define via_pcr $030C
#define via_ifr $030D
#define via_ier $030E
#define via_porta $030F
;
#define dkt_LeftJoy $0310
#define dkt_RightJoy $0320
;
#define via2_portb $0320
#define via2_porta_hs $0321
#define via2_ddrb $0322
#define via2_ddra $0323
#define via2_t1cl $0324
#define via2_t1ch $0325
#define via2_t1ll $0326
#define via2_t1lh $0327
#define via2_t2cl $0328
#define via2_t2ll $0328
#define via2_t2ch $0329
#define via2_sr $032A
#define via2_acr $032B
#define via2_pcr $032C
#define via2_ifr $032D
#define via2_ier $032E
#define via2_porta $032F