1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-22 12:30:41 +00:00

Rename the standard joystick driver for the Apple ][.

Rewrite the driver code to make it shorter.


git-svn-id: svn://svn.cc65.org/cc65/trunk@2117 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2003-05-02 11:53:21 +00:00
parent c932bc3d1d
commit 6af35e774d
2 changed files with 15 additions and 31 deletions

View File

@ -48,7 +48,7 @@ apple2lib:
$(AR) a apple2.lib $$i/*.o;\ $(AR) a apple2.lib $$i/*.o;\
done done
mv apple2/crt0.o apple2.o mv apple2/crt0.o apple2.o
cp apple2/*.joy . cp apple2/apple2-stdjoy.joy a2-stdjoy.joy
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Atari # Atari

View File

@ -18,12 +18,6 @@
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Constants ; Constants
JOY_UP = $01
JOY_DOWN = $02
JOY_LEFT = $04
JOY_RIGHT = $08
JOY_FIRE = $10
OFFS = 10 OFFS = 10
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
@ -38,11 +32,11 @@ OFFS = 10
; Button state masks (8 values) ; Button state masks (8 values)
.byte JOY_UP .byte $40
.byte JOY_DOWN .byte $80
.byte JOY_LEFT .byte $10
.byte JOY_RIGHT .byte $20
.byte JOY_FIRE .byte $08
.byte $00 ; Future expansion .byte $00 ; Future expansion
.byte $00 ; Future expansion .byte $00 ; Future expansion
.byte $00 ; Future expansion .byte $00 ; Future expansion
@ -108,38 +102,28 @@ READJOY:
; Read joystick ; Read joystick
lda #$00 ; Clear result lda OPEN_APPLE,x ; Check fire button
ldy OPEN_APPLE,x ; Check fire button and #$80 ; BTN 0 0 0 0 0 0 0
bpl @nofire
ora #JOY_FIRE ; Fire button pressed
@nofire:
pha pha
jsr PREAD ; Read first paddle value jsr PREAD ; Read first paddle value
pla pla
cpy #127-OFFS cpy #127-OFFS
bcc @left ror a ; /LEFT BTN 0 0 0 0 0 0
cpy #127+OFFS cpy #127+OFFS
bcc @nextpaddle ror a ; RIGHT /LEFT BTN 0 0 0 0 0
ora #JOY_RIGHT
.byte $2c
@left: ora #JOY_LEFT
@nextpaddle:
inx inx
pha pha
jsr PREAD jsr PREAD ; Read second paddle
pla pla
cpy #127-OFFS cpy #127-OFFS
bcc @up ror a ; /UP RIGHT /LEFT BTN 0 0 0 0
cpy #127+OFFS cpy #127+OFFS
bcc @done ror a ; DOWN /UP RIGHT /LEFT BTN 0 0 0
ora #JOY_DOWN eor #%01010000 ; DOWN UP RIGHT LEFT BTN 0 0 0
.byte $2c
@up: ora #JOY_UP
@done: ldx #0 ; fix X ldx #0 ; fix X
rts rts