#include <conio.h>
#include <string.h>
#include <stdlib.h>
+ #include <joystick.h>
+#if defined(__GAMATE__)
+/* there is not enough screen space to show all 256 characters at the bottom */
+#define NUMCHARS 128
+#define NUMCOLS 4
+#else
+#define NUMCHARS 256
+#define NUMCOLS 16
+#endif
+
static char grid[5][5] = {
{ CH_ULCORNER, CH_HLINE, CH_TTEE, CH_HLINE, CH_URCORNER },
{ CH_VLINE, ' ', CH_VLINE, ' ', CH_VLINE },
{
int i, j, n;
unsigned char xsize, ysize, tcol, bgcol, bcol, inpos = 0;
++#if defined(__NES__) || defined(__PCE__) || defined(__GAMATE__)
++ unsigned char joy;
++ joy_install(joy_static_stddrv);
++#endif
clrscr();
screensize(&xsize, &ysize);
- cputs("cc65 conio test\n\rInput: [ ]");
+ cputs("cc65 conio test\n\r");
- #if !defined(__NES__) && !defined(__PCE__) && !defined(__GAMATE__)
- cputs("Input: [ ]");
- #endif
++ cputs("Input:[ ]");
+
cputsxy(0, 2, "Colors:" );
tcol = textcolor(0); /* remember original textcolor */
bgcol = bgcolor(0); /* remember original background color */
revers(0);
cursor(1);
- for(;;) {
+ for (;;) {
++ /* do the "rvs" blinking */
++ i = textcolor(COLOR_BLACK);
gotoxy(8, 2);
- j = n & 1;
+ j = n >> 4 & 1;
revers(j);
cputc(j ? 'R' : ' ');
revers(j ^ 1);
- cputs(" revers");
+ cputs(" rvs");
revers(0);
++ textcolor(i);
- #if !defined(__NES__) && !defined(__PCE__) && !defined(__GAMATE__)
- gotoxy(8 + inpos,1);
-#if defined(__NES__) || defined(__PCE__)
-
- joy_install(joy_static_stddrv);
- while (!joy_read(JOY_1)) ;
- joy_uninstall();
++ gotoxy(7 + inpos,1);
+
++#if defined(__NES__) || defined(__PCE__) || defined(__GAMATE__)
++ /* not all targets have waitvblank */
++ waitvblank();
++ /* for targets that do not have a keyboard, read the first
++ joystick */
++ joy = joy_read(JOY_1);
++ cprintf("%02x", joy);
+ #else
-
- gotoxy(8 + inpos,1);
i = cgetc();
if ((i >= '0') && (i<='9')) {
textcolor(i - '0');
cputc(i);
inpos = (inpos + 1) & 7;
}
-
#endif
- /* not all targets have waitvblank() */
- #if defined(__NES__) || defined(__PCE__) || defined(__GAMATE__)
- waitvblank();
- #endif
--
++n;
}
-
- for(;;);
}