This page (revision-14) was last changed on 03-Feb-2023 15:21 by Florian Dingler 

This page was created on 14-Mar-2010 18:11 by Carsten Strotmann

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
14 03-Feb-2023 15:21 4 KB Florian Dingler to previous
13 07-Jul-2018 21:28 4 KB Florian Dingler to previous | to last
12 30-Jun-2018 14:32 4 KB Florian Dingler to previous | to last
11 30-Jun-2018 14:27 3 KB Florian Dingler to previous | to last
10 08-Oct-2017 19:34 3 KB Florian Dingler to previous | to last
9 10-Mar-2017 22:36 3 KB Florian Dingler to previous | to last
8 10-Mar-2017 21:10 3 KB Florian Dingler to previous | to last
7 10-Mar-2017 21:07 3 KB Florian Dingler to previous | to last
6 09-Jan-2012 08:33 2 KB Gromit to previous | to last
5 05-Jan-2011 14:01 2 KB Gromit to previous | to last
4 05-Jan-2011 13:50 2 KB Carsten Strotmann to previous | to last
3 22-Mar-2010 22:17 2 KB Florian Dingler to previous | to last
2 15-Mar-2010 09:08 2 KB Gromit to previous | to last
1 14-Mar-2010 18:11 2 KB Carsten Strotmann to last

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 29 added one line
(proceed a delay 30 cycles at least between write to PORTA register and following reading of PORTA or TRIG0. )
At line 38 added 3 lines
LDX #$06 ;Here is a delay 30 cycles before reading of PORTA
WAI DEX
BNE WAI
At line 91 changed one line
to be added
Initializing:
At line 97 added 48 lines
{{{
PROC INITMULJOY()
BYTE PACTL=$D302,PORTA=$D300
;
PACTL==&$FB ; set bit 3 of pactl to 0. 1=use Port A for data input/output, 0=define data direction
PORTA=$F0 ; set upper nibble of porta to write (1111) and lower nibble to read (0000)
PACTL==%$04 ; set bit 3 of pactl to 1 again. 1=use Port A for data input/output, 0=define data direction
RETURN
}}}
Query the Joystick:
{{{
PROC QUERYMULJOY(BYTE PL, BYTE POINTER STI,TRI)
; call procedure stating PL (range 0...8) and 2 pointers to variables to which the result is returned
; e.g. "QUERYMULJOY(0,ST,TR)" check for Joystick 0, return values in the variable ST and TR point to
BYTE PORTA=$D300, TRIG0=$D010, WSYNC=$D40A
;
PORTA=(PL LSH 4) ; LSH 4 is the same as multiply by 4
PL=6
DO PL==-1 UNTIL PL=0 OD ; wait a wee bit so the PIA can adjust to the new value
TRI^=TRIG0 ; now read the trigger
STI^=(PORTA&$0F) ; and read the joystick, and blank out the high nibble by ANDing %00001111=$0F
RETURN
call the procedure with:
PROC MAIN()
BYTE TRI,STI,PL
BYTE POINTER S,T
S=@STI ; pointer S now points to STI
T=@TRI ; and T to TRI
DO ; main loop
FOR PL=0 to 8 DO
QUERYMULJOY(PL,S,T) ; hand over the joystick number you want to query and two POINTERs for Stick and Trigger
; variables where you want the results.
; STI now holds the value for the stick
; TRI now holds the value for the trigger
; go ahead and do something with it...
OD
OD ; end of main loop
RETURN
}}}