From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2002-12-20 21:26:06
On Fri, Dec 20, 2002 at 09:16:15PM +0100, Groepaz wrote:
> as for the protovision and dxs/hit adapter-drivers.... they both build a
> bitfield thats equal to the usual stuff that you get from the normal
> joystickports .... and i guess most other drivers might want to do that
> aswell. at some point the conversion has to be done anyway, since you would
> want to check joysticks in a loop and not write different code for each of
> them.
I think I've found a viable solution: The driver exports an array of bitmasks
which the wrapper will copy into the directly accessible data segment. This
array is indexed by constants. So instead of
if (mask & JOY_FIRE) {
....
}
which translates to
ldy #$00
lda (sp),y
and #$10
beq ...
one will have to use
if (mask & joy_masks[JOY_FIRE]) {
....
}
which translates to
ldy #$00
lda _masks+3
and (sp),y
beq ...
The latter code is still ok, and it's up to the driver to use the optimal
bitmask for the specific hardware it supports.
Regards
Uz
--
Ullrich von Bassewitz uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2002-12-20 21:26:10 CET