1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 02:29:52 +00:00

update conio test

This commit is contained in:
mrdudz 2015-10-14 17:24:42 +02:00
parent c708031374
commit d4f88c8f71

View File

@ -1,3 +1,14 @@
/*
* conio api test program
*
* keys:
*
* 1...0 change text color
* F5/F6 change border color
* F7/F8 change background color
*
*/
#include <conio.h> #include <conio.h>
#include <string.h> #include <string.h>
@ -14,7 +25,7 @@ static char grid[5][5] = {
void main(void) void main(void)
{ {
int i, j, n; int i, j, n;
unsigned char xsize, ysize, tcol, bgcol, inpos = 0; unsigned char xsize, ysize, tcol, bgcol, bcol, inpos = 0;
clrscr(); clrscr();
screensize(&xsize, &ysize); screensize(&xsize, &ysize);
@ -23,6 +34,7 @@ void main(void)
cputsxy(0, 2, "Colors:" ); cputsxy(0, 2, "Colors:" );
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 */
for (i = 0; i < 3; ++i) { for (i = 0; i < 3; ++i) {
gotoxy(i,3 + i); gotoxy(i,3 + i);
for (j = 0; j < 16; ++j) { for (j = 0; j < 16; ++j) {
@ -92,6 +104,12 @@ void main(void)
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;
} else if (i == CH_F5) {
bgcol = (bgcol + 1) & 0x0f;
bordercolor(bgcol);
} else if (i == CH_F6) {
bgcol = (bgcol - 1) & 0x0f;
bordercolor(bgcol);
} else if (i == CH_F7) { } else if (i == CH_F7) {
bgcol = (bgcol + 1) & 0x0f; bgcol = (bgcol + 1) & 0x0f;
bgcolor(bgcol); bgcolor(bgcol);