File: ostype.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 (46 lines) | stat: -rw-r--r-- 1,193 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
/*
** testprogram for get_ostype() and get_tv() functions
**
** 09-Jul-2004, chris@groessler.org
*/

#include <stdio.h>
#include <atari.h>

int main(void)
{
    unsigned int t, v;
    unsigned char palntsc;
    unsigned char *rev;
    unsigned char minor;
    unsigned char c;

    t = get_ostype();    /* get computer type */
    v = get_tv();        /* get tv system */

    palntsc = (v == AT_PAL);

    minor = (t & AT_OS_TYPE_MINOR) >> 5;
    switch(t & AT_OS_TYPE_MAIN) {
        case AT_OS_UNKNOWN:
        default:
            printf("unknown system type !!\n");
            break;
        case AT_OS_400800:
            if (minor == 1) rev = "A";
            else rev = "B";
            printf("it's a 400/800, %s, Rev. %s\n",palntsc ? "PAL" : "NTSC",rev);
            break;
        case AT_OS_1200XL:
            if (minor == 1) rev = "10";
            else rev = "11";
            printf("it's a 1200XL, %s, Rev. %s\n",palntsc ? "PAL" : "NTSC",rev);
            break;
        case AT_OS_XLXE:
            printf("is'a a XL/XE, %s, Rev. %d\n",palntsc ? "PAL" : "NTSC",minor);
            break;
    }
    printf("hit <RETURN> to continue...\n");
    c = getchar();
    return 0;
}