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_VLINE, ' ', CH_VLINE, ' ', CH_VLINE },
|
||||||
{CH_LTEE, CH_HLINE, CH_CROSS, CH_HLINE, CH_RTEE },
|
{CH_LTEE, CH_HLINE, CH_CROSS, CH_HLINE, CH_RTEE },
|
||||||
{CH_VLINE, ' ', CH_VLINE, ' ', CH_VLINE },
|
{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)
|
void main(void)
|
||||||
@@ -50,15 +50,16 @@ void main(void)
|
|||||||
tcol = textcolor(0); /* remember original textcolor */
|
tcol = textcolor(0); /* remember original textcolor */
|
||||||
bgcol = bgcolor(0); /* remember original background color */
|
bgcol = bgcolor(0); /* remember original background color */
|
||||||
bcol = bordercolor(0); /* remember original border color */
|
bcol = bordercolor(0); /* remember original border color */
|
||||||
bgcolor(bgcol);bordercolor(bcol);
|
(void)bgcolor(bgcol);
|
||||||
|
(void)bordercolor(bcol);
|
||||||
for (i = 0; i < 3; ++i) {
|
for (i = 0; i < 3; ++i) {
|
||||||
gotoxy(i, 3 + i);
|
gotoxy(i, 3 + i);
|
||||||
for (j = 0; j < NUMCOLS; ++j) {
|
for (j = 0; j < NUMCOLS; ++j) {
|
||||||
textcolor(j);
|
(void)textcolor(j);
|
||||||
cputc('X');
|
cputc('X');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
textcolor(tcol);
|
(void)textcolor(tcol);
|
||||||
|
|
||||||
cprintf("\n\n\r Screensize: %dx%d", xsize, ysize);
|
cprintf("\n\n\r Screensize: %dx%d", xsize, ysize);
|
||||||
|
|
||||||
@@ -112,7 +113,7 @@ void main(void)
|
|||||||
revers(j ^ 1);
|
revers(j ^ 1);
|
||||||
cputs(" rvs");
|
cputs(" rvs");
|
||||||
revers(0);
|
revers(0);
|
||||||
textcolor(i);
|
(void)textcolor(i);
|
||||||
|
|
||||||
gotoxy(7 + inpos, 1);
|
gotoxy(7 + inpos, 1);
|
||||||
|
|
||||||
@@ -126,23 +127,34 @@ void main(void)
|
|||||||
#else
|
#else
|
||||||
i = cgetc();
|
i = cgetc();
|
||||||
if ((i >= '0') && (i <= '9')) {
|
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) {
|
} else if (i == CH_CURS_LEFT) {
|
||||||
inpos = (inpos - 1) & 7;
|
inpos = (inpos - 1) & 7;
|
||||||
} else if (i == CH_CURS_RIGHT) {
|
} else if (i == CH_CURS_RIGHT) {
|
||||||
inpos = (inpos + 1) & 7;
|
inpos = (inpos + 1) & 7;
|
||||||
|
#ifdef CH_F5
|
||||||
} else if (i == CH_F5) {
|
} else if (i == CH_F5) {
|
||||||
bgcol = (bgcol + 1) & 0x0f;
|
bgcol = (bgcol + 1) & 0x0f;
|
||||||
bordercolor(bgcol);
|
(void)bordercolor(bgcol);
|
||||||
|
#endif
|
||||||
|
#ifdef CH_F6
|
||||||
} else if (i == CH_F6) {
|
} else if (i == CH_F6) {
|
||||||
bgcol = (bgcol - 1) & 0x0f;
|
bgcol = (bgcol - 1) & 0x0f;
|
||||||
bordercolor(bgcol);
|
(void)bordercolor(bgcol);
|
||||||
|
#endif
|
||||||
|
#ifdef CH_F7
|
||||||
} else if (i == CH_F7) {
|
} else if (i == CH_F7) {
|
||||||
bgcol = (bgcol + 1) & 0x0f;
|
bgcol = (bgcol + 1) & 0x0f;
|
||||||
bgcolor(bgcol);
|
(void)bgcolor(bgcol);
|
||||||
|
#endif
|
||||||
|
#ifdef CH_F8
|
||||||
} else if (i == CH_F8) {
|
} else if (i == CH_F8) {
|
||||||
bgcol = (bgcol - 1) & 0x0f;
|
bgcol = (bgcol - 1) & 0x0f;
|
||||||
bgcolor(bgcol);
|
(void)bgcolor(bgcol);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
cputc(i);
|
cputc(i);
|
||||||
inpos = (inpos + 1) & 7;
|
inpos = (inpos + 1) & 7;
|
||||||
|
|||||||
Reference in New Issue
Block a user