mirror of
https://github.com/cc65/cc65.git
synced 2024-09-28 10:55:43 +00:00
added a second test that checks all available characters (including inverse)
This commit is contained in:
parent
f99a44d8e1
commit
3558c0796d
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
#if defined(__C64__)
|
#if defined(__C64__)
|
||||||
#define VRAMPEEK(x) (*(char*)(0x0400 + (x)))
|
#define VRAMPEEK(x) (*(char*)(0x0400 + (x)))
|
||||||
|
#define VRAMPOKE(x, y) *(char*)(0x0400 + (x)) = (y)
|
||||||
|
#define CRAMPEEK(x) ((*(char*)(0xd800 + (x))) & 15)
|
||||||
#define CRAMPOKE(x, y) *(char*)(0xd800 + (x)) = (y)
|
#define CRAMPOKE(x, y) *(char*)(0xd800 + (x)) = (y)
|
||||||
#else
|
#else
|
||||||
#error "this target is not supported yet"
|
#error "this target is not supported yet"
|
||||||
@ -78,5 +80,83 @@ int main(void)
|
|||||||
bordercolor(COLOR_GREEN);
|
bordercolor(COLOR_GREEN);
|
||||||
cputs("all fine");
|
cputs("all fine");
|
||||||
}
|
}
|
||||||
|
cputs(" - press a key ");
|
||||||
|
cursor(1);
|
||||||
|
cgetc();
|
||||||
|
cursor(0);
|
||||||
|
|
||||||
|
clrscr();
|
||||||
|
bordercolor(COLOR_BLACK);
|
||||||
|
|
||||||
|
/* output all characters directly to the scree */
|
||||||
|
c = 0;
|
||||||
|
for (y = 0; y < 16; y++) {
|
||||||
|
for (x = 0; x < 16; x++) {
|
||||||
|
VRAMPOKE((y * 40) + x, c);
|
||||||
|
CRAMPOKE((y * 40) + x, c & 15);
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* read the characters with conio peek functions and output with conio */
|
||||||
|
for (y = 0; y < 16; y++) {
|
||||||
|
for (x = 0; x < 16; x++) {
|
||||||
|
gotoxy(x, y);
|
||||||
|
c1 = cpeekc();
|
||||||
|
c2 = cpeekrevers();
|
||||||
|
c = cpeekcolor();
|
||||||
|
|
||||||
|
gotoxy(x + 0x14, y);
|
||||||
|
revers(c2);
|
||||||
|
textcolor(c);
|
||||||
|
cputc(c1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
revers(0);
|
||||||
|
textcolor(COLOR_WHITE);
|
||||||
|
gotoxy(0, 17);
|
||||||
|
cputs("press a key to compare ");
|
||||||
|
cursor(1);
|
||||||
|
cgetc();
|
||||||
|
cursor(0);
|
||||||
|
|
||||||
|
/* compare the two outputs */
|
||||||
|
for (y = 0; y < 16; y++) {
|
||||||
|
for (x = 0; x < 16; x++) {
|
||||||
|
c = COLOR_GREEN;
|
||||||
|
c1 = VRAMPEEK((y * 40) + x);
|
||||||
|
c2 = VRAMPEEK((y * 40) + x + 0x14);
|
||||||
|
if (c1 != c2) {
|
||||||
|
c = COLOR_RED;
|
||||||
|
err = 1;
|
||||||
|
}
|
||||||
|
c1 = CRAMPEEK((y * 40) + x);
|
||||||
|
c2 = CRAMPEEK((y * 40) + x + 0x14);
|
||||||
|
if (c1 != c2) {
|
||||||
|
c = COLOR_RED;
|
||||||
|
err = 1;
|
||||||
|
}
|
||||||
|
CRAMPOKE((y * 40) + x, c);
|
||||||
|
CRAMPOKE((y * 40) + x + 0x14, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* show the result */
|
||||||
|
revers(0);
|
||||||
|
textcolor(COLOR_WHITE);
|
||||||
|
gotoxy(0, 17);
|
||||||
|
if (err) {
|
||||||
|
bordercolor(COLOR_RED);
|
||||||
|
cputs("errors detected");
|
||||||
|
} else {
|
||||||
|
bordercolor(COLOR_GREEN);
|
||||||
|
cputs("all fine");
|
||||||
|
}
|
||||||
|
cputs(" - press a key ");
|
||||||
|
cursor(1);
|
||||||
|
cgetc();
|
||||||
|
cursor(0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user