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:
@@ -58,21 +58,19 @@ int main (void)
|
||||
#if defined(__ATARI5200__) || defined(__CREATIVISION__)
|
||||
cprintf ("%1d:%-3s%-3s%-3s%-3s%-3s%-3s",
|
||||
i,
|
||||
(j & joy_masks[JOY_UP])? " U " : " ",
|
||||
(j & joy_masks[JOY_DOWN])? " D " : " ",
|
||||
(j & joy_masks[JOY_LEFT])? " L " : " ",
|
||||
(j & joy_masks[JOY_RIGHT])? " R " : " ",
|
||||
(j & joy_masks[JOY_FIRE])? " 1 " : " ",
|
||||
(j & joy_masks[JOY_FIRE2])? " 2 " : " ");
|
||||
JOY_UP(j)? " U " : " - ",
|
||||
JOY_DOWN(j)? " D " : " - ",
|
||||
JOY_LEFT(j)? " L " : " - ",
|
||||
JOY_RIGHT(j)? " R " : " - ",
|
||||
JOY_BTN_1(j)? " 1 " : " - ");
|
||||
#else
|
||||
cprintf ("%2d: %-6s%-6s%-6s%-6s%-6s%-6s",
|
||||
i,
|
||||
(j & joy_masks[JOY_UP])? " up " : " ---- ",
|
||||
(j & joy_masks[JOY_DOWN])? " down " : " ---- ",
|
||||
(j & joy_masks[JOY_LEFT])? " left " : " ---- ",
|
||||
(j & joy_masks[JOY_RIGHT])? "right " : " ---- ",
|
||||
(j & joy_masks[JOY_FIRE])? " fire " : " ---- ",
|
||||
(j & joy_masks[JOY_FIRE2])? "fire2 " : " ---- ");
|
||||
JOY_UP(j)? " up " : " ---- ",
|
||||
JOY_DOWN(j)? " down " : " ---- ",
|
||||
JOY_LEFT(j)? " left " : " ---- ",
|
||||
JOY_RIGHT(j)? "right " : " ---- ",
|
||||
JOY_BTN_1(j)? "button" : " ---- ");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <pce.h>
|
||||
#include <conio.h>
|
||||
#include <time.h>
|
||||
#include <joystick.h>
|
||||
@@ -97,14 +98,14 @@ void main(void)
|
||||
j = joy_read (i);
|
||||
cprintf ("pad %d: %02x %-6s%-6s%-6s%-6s%-6s%-6s%-6s%-6s",
|
||||
i, j,
|
||||
(j & joy_masks[JOY_UP])? " up " : " ---- ",
|
||||
(j & joy_masks[JOY_DOWN])? " down " : " ---- ",
|
||||
(j & joy_masks[JOY_LEFT])? " left " : " ---- ",
|
||||
(j & joy_masks[JOY_RIGHT])? "right " : " ---- ",
|
||||
(j & joy_masks[JOY_FIRE])? " fire " : " ---- ",
|
||||
(j & joy_masks[JOY_FIRE2])? "fire2 " : " ---- ",
|
||||
(j & joy_masks[JOY_SELECT])? "select" : " ---- ",
|
||||
(j & joy_masks[JOY_RUN])? " run " : " ---- ");
|
||||
JOY_UP(j)? " up " : " ---- ",
|
||||
JOY_DOWN(j)? " down " : " ---- ",
|
||||
JOY_LEFT(j)? " left " : " ---- ",
|
||||
JOY_RIGHT(j)? "right " : " ---- ",
|
||||
JOY_BTN_I(j)? "btn I " : " ---- ",
|
||||
JOY_BTN_II(j)? "btn II" : " ---- ",
|
||||
JOY_SELECT(j)? "select" : " ---- ",
|
||||
JOY_RUN(j)? " run " : " ---- ");
|
||||
}
|
||||
|
||||
gotoxy(xsize - 10, 3);
|
||||
|
||||
Reference in New Issue
Block a user