]> git.sur5r.net Git - c128-kasse/blob - include/general.h
README: remove emulator configuration, we use -config vicerc
[c128-kasse] / include / general.h
1 #ifndef GENERAL_H
2 #define GENERAL_H
3
4 #include <peekpoke.h>
5 #include <stdint.h>
6 #include "vdc_patch_charset.h"
7
8 typedef unsigned char BYTE;
9 typedef enum {
10   INPUT_TERMINATOR_RETURN = (1 << 0),
11   INPUT_TERMINATOR_SPACE = (1 << 1),
12 } input_terminator_t;
13 typedef input_terminator_t input_terminator_mask_t;
14 input_terminator_t get_input_terminated_by(input_terminator_mask_t terminators,
15                                            char *out, BYTE outlen);
16 char *get_input(void);
17 BYTE cgetn_input(char *s, BYTE len);
18 int16_t cget_number(int16_t default_val);
19 void cget_return(void);
20 uint8_t cget_nickname(char *buf, uint8_t len);
21 char retry_or_quit(void);
22 char *format_euro(char *s, int maxlen, int32_t cent);
23 void c128_perror(BYTE, char *);
24 extern BYTE _oserror;
25
26 /* C128 color codes, see PDF page 127 of
27  * http://www.pagetable.com/docs/Commodore%20128%20Programmer%27s%20Reference%20Guide.pdf
28  */
29 #define TC_BLACK 0
30 #define TC_WHITE 1
31 #define TC_RED 2
32 #define TC_CYAN 3
33 #define TC_PURPLE 4
34 #define TC_GREEN 5
35 #define TC_BLUE 6
36 #define TC_YELLOW 7
37 #define TC_ORANGE 8
38 #define TC_BROWN 9
39 /* This is the good red */
40 #define TC_LIGHT_RED 10
41 #define TC_DARK_GRAY 11
42 #define TC_MEDIUM_GRAY 12
43 /* This is the good green */
44 #define TC_LIGHT_GREEN 13
45 #define TC_LIGHT_BLUE 14
46 #define TC_LIGHT_GRAY 15
47
48 /* Carriage return */
49 #define PETSCII_CR 13
50 /* Delete */
51 #define PETSCII_DEL 20
52 /* Escape */
53 #define PETSCII_ESC 27
54 /* Space */
55 #define PETSCII_SP 32
56 #define PETSCII_0 48
57 #define PETSCII_1 49
58 #define PETSCII_2 50
59 #define PETSCII_3 51
60 #define PETSCII_4 52
61 #define PETSCII_5 53
62 #define PETSCII_6 54
63 #define PETSCII_7 55
64 #define PETSCII_8 56
65 #define PETSCII_9 57
66
67 #define VIDEOMODE (((*(BYTE *)0xD7) == 0x80) ? 80 : 40)
68
69 /* "-999,99€" */
70 #define EUR_FORMAT "%3ld,%02lu" EURSYM
71 #define EUR_FORMAT_MINLEN 8
72
73 /* because there is no macro expansion when stringifying, we need to use two
74  * levels of macros to stringify the value of a macro (for example
75  * MAX_ITEM_NAME_LENGTH) */
76 #define xstr(s) str(s)
77 #define str(s) #s
78
79 #define max(a, b) ((a) > (b) ? (a) : (b))
80 #define min(a, b) ((a) > (b) ? (b) : (a))
81
82 #endif /* GENERAL_H */