]> git.sur5r.net Git - cc65/blob - testcode/lib/atari/ostype.c
a3569ec3d540ffb9db3446b2c5592bc9b3b1daf5
[cc65] / testcode / lib / atari / ostype.c
1 /*
2  * testprogram for get_ostype() and get_tv() functions
3  *
4  * 09-Jul-2004, cpg@aladdin.de
5  */
6
7 #include <stdio.h>
8 #include <atari.h>
9
10 int main(void)
11 {
12     unsigned int t, v;
13     unsigned char palntsc;
14     unsigned char *rev;
15     unsigned char minor;
16     unsigned char c;
17
18     t = get_ostype();    /* get computer type */
19     v = get_tv();        /* get tv system */
20
21     palntsc = (v == AT_PAL);
22
23     minor = (t & AT_OS_TYPE_MINOR) >> 5;
24     switch(t & AT_OS_TYPE_MAIN) {
25         case AT_OS_UNKNOWN:
26         default:
27             printf("unknown system type !!\n");
28             break;
29         case AT_OS_400800:
30             if (minor == 1) rev = "A";
31             else rev = "B";
32             printf("it's a 400/800, %s, Rev. %s\n",palntsc ? "PAL" : "NTSC",rev);
33             break;
34         case AT_OS_1200XL:
35             if (minor == 1) rev = "10";
36             else rev = "11";
37             printf("it's a 1200XL, %s, Rev. %s\n",palntsc ? "PAL" : "NTSC",rev);
38             break;
39         case AT_OS_XLXE:
40             printf("is'a a XL/XE, %s, Rev. %d\n",palntsc ? "PAL" : "NTSC",minor);
41             break;
42     }
43     printf("hit <RETURN> to continure...\n");
44     c = getchar();
45 }