]> git.sur5r.net Git - c128-kasse/blob - include/general.h
add color code definitions
[c128-kasse] / include / general.h
1 #ifndef GENERAL_H_
2 #define GENERAL_H_
3 typedef unsigned char BYTE;
4 char *get_input();
5 char retry_or_quit();
6 char *format_euro(char * s, int maxlen, int cent);
7 void c128_perror(BYTE, char*);
8 extern BYTE _oserror;
9 #define POKE(addr,val)     (*(unsigned char*) (addr) = (val))
10 #define POKEW(addr,val)    (*(unsigned*) (addr) = (val))
11 #define PEEK(addr)         (*(unsigned char*) (addr))
12 #define PEEKW(addr)        (*(unsigned*) (addr))
13
14 /* C128 color codes, see PDF page 127 of
15  * http://www.pagetable.com/docs/Commodore%20128%20Programmer%27s%20Reference%20Guide.pdf */
16 #define TC_BLACK        1
17 #define TC_WHITE        2
18 #define TC_RED          3
19 #define TC_CYAN         4
20 #define TC_PURPLE       5
21 #define TC_GREEN        6
22 #define TC_BLUE         7
23 #define TC_YELLOW       8
24 #define TC_ORANGE       9
25 #define TC_BROWN       10
26 /* This is the good red */
27 #define TC_LIGHT_RED   11
28 #define TC_DARK_GRAY   12
29 #define TC_MEDIUM_GRAY 13
30 /* This is the good green */
31 #define TC_LIGHT_GREEN 14
32 #define TC_LIGHT_BLUE  15
33 #define TC_LIGHT_GRAY  16
34
35 #define VIDEOMODE (((* (BYTE *)0xD7) == 0x80) ? 80 : 40)
36
37 /* because there is no macro expansion when stringifying, we need to use two
38  * levels of macros to stringify the value of a macro (for example
39  * MAX_ITEM_NAME_LENGTH) */
40 #define xstr(s) str(s)
41 #define str(s) #s
42
43 #define max(a, b) ((a) > (b) ? (a) : (b))
44 #define min(a, b) ((a) > (b) ? (b) : (a))
45
46 #endif /*GENERAL_H_*/