mirror of
https://github.com/cc65/cc65.git
synced 2024-06-28 19:29:53 +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:
parent
1644bcdf03
commit
13790bdbf0
|
@ -25,11 +25,11 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char grid[5][5] = {
|
static char grid[5][5] = {
|
||||||
{ CH_ULCORNER, CH_HLINE, CH_TTEE, CH_HLINE, CH_URCORNER },
|
{CH_ULCORNER, CH_HLINE, CH_TTEE, CH_HLINE, CH_URCORNER},
|
||||||
{ 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,35 +50,36 @@ 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);
|
||||||
|
|
||||||
chlinexy(0,6,xsize);
|
chlinexy(0, 6, xsize);
|
||||||
cvlinexy(0,6,3);
|
cvlinexy(0, 6, 3);
|
||||||
chlinexy(0,8,xsize);
|
chlinexy(0, 8, xsize);
|
||||||
cvlinexy(xsize-1,6,3);
|
cvlinexy(xsize - 1, 6, 3);
|
||||||
cputcxy(0,6,CH_ULCORNER);
|
cputcxy(0, 6, CH_ULCORNER);
|
||||||
cputcxy(xsize-1,6,CH_URCORNER);
|
cputcxy(xsize - 1, 6, CH_URCORNER);
|
||||||
cputcxy(0,8,CH_LLCORNER);
|
cputcxy(0, 8, CH_LLCORNER);
|
||||||
cputcxy(xsize-1,8,CH_LRCORNER);
|
cputcxy(xsize - 1, 8, CH_LRCORNER);
|
||||||
|
|
||||||
for (i = 0; i < 5; ++i) {
|
for (i = 0; i < 5; ++i) {
|
||||||
gotoxy(xsize - 5,i);
|
gotoxy(xsize - 5, i);
|
||||||
for (j = 0; j < 5; ++j) {
|
for (j = 0; j < 5; ++j) {
|
||||||
cputc(grid[i][j]);
|
cputc(grid[i][j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gotoxy(0,ysize - 2 - ((NUMCHARS + xsize) / xsize));
|
gotoxy(0, ysize - 2 - ((NUMCHARS + xsize) / xsize));
|
||||||
revers(1);
|
revers(1);
|
||||||
for (i = 0; i < xsize; ++i) {
|
for (i = 0; i < xsize; ++i) {
|
||||||
cputc('0' + i % 10);
|
cputc('0' + i % 10);
|
||||||
|
@ -112,9 +113,9 @@ 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);
|
||||||
|
|
||||||
#if defined(__NES__) || defined(__PCE__) || defined(__GAMATE__)
|
#if defined(__NES__) || defined(__PCE__) || defined(__GAMATE__)
|
||||||
/* not all targets have waitvsync */
|
/* not all targets have waitvsync */
|
||||||
|
@ -125,24 +126,35 @@ void main(void)
|
||||||
cprintf("%02x", joy);
|
cprintf("%02x", joy);
|
||||||
#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;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user