2 * conio api test program
6 * 1...0 change text color
7 * F5/F6 change border color
8 * F7/F8 change background color
17 static char grid[5][5] = {
18 { CH_ULCORNER, CH_HLINE, CH_TTEE, CH_HLINE, CH_URCORNER },
19 { CH_VLINE, ' ', CH_VLINE, ' ', CH_VLINE },
20 { CH_LTEE, CH_HLINE, CH_CROSS, CH_HLINE, CH_RTEE },
21 { CH_VLINE, ' ', CH_VLINE, ' ', CH_VLINE },
22 { CH_LLCORNER, CH_HLINE, CH_BTEE, CH_HLINE, CH_LRCORNER },
28 unsigned char xsize, ysize, tcol, bgcol, bcol, inpos = 0;
31 screensize(&xsize, &ysize);
32 cputs("cc65 conio test\n\rInput: [ ]");
34 cputsxy(0, 2, "Colors:" );
35 tcol = textcolor(0); /* remember original textcolor */
36 bgcol = bgcolor(0); /* remember original background color */
37 bcol = bordercolor(0); /* remember original border color */
38 bgcolor(bgcol);bordercolor(bcol);
39 for (i = 0; i < 3; ++i) {
41 for (j = 0; j < 16; ++j) {
48 cprintf("\n\n\r Screensize is: %dx%d", xsize, ysize );
53 cvlinexy(xsize-1,6,3);
54 cputcxy(0,6,CH_ULCORNER);
55 cputcxy(xsize-1,6,CH_URCORNER);
56 cputcxy(0,8,CH_LLCORNER);
57 cputcxy(xsize-1,8,CH_LRCORNER);
59 for (i = 0; i < 5; ++i) {
61 for (j = 0; j < 5; ++j) {
66 gotoxy(0,ysize - 2 - ((256 + xsize) / xsize));
68 for (i = 0; i < xsize; ++i) {
72 for (i = 0; i < 256; ++i) {
73 if ((i != '\n') && (i != '\r')) {
83 for (i = 0; i < xsize; ++i) {
101 if ((i >= '0') && (i<='9')) {
103 } else if (i == CH_CURS_LEFT) {
104 inpos = (inpos - 1) & 7;
105 } else if (i == CH_CURS_RIGHT) {
106 inpos = (inpos + 1) & 7;
107 } else if (i == CH_F5) {
108 bgcol = (bgcol + 1) & 0x0f;
110 } else if (i == CH_F6) {
111 bgcol = (bgcol - 1) & 0x0f;
113 } else if (i == CH_F7) {
114 bgcol = (bgcol + 1) & 0x0f;
116 } else if (i == CH_F8) {
117 bgcol = (bgcol - 1) & 0x0f;
121 inpos = (inpos + 1) & 7;