File: ctest.c

package info (click to toggle)
cc65 2.19-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 20,268 kB
  • sloc: ansic: 117,151; asm: 66,339; pascal: 4,248; makefile: 1,009; perl: 607
file content (52 lines) | stat: -rw-r--r-- 1,211 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

#include <gamate.h>
#include <time.h>
#include <conio.h>

unsigned char y = 0;
unsigned char x = 0;
unsigned short n;

int main(int argc, char *argv[])
{
    clrscr();
    gotoxy(0,0);cputs("Gamate C-Test");

    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));

        switch((*((unsigned char*)JOY_DATA))) {
            case 0xff ^ JOY_DATA_UP:
                ++y; if (y == 0xc8) y = 0;
                break;
            case 0xff ^ JOY_DATA_DOWN:
                --y; if (y == 0xff) y = 0xc7;
                break;
            case 0xff ^ JOY_DATA_LEFT:
                ++x;
                break;
            case 0xff ^ JOY_DATA_RIGHT:
                --x;
                break;
            case 0xff ^ JOY_DATA_FIRE_A:
                break;
        }

        waitvsync();

        (*((unsigned char*)LCD_XPOS)) = x;
        (*((unsigned char*)LCD_YPOS)) = y;

    }

    return 0;
}