|
Post by vetea on Oct 3, 2015 7:53:50 GMT -5
Hi all, Here is a small code with some useful ASM Port game routine. These read your Game port A & B. There is a Init Game port also ( don't put it on a loop but in the top of yoru code. ) global Joy1 as integer global Joy2 as integer 'Init Game Port Jsinit
on vblank gosub main enable interrupt vblank end
'Main Loop main: Joya Joyb locate 1,2:print " " locate 2,2:print " " locate 1,2:print joy1 locate 2,2:print Joy2 return
' Init Game Port Routine declare asm sub Jsinit moveq #$40,d0 move.b d0,$a10009 move.b d0,$a1000b move.b d0,$a1000d rts end sub
'Port A Read routine Declare asm sub JoyA move.b #$40,$a10003 nop nop move.b $a10003,d1 andi.b #$3f,d1 move.b #$00,$a10003 nop nop move.b $a10003,d0 andi.b #$30,d0 lsl.b #2,d0 or.b d1,d0 not.b d0 move.w d0,(__INTEGER_joy1) rts end sub
'Port B game routine Declare asm sub JoyB move.b #$40,$a10005 nop nop move.b $a10005,d1 andi.b #$3f,d1 move.b #$00,$a10005 nop nop move.b $a10005,d0 andi.b #$30,d0 lsl.b #2,d0 or.b d1,d0 not.b d0 move.w d0,(__INTEGER_joy2) rts end sub I think it can be useful with a 3 or 6 PAD buttons. Cheers !
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Oct 3, 2015 8:14:07 GMT -5
I think it can be useful with a 3 or 6 PAD buttons. What's wrong with using the built-in function? on vblank gosub main enable interrupt vblank end main: for i=0 to 1 j = joypad(i) reload map for b=0 to 11 read t drawtile t+palette(j.b),b,i next next return map: data 24,25,27,26,66,67,65,83,90,89,88,77
|
|