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:
@@ -27,26 +27,6 @@
|
||||
|
||||
.addr $0000
|
||||
|
||||
; Symbolic names for joystick masks (similar names like the defines in joystick.h, but not related to them)
|
||||
|
||||
JOY_UP = $10
|
||||
JOY_DOWN = $04
|
||||
JOY_LEFT = $20
|
||||
JOY_RIGHT = $08
|
||||
JOY_FIRE = $01
|
||||
JOY_FIRE2 = $02
|
||||
|
||||
; Joystick state masks (8 values)
|
||||
|
||||
.byte JOY_UP
|
||||
.byte JOY_DOWN
|
||||
.byte JOY_LEFT
|
||||
.byte JOY_RIGHT
|
||||
.byte JOY_FIRE
|
||||
.byte JOY_FIRE2
|
||||
.byte $00 ; Future expansion
|
||||
.byte $00 ; Future expansion
|
||||
|
||||
; Jump table.
|
||||
|
||||
.addr INSTALL
|
||||
@@ -60,6 +40,13 @@ JOY_FIRE2 = $02
|
||||
|
||||
JOY_COUNT = 2 ; Number of joysticks we support
|
||||
|
||||
; Symbolic names for joystick masks (similar names like the defines in joystick.h, but not related to them)
|
||||
|
||||
JOY_UP = $10
|
||||
JOY_DOWN = $04
|
||||
JOY_LEFT = $20
|
||||
JOY_RIGHT = $08
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Code
|
||||
|
||||
@@ -129,7 +116,7 @@ convert:
|
||||
; values were shifted to the right to be identical).
|
||||
; Why are there two bits indicating a pressed trigger?
|
||||
; According to the "Second book of programs for the Dick Smith Wizard"
|
||||
; (pg. 88ff), the left hand fire button gives the value of
|
||||
; (pg. 88ff), the left hand button gives the value of
|
||||
; %00010001 and the right hand button gives %00100010
|
||||
; Why two bits? Can there be cases that just one of those bits is set?
|
||||
; Until these questions have been answered, we only use the lower two
|
||||
|
||||
Reference in New Issue
Block a user