1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-17 09:07:32 +00:00
cc65/targettest/gamate/ctest.c

51 lines
1.2 KiB
C
Raw Normal View History

2015-11-29 00:14:59 +00:00
#include <gamate.h>
#include <time.h>
#include <conio.h>
unsigned char y = 0;
unsigned char x = 0;
2015-11-29 00:14:59 +00:00
unsigned short n;
2021-12-25 20:21:01 +00:00
void main(void)
2015-11-29 00:14:59 +00:00
{
clrscr();
2015-11-29 00:24:01 +00:00
gotoxy(0,0);cputs("Gamate C-Test");
2015-11-29 00:14:59 +00:00
textcolor(0);gotoxy(0,5);cputs("abcdABCD 0");
textcolor(1);gotoxy(0,6);cputs("abcdABCD 1");
textcolor(2);gotoxy(0,7);cputs("abcdABCD 2");
textcolor(3);gotoxy(0,8);cputs("abcdABCD 3");
while(1) {
textcolor(COLOR_BLACK);
n = clock();
gotoxy(0,2);cprintf("%04x %02x %02x %02x", n, x, y, *((unsigned char*)JOY_DATA));
2015-11-29 00:14:59 +00:00
switch((*((unsigned char*)JOY_DATA))) {
2020-08-26 13:59:52 +00:00
case 0xff ^ JOY_UP_MASK:
++y; if (y == 0xc8) y = 0;
2015-11-29 00:14:59 +00:00
break;
2020-08-26 13:59:52 +00:00
case 0xff ^ JOY_DOWN_MASK:
--y; if (y == 0xff) y = 0xc7;
2015-11-29 00:14:59 +00:00
break;
2020-08-26 13:59:52 +00:00
case 0xff ^ JOY_LEFT_MASK:
2015-11-29 00:14:59 +00:00
++x;
break;
2020-08-26 13:59:52 +00:00
case 0xff ^ JOY_RIGHT_MASK:
2015-11-29 00:14:59 +00:00
--x;
break;
2020-08-26 13:59:52 +00:00
case 0xff ^ JOY_BTN_A_MASK:
2015-11-29 00:14:59 +00:00
break;
}
2017-07-17 21:15:05 +00:00
waitvsync();
2015-11-29 00:14:59 +00:00
(*((unsigned char*)LCD_XPOS)) = x;
(*((unsigned char*)LCD_YPOS)) = y;
}
}