home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format 44
/
af044.adf
/
Serious_Stuff
/
SEGA.S
< prev
next >
Wrap
Text File
|
1993-01-21
|
2KB
|
52 lines
* Amiga 4-button joystick code...
*
* Stick discovery by Ed Bamber
* Code created by Anthony Ball
*
* (C)1992 Anthony Ball & Edmund Bamber
*
* We must be credited if this routine is to be used in any code
*
* Requires a megadrive joystick with wires 5 & 7 swapped
*
* Returns: d0 register "Stick Bits" 76543210
* ABCDUDLR
* ABCD... Different buttons U=Up D=Down L=Left R=Right
*
* Amiga Format Note: Thanks to Craig Proctor for his method
* But Pat McDonald regrets that he mislaid it. Sorry Craig - forgot my password to Cyberspace
* This one is just as good though.
*
chip equ $dff000 * chips
joy1dat equ $00c * joystick 1 data
potinp equ $016 * pot port data read
potgo equ $034 * pot port data write and start
piaa equ $bfe001 * 8520 port A
pra equ $000 * reg 0 peripheral data register a
Getstick lea chip,a6
moveq #0,d2
btst.b #7,piaa+pra * button A pressed?
bne.s .Not1 * No!
or #$80,d2
.Not1 btst.b #6,potinp(a6) * button B pressed?
bne.s .Not2 * No!
or #$40,d2
.Not2 move #$e000,potgo(a6) * Set 5 volt port on
move joy1dat(a6),d0 * Get stick for player
and #$0303,d0 * Keep only the bits needed
move d0,d1
lsr #6,d0 * Make Table Smaller!
or.b d1,d0
move.b .Table(pc,d0),d0 * Get converted byte
or d2,d0
btst.b #7,piaa+pra * button C pressed?
bne.s .Not3 * No!
or #$20,d0
.Not3 btst.b #6,potinp(a6) * button D pressed?
bne.s .Not4 * No!
or #$10,d0
.Not4 move #$f000,potgo(a6) * Ready for next read
rts
.Table dc.l $00040501,$08000109,$0a020008,$02060400