From: mrdudz Date: Tue, 1 Dec 2015 23:13:32 +0000 (+0100) Subject: fixup conio.c some more. also includes merge of upstream/master because git is retarded. X-Git-Tag: V2.16~178^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8a499fdf4ede597248dc3cfd0f49083cc4996a44;p=cc65 fixup conio.c some more. also includes merge of upstream/master because git is retarded. --- 8a499fdf4ede597248dc3cfd0f49083cc4996a44 diff --cc testcode/lib/conio.c index 7a5e6f822,bdee12262..fe977ec08 --- a/testcode/lib/conio.c +++ b/testcode/lib/conio.c @@@ -13,16 -13,8 +13,17 @@@ #include #include #include + #include +#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 }, @@@ -35,13 -27,11 +36,16 @@@ void main(void { 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 */ @@@ -97,18 -87,25 +101,29 @@@ 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'); @@@ -132,14 -129,9 +147,7 @@@ cputc(i); inpos = (inpos + 1) & 7; } - #endif - /* not all targets have waitvblank() */ - #if defined(__NES__) || defined(__PCE__) || defined(__GAMATE__) - waitvblank(); - #endif -- ++n; } - - for(;;); }