Code optimizations (by Stefan Haubenthal and me).

git-svn-id: svn://svn.cc65.org/cc65/trunk@3906 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2009-01-06 17:49:29 +00:00
parent 368e881288
commit 8c8e0b131f

View File

@@ -25,14 +25,14 @@
; Button state masks (8 values) ; Button state masks (8 values)
.byte $08 ; JOY_UP .byte $10 ; JOY_UP
.byte $04 ; JOY_DOWN .byte $20 ; JOY_DOWN
.byte $02 ; JOY_LEFT .byte $40 ; JOY_LEFT
.byte $01 ; JOY_RIGHT .byte $80 ; JOY_RIGHT
.byte $80 ; JOY_FIRE (A) .byte $01 ; JOY_FIRE (A)
.byte $40 ; JOY_FIRE2 (B) .byte $02 ; JOY_FIRE2 (B)
.byte $20 ; JOY_FIRE3 (Select) .byte $04 ; (Select)
.byte $10 ; JOY_FIRE4 (Start) .byte $08 ; (Start)
; Jump table. ; Jump table.
@@ -88,25 +88,20 @@ READJOY:
and #$01 ; Fix joystick number and #$01 ; Fix joystick number
tay ; Joystick number (0,1) into Y tay ; Joystick number (0,1) into Y
; Read joystick
lda #1 lda #1
sta APU_PAD1,y sta APU_PAD1,y
lda #0 lda #0
sta APU_PAD1,y sta APU_PAD1,y
sta tmp1
; Read joystick
ldx #8 ldx #8
@L1: asl tmp1 @Loop: lda APU_PAD1,y
lda APU_PAD1,y ror a
and #$01 ror tmp1
beq @L2 dex
lda tmp1 bne @Loop
ora #$01
sta tmp1
@L2: dex
bne @L1
lda tmp1 lda tmp1
; ldx #$00 ; fix X ; ldx #$00 ; X implicitly fixed
rts rts