Removed joy_masks array.

So far the joy_masks array allowed several joystick drivers for a single target to each have different joy_read return values. However this meant that every call to joy_read implied an additional joy_masks lookup to post-process the return value.

Given that almost all targets only come with a single joystick driver this seems an inappropriate overhead. Therefore now the target header files contain constants matching the return value of the joy_read of the joystick driver(s) on that target.

If there indeed are several joystick drivers for a single target they must agree on a common return value for joy_read. In some cases this was alredy the case as there's a "natural" return value for joy_read. However a few joystick drivers need to be adjusted. This may cause some overhead inside the driver. But that is for sure smaller than the overhead introduced by the joy_masks lookup before.

!!! ToDo !!!

The following three joystick drivers become broken with this commit and need to be adjusted:
- atrmj8.s
- c64-numpad.s
- vic20-stdjoy.s
This commit is contained in:
Oliver Schmidt
2017-08-19 19:11:28 +02:00
parent f5e9b4012a
commit 7f52a770d9
44 changed files with 222 additions and 354 deletions

View File

@@ -30,17 +30,6 @@
.addr $0000
; Button state masks (8 values)
.byte $01 ; JOY_UP
.byte $02 ; JOY_DOWN
.byte $04 ; JOY_LEFT
.byte $08 ; JOY_RIGHT
.byte $10 ; JOY_FIRE
.byte $00 ; JOY_FIRE2 unavailable
.byte $00 ; Future expansion
.byte $00 ; Future expansion
; Jump table.
.addr INSTALL
@@ -105,7 +94,7 @@ READ: ldx #$0F ; Switch to the system bank
lda (cia2),y ; Read joystick inputs
sta tmp1
; Get the fire bits
; Get the push button bits
ldy #CIA::PRA
lda (cia2),y
@@ -115,12 +104,12 @@ READ: ldx #$0F ; Switch to the system bank
cpx #$00 ; Joystick 0?
bne @L1 ; Jump if no
; Joystick 1, fire is in bit 6, direction in bit 0-3
; Joystick 1, push button is in bit 6, direction in bit 0-3
asl a
jmp @L2
; Joystick 2, fire is in bit 7, direction in bit 5-7
; Joystick 2, push button is in bit 7, direction in bit 5-7
@L1: ldx #$00 ; High byte of return value
lsr tmp1
@@ -128,9 +117,9 @@ READ: ldx #$0F ; Switch to the system bank
lsr tmp1
lsr tmp1
; Mask the relavant bits, get the fire bit
; Mask the relavant bits, get the push button bit
@L2: asl a ; Fire bit into carry
@L2: asl a ; push button bit into carry
lda tmp1
and #$0F
bcc @L3