mirror of
https://github.com/cc65/cc65.git
synced 2025-08-08 22:25:28 +00:00
Improved CONIO test in several ways.
- Use more consistent source code style. - Don't presume that CH_F... constants are present. - Allow to quit the program via 'Enter'.
This commit is contained in:
@@ -29,7 +29,7 @@ static char grid[5][5] = {
|
||||
{CH_VLINE, ' ', CH_VLINE, ' ', CH_VLINE },
|
||||
{CH_LTEE, CH_HLINE, CH_CROSS, CH_HLINE, CH_RTEE },
|
||||
{CH_VLINE, ' ', CH_VLINE, ' ', CH_VLINE },
|
||||
{ CH_LLCORNER, CH_HLINE, CH_BTEE, CH_HLINE, CH_LRCORNER },
|
||||
{CH_LLCORNER, CH_HLINE, CH_BTEE, CH_HLINE, CH_LRCORNER}
|
||||
};
|
||||
|
||||
void main(void)
|
||||
@@ -50,15 +50,16 @@ void main(void)
|
||||
tcol = textcolor(0); /* remember original textcolor */
|
||||
bgcol = bgcolor(0); /* remember original background color */
|
||||
bcol = bordercolor(0); /* remember original border color */
|
||||
bgcolor(bgcol);bordercolor(bcol);
|
||||
(void)bgcolor(bgcol);
|
||||
(void)bordercolor(bcol);
|
||||
for (i = 0; i < 3; ++i) {
|
||||
gotoxy(i, 3 + i);
|
||||
for (j = 0; j < NUMCOLS; ++j) {
|
||||
textcolor(j);
|
||||
(void)textcolor(j);
|
||||
cputc('X');
|
||||
}
|
||||
}
|
||||
textcolor(tcol);
|
||||
(void)textcolor(tcol);
|
||||
|
||||
cprintf("\n\n\r Screensize: %dx%d", xsize, ysize);
|
||||
|
||||
@@ -112,7 +113,7 @@ void main(void)
|
||||
revers(j ^ 1);
|
||||
cputs(" rvs");
|
||||
revers(0);
|
||||
textcolor(i);
|
||||
(void)textcolor(i);
|
||||
|
||||
gotoxy(7 + inpos, 1);
|
||||
|
||||
@@ -126,23 +127,34 @@ void main(void)
|
||||
#else
|
||||
i = cgetc();
|
||||
if ((i >= '0') && (i <= '9')) {
|
||||
textcolor(i - '0');
|
||||
(void)textcolor(i - '0');
|
||||
} else if (i == CH_ENTER) {
|
||||
clrscr();
|
||||
return;
|
||||
} else if (i == CH_CURS_LEFT) {
|
||||
inpos = (inpos - 1) & 7;
|
||||
} else if (i == CH_CURS_RIGHT) {
|
||||
inpos = (inpos + 1) & 7;
|
||||
#ifdef CH_F5
|
||||
} else if (i == CH_F5) {
|
||||
bgcol = (bgcol + 1) & 0x0f;
|
||||
bordercolor(bgcol);
|
||||
(void)bordercolor(bgcol);
|
||||
#endif
|
||||
#ifdef CH_F6
|
||||
} else if (i == CH_F6) {
|
||||
bgcol = (bgcol - 1) & 0x0f;
|
||||
bordercolor(bgcol);
|
||||
(void)bordercolor(bgcol);
|
||||
#endif
|
||||
#ifdef CH_F7
|
||||
} else if (i == CH_F7) {
|
||||
bgcol = (bgcol + 1) & 0x0f;
|
||||
bgcolor(bgcol);
|
||||
(void)bgcolor(bgcol);
|
||||
#endif
|
||||
#ifdef CH_F8
|
||||
} else if (i == CH_F8) {
|
||||
bgcol = (bgcol - 1) & 0x0f;
|
||||
bgcolor(bgcol);
|
||||
(void)bgcolor(bgcol);
|
||||
#endif
|
||||
} else {
|
||||
cputc(i);
|
||||
inpos = (inpos + 1) & 7;
|
||||
|
Reference in New Issue
Block a user