Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ctrl_1_Ext_Logical = ramaddr( $FFFFF608 ) ; 2 bytes
- Ctrl_1_Ext_Held_Logical = ramaddr( $FFFFF608 ) ; 1 byte
- Ctrl_1_Ext_Press_Logical = ramaddr( $FFFFF609 ) ; 1 byte
- Ctrl_1_Ext = ramaddr( $FFFFF60A ) ; 2 bytes ; ----MXYZ
- Ctrl_1_Ext_Held = ramaddr( $FFFFF60A ) ; 1 byte
- Ctrl_1_Ext_Press = ramaddr( $FFFFF60B ) ; 1 byte
- Ctrl_2_Ext_Logical = ramaddr( $FFFFF60C ) ; 2 bytes
- Ctrl_2_Ext_Held_Logical = ramaddr( $FFFFF60C ) ; 1 byte
- Ctrl_2_Ext_Press_Logical = ramaddr( $FFFFF60D ) ; 1 byte
- Ctrl_2_Ext = ramaddr( $FFFFF60E ) ; 2 bytes ; ----MXYZ
- Ctrl_2_Ext_Held = ramaddr( $FFFFF60E ) ; 1 byte
- Ctrl_2_Ext_Press = ramaddr( $FFFFF60F ) ; 1 byte
- ; ---------------------------------------------------------------------------
- ; Subroutine to read joypad input, and send it to the RAM
- ; ---------------------------------------------------------------------------
- ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
- ; sub_111C:
- ReadJoypads:
- stopZ80
- ; Read first player SACBRLDU buttons
- lea (Z80_Port_1_Data+1).l,a1 ; first joypad port
- lea (Ctrl_1).w,a0 ; address where joypad states are written
- bsr.s Joypad_Read
- ; Read first player MXYZ buttons
- lea (Ctrl_1_Ext).w,a0
- bsr.s Joypad_Read_Ext
- ; Test for 3 button mode
- btst #7,(Ctrl_1_Ext).w
- bne.s +
- clr.w (Ctrl_1_Ext).w
- +
- ; Read second player SACBRLDU buttons
- addi.l #2,a1 ; second joypad port
- lea (Ctrl_2).w,a0 ; address where joypad states are written
- bsr.s Joypad_Read
- if SUPPORT_ARCADE_PAD == 1
- ; Read second player MXYZ buttons
- lea (Ctrl_2_Ext).w,a0
- bsr.s Joypad_Read_Ext
- ; Test for 3 button mode
- btst #7,(Ctrl_2_Ext).w
- bne.s +
- clr.w (Ctrl_2_Ext).w
- +
- endif
- startZ80
- rts
- ; End of function ReadJoypads
- ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
- ; sub_112A:
- Joypad_Read: ; SACBLRDU
- move.b #0,(a1)
- move.b (a1),d0
- lsl.b #2,d0
- andi.b #$C0,d0
- move.b #$40,(a1)
- move.b (a1),d1
- andi.b #$3F,d1
- or.b d1,d0
- not.b d0
- move.b (a0),d1
- eor.b d0,d1
- move.b d0,(a0)+
- and.b d0,d1
- move.b d1,(a0)+
- rts
- Joypad_Read_Ext: ; MXYZ
- ; First cycle
- move.b #0,(a1)
- move.b (a1),d0
- move.b #$40,(a1)
- move.b (a1),d1
- ; Second cycle
- move.b #0,(a1)
- move.b (a1),d0
- lsl.b #4,d0
- move.b #$40,(a1)
- move.b (a1),d1
- ; Write button pushes
- andi.b #$F,d1
- or.b d1,d0
- not.b d0
- move.b (a0),d1
- eor.b d0,d1
- move.b d0,(a0)+
- and.b d0,d1
- move.b d1,(a0)+
- rts
- ; End of function Joypad_Read
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement