From: cuz Date: Fri, 2 May 2003 11:53:21 +0000 (+0000) Subject: Rename the standard joystick driver for the Apple ][. X-Git-Tag: V2.12.0~1597 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6af35e774de685f88e75ca0490e1dd11a39399c4;p=cc65 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 --- diff --git a/libsrc/Makefile b/libsrc/Makefile index dd8e78971..2118b65f8 100644 --- a/libsrc/Makefile +++ b/libsrc/Makefile @@ -48,7 +48,7 @@ apple2lib: $(AR) a apple2.lib $$i/*.o;\ done mv apple2/crt0.o apple2.o - cp apple2/*.joy . + cp apple2/apple2-stdjoy.joy a2-stdjoy.joy #----------------------------------------------------------------------------- # Atari diff --git a/libsrc/apple2/apple2-stdjoy.s b/libsrc/apple2/apple2-stdjoy.s index ae0f4342e..14bb5fd83 100644 --- a/libsrc/apple2/apple2-stdjoy.s +++ b/libsrc/apple2/apple2-stdjoy.s @@ -18,12 +18,6 @@ ; ------------------------------------------------------------------------ ; Constants -JOY_UP = $01 -JOY_DOWN = $02 -JOY_LEFT = $04 -JOY_RIGHT = $08 -JOY_FIRE = $10 - OFFS = 10 ; ------------------------------------------------------------------------ @@ -38,11 +32,11 @@ OFFS = 10 ; Button state masks (8 values) - .byte JOY_UP - .byte JOY_DOWN - .byte JOY_LEFT - .byte JOY_RIGHT - .byte JOY_FIRE + .byte $40 + .byte $80 + .byte $10 + .byte $20 + .byte $08 .byte $00 ; Future expansion .byte $00 ; Future expansion .byte $00 ; Future expansion @@ -108,38 +102,28 @@ READJOY: ; Read joystick - lda #$00 ; Clear result - ldy OPEN_APPLE,x ; Check fire button - bpl @nofire - ora #JOY_FIRE ; Fire button pressed + lda OPEN_APPLE,x ; Check fire button + and #$80 ; BTN 0 0 0 0 0 0 0 -@nofire: pha jsr PREAD ; Read first paddle value pla cpy #127-OFFS - bcc @left + ror a ; /LEFT BTN 0 0 0 0 0 0 cpy #127+OFFS - bcc @nextpaddle - ora #JOY_RIGHT - .byte $2c -@left: ora #JOY_LEFT + ror a ; RIGHT /LEFT BTN 0 0 0 0 0 -@nextpaddle: inx pha - jsr PREAD + jsr PREAD ; Read second paddle pla cpy #127-OFFS - bcc @up + ror a ; /UP RIGHT /LEFT BTN 0 0 0 0 cpy #127+OFFS - bcc @done - ora #JOY_DOWN - .byte $2c -@up: ora #JOY_UP + ror a ; DOWN /UP RIGHT /LEFT BTN 0 0 0 + eor #%01010000 ; DOWN UP RIGHT LEFT BTN 0 0 0 -@done: ldx #0 ; fix X + ldx #0 ; fix X rts -