arkadiusz.makarenko wrote: ↑Sat Oct 17, 2020 9:25 pm
Mouse and gamepads.... I have mouse XY delta and button states, gamepad readings on ARM side. Now still don't have clue what to do with it... yet.
Mouse should simply supply JOY0DAT the way the MiST setup does. On this riser it will be 2 reads (2 bytes of a word) but you can anticipate the second read in the arm as the system will always do these sequentially. I guess there might be code out there that reads them byte by byte?
http://amigadev.elowar.com/read/ADCD_2. ... e0038.html
The joypad buttons are a bit more complex on the CD32.
Code: Select all
;//=//=//=//=//=//=//=//=//=//=//=//=//=//=//=//=//=//=//=//=//=//=//=//=//=//
IFND HARDWARE_CUSTOM_I
_custom EQU $dff000
_ciaa EQU $bfe001
_ciab EQU $bfd000
ENDC
INCDIR Includes:
INCLUDE hardware/custom.i
INCLUDE hardware/cia.i
;in d0 == 0 - port 0
; == 1 - port 1
;
; this is out
;JPB_JOY_RIGHT = 0
;JPB_JOY_LEFT = 1
;JPB_JOY_DOWN = 2
;JPB_JOY_UP = 3
;JPB_BUTTON_PLAY = $11
;JPB_BUTTON_REVERSE = $12
;JPB_BUTTON_FORWARD = $13
;JPB_BUTTON_GREEN = $14
;JPB_BUTTON_YELLOW = $15
;JPB_BUTTON_RED = $16
;JPB_BUTTON_BLUE = $17
joystick movem.l d1-d7/a0-a1,-(sp)
lea _custom,a0
lea _ciaa,a1
moveq #1,d0 ;PORT 1
moveq #CIAB_GAMEPORT0,d3 ;red button ( port 0 )
move.w #10,d4 ;blue button ( port 0 )
move.w #$f600,d5 ;for potgo port 0
moveq #joy0dat,d6
tst.l d0
beq.b .direction
moveq #CIAB_GAMEPORT1,d3 ;red port 1
moveq #14,d4 ;blue port 1
move.w #$6f00,d5 ;for potgo port 1
moveq #joy1dat,d6 ;port 1
.direction moveq #0,d7
move.w (a0,d6.w),d0 ;get joystick direction
move.w d0,d1
lsr.w #1,d1
eor.w d0,d1
btst #8,d1 ;check joystick up
sne d7
add.w d7,d7
btst #0,d1 ;check joystick down
sne d7
add.w d7,d7
btst #9,d0 ;check joystick left
sne d7
add.w d7,d7
btst #1,d0 ;check joystick right
sne d7
add.w d7,d7
swap d7
;two buttons
btst d4,(potinp,a0) ;check button blue
seq d7
add.w d7,d7
btst d3,(ciapra,a1) ;check button red
seq d7
add.w d7,d7
and.w #$0300,d7
asr.l #2,d7
swap d7
asr.w #6,d7
; read buttons from CD32 pad
bset d3,(ciaddra,a1) ;set bit to out at ciapra
bclr d3,(ciapra,a1) ;clr bit to in at ciapra
move.w d5,(potgo,a0)
moveq #0,d0
moveq #8-1,d1
bra.b .in
.loop tst.b (a1)
tst.b (a1)
.in tst.b (a1)
tst.b (a1)
tst.b (a1)
tst.b (a1)
tst.b (a1)
tst.b (a1)
move.w (potinp,a0),d2
bset d3,(ciapra,a1)
bclr d3,(ciapra,a1)
btst d4,d2
bne.b .next
bset d1,d0
.next dbf d1,.loop
bclr d3,(ciaddra,a1) ;set bit to in at ciapra
move.w #$ffff,(potgo,a0)
swap d0
or.l d7,d0
movem.l (sp)+,d1-d7/a0-a1
rts
Maybe
@chucky can update diagrom for cd32 buttons.