]> git.sur5r.net Git - c128-kasse/blobdiff - include/general.h
Implement space completion when selling items.
[c128-kasse] / include / general.h
index 3c76062c6d78de4ebc3f2c6f2393c6018457e7b1..768b01c77a65029d9da04ffa685dda9cc5dcc23b 100644 (file)
@@ -1,8 +1,14 @@
 #ifndef GENERAL_H_
 #define GENERAL_H_
 typedef unsigned char BYTE;
-char *get_input();
-char retry_or_quit();
+typedef enum {
+       INPUT_TERMINATOR_RETURN       = (1 << 0),
+       INPUT_TERMINATOR_SPACE        = (1 << 1),
+} input_terminator_t;
+typedef input_terminator_t input_terminator_mask_t;
+input_terminator_t get_input_terminated_by(input_terminator_mask_t terminators, char *out, BYTE outlen);
+char *get_input(void);
+char retry_or_quit(void);
 char *format_euro(char * s, int maxlen, int cent);
 void c128_perror(BYTE, char*);
 extern BYTE _oserror;
@@ -11,6 +17,44 @@ extern BYTE _oserror;
 #define PEEK(addr)         (*(unsigned char*) (addr))
 #define PEEKW(addr)        (*(unsigned*) (addr))
 
+/* C128 color codes, see PDF page 127 of
+ * http://www.pagetable.com/docs/Commodore%20128%20Programmer%27s%20Reference%20Guide.pdf */
+#define TC_BLACK        0
+#define TC_WHITE        1
+#define TC_RED          2
+#define TC_CYAN         3
+#define TC_PURPLE       4
+#define TC_GREEN        5
+#define TC_BLUE         6
+#define TC_YELLOW       7
+#define TC_ORANGE       8
+#define TC_BROWN        9
+/* This is the good red */
+#define TC_LIGHT_RED   10
+#define TC_DARK_GRAY   11
+#define TC_MEDIUM_GRAY 12
+/* This is the good green */
+#define TC_LIGHT_GREEN 13
+#define TC_LIGHT_BLUE  14
+#define TC_LIGHT_GRAY  15
+
+/* Carriage return */
+#define PETSCII_CR  13
+/* Delete */
+#define PETSCII_DEL 20
+/* Space */
+#define PETSCII_SP  32
+#define PETSCII_0   48
+#define PETSCII_1   49
+#define PETSCII_2   50
+#define PETSCII_3   51
+#define PETSCII_4   52
+#define PETSCII_5   53
+#define PETSCII_6   54
+#define PETSCII_7   55
+#define PETSCII_8   56
+#define PETSCII_9   57
+
 #define VIDEOMODE (((* (BYTE *)0xD7) == 0x80) ? 80 : 40)
 
 /* because there is no macro expansion when stringifying, we need to use two