home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CDPD Public Domain Collection for CDTV 3
/
CDPDIII.bin
/
pd
/
aga_software
/
animdemo
/
joystick.asm
< prev
next >
Wrap
Assembly Source File
|
1993-01-22
|
1KB
|
66 lines
*******************************************************************************
*
* (c) Copyright 1993 Commodore-Amiga, Inc. All rights reserved.
*
* This software is provided as-is and is subject to change; no warranties
* are made. All use is at your own risk. No liability or responsibility
* is assumed.
*
* joystick.asm - reads the joystick port.
*
*******************************************************************************
incdir 'include:'
include 'hardware/custom.i'
include "stick.i"
xdef _ReadJoystick
custom equ $dff000
* ULONG __asm ReadJoystick(register __a0 struct JoyStick *stick);
_ReadJoystick:
; joystick - get current state of switches in variables
; uses d0,d1,a1
move.w custom+joy1dat,d0
btst #1,d0
sne stick_right(a0)
btst #9,d0
sne stick_left(a0)
move d0,d1
add d0,d0
eor d1,d0
btst #1,d0
sne stick_down(a0)
btst #9,d0
sne stick_up(a0)
tst.b $bfe0ff ; fire button
spl stick_fire(a0)
move.b stick_fire(a0),d0
bmi.s j_1
tst.b old_stick_fire(a0)
smi stick_click(a0)
j_1: move.b d0,old_stick_fire(a0)
moveq #0,d0
move.b stick_left(a0),d0
and.b #LEFT,d0
move.b stick_right(a0),d1
and.b #RIGHT,d1
or.b d1,d0
move.b stick_up(a0),d1
and.b #UP,d1
or.b d1,d0
move.b stick_down(a0),d1
and.b #DOWN,d1
or.b d1,d0
move.b stick_fire(a0),d1
and.b #FIRE,d1
or.b d1,d0
move.b stick_click(a0),d1
and.b #CLICK,d1
or.b d1,d0
rts