llvm-mos-sdk
geos_constants.h
Go to the documentation of this file.
1 /***********************************************************************
2  * geos_constants.h
3  *
4  * This file contains #defines for use in GEOS applications
5  * with llvm-mos C compiler.
6  *
7  * Transcribed from geoProgrammer manual by DiSc.
8  *
9  ***********************************************************************/
10 
11 #ifndef GEOS_CONSTANTS_H
12 #define GEOS_CONSTANTS_H
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 /***********************************************************************
19  * Miscellaneous defines
20  ***********************************************************************/
21 
22 #include <stdbool.h>
23 #include <stdint.h>
24 
25 #define WORD(w) (w & 0xff), (w >> 8)
26 
27 #define STRINGIFY_AUX(x) #x
28 #define STRINGIFY(x) STRINGIFY_AUX(x)
29 
30 
31 /***********************************************************************
32  * Hardware related defines
33  ***********************************************************************/
34 
37 #define RAM_64K 0x30
38 #define IO_IN 0x35
39 #define KRNL_IO_IN 0x36
40 #define KRNL_BAS_IO_IN 0x37
44 #define CIOIN 0x7E
45 #define CRAM64K 0x7F
46 #define CKRNLBASIOIN 0x40
48 #define CKRNLIOIN 0x4E
50 /***********************************************************************
51  * Menu Equates
52  ***********************************************************************/
53 
55 typedef enum {
56  HORIZONTAL = 0b00000000,
57  VERTICAL = 0b10000000,
58  CONSTRAINED = 0b01000000,
59  UN_CONSTRAINED = 0b00000000
61 
63 #define OFF_MY_TOP 0
64 #define OFF_MY_BOT 1
65 #define OFF_MX_LEFT 2
66 #define OFF_MX_RIGHT 4
67 #define OFF_NUM_M_ITEMS 6
68 #define OFF_1ST_M_ITEM 7
72 typedef enum {
73  MENU_ACTION = 0x00,
74  DYN_SUB_MENU = 0x40,
75  SUB_MENU = 0x80
77 
78 /***********************************************************************
79  * Process Related Equates
80  ***********************************************************************/
81 
84 #define SET_RUNABLE 0b10000000
85 #define SET_BLOCKED 0b01000000
86 #define SET_FROZEN 0b00100000
87 #define SET_NOTIMER 0b00010000
89 #define RUNABLE_BIT 7
90 #define BLOCKED_BIT 6
91 #define FROZEN_BIT 5
92 #define NOTIMER_BIT 4
94 /***********************************************************************
95  * Text Equates
96  ***********************************************************************/
97 
100 #define SET_UNDERLINE 0b10000000
101 #define SET_BOLD 0b01000000
102 #define SET_REVERSE 0b00100000
103 #define SET_ITALIC 0b00010000
104 #define SET_OUTLINE 0b00001000
105 #define SET_SUPERSCRIPT 0b00000100
106 #define SET_SUBSCRIPT 0b00000010
107 #define SET_PLAINTEXT 0b00000000
108 
109 #define UNDERLINE_BIT 7
110 #define BOLD_BIT 6
111 #define REVERSE_BIT 5
112 #define ITALIC_BIT 4
113 #define OUTLINE_BIT 3
114 #define SUPERSCRIPT_BIT 2
115 #define SUBSCRIPT_BIT 1
116 
119 #define EOF 0
120 #define BACKSPACE 8
121 #define TAB 9
122 #define FORWARDSPACE 9
123 #define LF 10
124 #define HOME 11
125 #define UPLINE 12
126 #define PAGE_BREAK 12
127 #define CR 13
128 #define ULINEON 14
129 #define ULINEOFF 15
130 #define ESC_GRAPHICS 16
131 #define ESC_RULER 17
132 #define REV_ON 18
133 #define REV_OFF 19
134 #define GOTOX 20
135 #define GOTOY 21
136 #define GOTOXY 22
137 #define NEWCARDSET 23
138 #define BOLDON 24
139 #define ITALICON 25
140 #define OUTLINEON 26
141 #define PLAINTEXT 27
142 #define USELAST 127
143 #define SHORTCUT 128
145 /***********************************************************************
146  * Keyboard Equates
147  ***********************************************************************/
148 
149 #define KEY_INVALID 31
150 #define KEY_F1 1
151 #define KEY_F2 2
152 #define KEY_F3 3
153 #define KEY_F4 4
154 #define KEY_F5 5
155 #define KEY_F6 6
156 #define KEY_NOSCRL 7
157 #define KEY_TAB 9
158 #define KEY_LF 10
159 #define KEY_ENTER 11
160 #define KEY_F7 14
161 #define KEY_F8 15
162 #define KEY_UP 16
163 #define KEY_DOWN 17
164 #define KEY_HOME 18
165 #define KEY_CLEAR 19
166 #define KEY_LARROW 20
167 #define KEY_UPARROR 21
168 #define KEY_STOP 22
169 #define KEY_RUN 23
170 #define KEY_BPS 24
171 #define KEY_LEFT BACKSPACE
172 #define KEY_HELP 25
173 #define KEY_ALT 26
174 #define KEY_ESC 27
175 #define KEY_RIGHT 30
176 #define KEY_DELETE 29
177 #define KEY_INSERT 28
178 
179 /***********************************************************************
180  * Mouse Equates
181  ***********************************************************************/
182 
185 #define SET_MSE_ON 0b10000000
186 #define SET_MENUON 0b01000000
187 #define SET_ICONSON 0b00100000
188 
189 #define MOUSEON_BIT 7
190 #define MENUON_BIT 6
191 #define ICONSON_BIT 5
192 
193 /***********************************************************************
194  * Graphics/Screen Equates
195  ***********************************************************************/
196 
199 #define SC_BYTE_WIDTH 40
200 #define SC_PIX_HEIGHT 200
202 #define SC_PIX_WIDTH 320
203 #define SC_SIZE 8000
207 #define SCREENBYTEWIDTH 80
208 #define SCREENPIXELWIDTH 640
214 #define ST_WR_FORE 0x80
215 #define ST_WR_BACK 0x40
216 #define ST_WRGS_FORE 0x20
220 #define MOVEPENTO 1
221 #define LINETO 2
222 #define RECTANGLETO 3
223 #define NEWPATTERN 5
224 #define ESC_PUTSTRING 6
225 #define FRAME_RECTO 7
226 #define PEN_X_DELTA 8
227 #define PEN_Y_DELTA 9
228 #define PEN_XY_DELTA 10
232 #define BLACK 0
233 #define WHITE 1
234 #define RED 2
235 #define CYAN 3
236 #define PURPLE 4
237 #define GREEN 5
238 #define BLUE 6
239 #define YELLOW 7
240 #define ORANGE 8
241 #define BROWN 9
242 #define LTRED 10
243 #define DKGREY 11
244 #define GREY 12
245 #define MEDGREY 12
246 #define LTGREEN 13
247 #define LTBLUE 14
248 #define LTGREY 15
249 
252 #define SET_LEFTJUST 0b10000000
253 #define SET_RIGHTJUST 0b00000000
254 #define SET_SURPRESS 0b01000000
255 #define SET_NOSURPRESS 0b00000000
257 /***********************************************************************
258  * Menu Equates
259  ***********************************************************************/
260 
265 #define ST_FLASH 0x80
266 #define ST_INVERT 0x40
270 #define OFF_NM_ICNS 0
271 #define OFF_IC_XMOUSE 1
272 #define OFF_IC_YMOUSE 3
276 #define OFF_PIC_ICON 0
277 #define OFF_X_ICON_POS 2
278 #define OFF_Y_ICON_POS 3
279 #define OFF_WDTH_ICON 4
280 #define OFF_HEIGHT_ICON 5
281 #define OFF_SRV_RT_ICON 6
282 #define OFF_NX_ICON 8
284 /***********************************************************************
285  * Flag Equates
286  ***********************************************************************/
287 
290 #define KEYPRESS_BIT 7
291 #define INPUT_BIT 6
292 #define MOUSE_BIT 5
294 #define SET_KEYPRESS 0b10000000
295 #define SET_INPUTCHG 0b01000000
296 #define SET_MOUSE 0b00100000
300 #define OFFTOP_BIT 7
301 #define OFFBOTTOM_BIT 6
302 #define OFFLEFT_BIT 5
303 #define OFFRIGHT_BIT 4
304 #define OFFMENU_BIT 3
306 #define SET_OFFTOP 0b10000000
307 #define SET_OFFBOTTOM 0b01000000
308 #define SET_OFFLEFT 0b00100000
309 #define SET_OFFRIGHT 0b00010000
310 #define SET_OFFMENU 0b00001000
312 #define ANY_FAULT 0b11110000
313 
314 /***********************************************************************
315  * GEOS File Type Equates
316  ***********************************************************************/
317 
318 typedef enum {
319  NOT_GEOS = 0,
328  BASIC = 1,
335  ASSEMBLY = 2,
342  DATA = 3,
351  SYSTEM = 4,
352  DESK_ACC = 5,
354  APPL_DATA = 7,
355  FONT = 8,
356  PRINTER = 9,
358  DISK_DEVICE = 11,
359  SYSTEM_BOOT = 12,
361  TEMPORARY = 13,
364  AUTO_EXEC = 14,
366  INPUT_128 = 15,
370 
375 typedef enum {
378  VLIR
382 
384 typedef enum {
385  DEL,
386  SEQ,
387  PRG,
388  USR,
389  REL,
390  CBM
395 
396 #define TOTAL_BLOCKS \
397  664
400 /***********************************************************************
401  * Director Header Equates
402  ***********************************************************************/
403 
406 #define OFF_TO_BAM 4
407 #define OFF_DISK_NAME 144
408 #define OFF_OP_TR_SC \
409  171
411 #define OFF_GS_ID 173
412 #define OFF_GS_DTYPE \
413  189
417 /***********************************************************************
418  * Directory Entry Equates
419  ***********************************************************************/
420 
421 #define ST_WR_PR \
422  0x40
427 #define OFF_CFILE_TYPE 0
428 #define OFF_INDEX_PTR 1
429 #define OFF_DE_TR_SC 1
430 #define OFF_FNAME 3
431 #define OFF_GHDR_PTR 19
432 #define OFF_GSTRUC_TYPE 21
433 #define OFF_GFILE_TYPE 22
434 #define OFF_YEAR 23
435 #define OFF_SIZE 28
436 #define OFF_NXT_FILE 32
440 #define FRST_FILE_ENTRY 2
442 /***********************************************************************
443  * File Header Equates
444  ***********************************************************************/
445 
448 #define O_GHIC_WIDTH 2
449 #define O_GHIC_HEIGHT 3
450 #define O_GHIC_PIC 4
451 #define O_GHCMDR_TYPE 68
452 #define O_GHGEOS_TYPE 69
453 #define O_GHSTR_TYPE 70
454 #define O_GHST_ADDR 71
455 #define O_GHEND_ADDR 73
456 #define O_GHST_VEC 75
457 #define O_GHFNAME 77
459 #define O_128_FLAGS \
460  96
467 #define O_GH_AUTHOR 97
468 #define O_GHINFO_TXT \
469  0xa0
474 #define O_GHP_DISK 97
475 #define O_GHP_FNAME \
476  117
479 /***********************************************************************
480  * GetFile Equates
481  ***********************************************************************/
482 
487 #define ST_LD_AT_ADDR \
488  0x01
491 #define ST_LD_DATA \
492  0x80
497 #define ST_PR_DATA \
498  0x40
504 /***********************************************************************
505  * Disk Equates
506  ***********************************************************************/
507 
508 #define DK_NM_ID_LEN 18
516 #define DRV_NULL 0
517 #define DRV_1541 1
518 #define DRV_1571 2
519 #define DRV_1581 3
520 #define DRV_NETWORK 15
524 #define N_TRACKS 35
525 #define DIR_TRACK 18
526 #define DIR_1581_TRACK \
527  40
532 #define MAX_CMND_STR 32
533 #define DIR_ACC_CHAN 13
534 #define REL_FILE_NUM \
535  9
536 #define CMND_FILE_NUM \
537  15
542 #define TRACK 9
543 #define SECTOR 12
545 /***********************************************************************
546  * Disk Error Equates
547  ***********************************************************************/
548 
551 typedef enum {
552  NO_BLOCKS = 1,
553  INV_TRACK = 2,
554  INSUFF_SPACE = 3,
555  FULL_DIRECTORY = 4,
556  FILE_NOT_FOUND = 5,
557  BAD_BAM = 6,
560  OUT_OF_RECORDS = 9,
561  STRUCT_MISMAT = 10,
562  BFR_OVERFLOW = 11,
563  CANCEL_ERR = 12,
564  DEV_NOT_FOUND = 13,
568  HDR_NOT_THERE = 0x20,
569  NO_SYNC = 0x21,
570  DBLK_NOT_THERE = 0x22,
571  DAT_CHKSUM_ERR = 0x23,
572  WR_VER_ERR = 0x25,
573  WR_PR_ON = 0x26,
574  HDR_CHKSUM_ERR = 0x27,
575  DSK_ID_MISMAT = 0x29,
576  BYTE_DEC_ERR = 0x2e,
577  DOS_MISMATCH = 0x73
579 
580 /***********************************************************************
581  * Dialog Box Equates
582  ***********************************************************************/
583 
584 #define DEF_DB_POS 0x80
585 #define SET_DB_POS 0
589 #define OK \
590  1
595 #define CANCEL 2
596 #define YES 3
597 #define NO 4
598 #define OPEN 5
599 #define DISK 6
600 #define FUTURE1 7
601 #define FUTURE2 8
602 #define FUTURE3 9
603 #define FUTURE4 10
607 #define DBTXTSTR 11
608 #define DBVARSTR 12
609 #define DBGETSTRING 13
610 #define DBSYSOPV 14
611 #define DBGRPHSTR 15
612 #define DBGETFILES 16
613 #define DBOPVEC 17
614 #define DBUSRICON 18
615 #define DB_USR_ROUT 19
619 #define OFF_DB_FORM 0
620 #define OFF_DB_TOP 1
621 #define OFF_DB_BOT 2
622 #define OFF_DB_LEFT 3
623 #define OFF_DB_RIGHT 5
624 #define OFF_DB_1STCMD 7
629 #define SYSDBI_WIDTH 6
630 #define SYSDBI_HEIGHT 16
636 #define DEF_DB_TOP 32
637 #define DEF_DB_BOT 127
638 #define DEF_DB_LEFT 64
639 #define DEF_DB_RIGHT 255
641 #define TXT_LN_X 16
643 #define TXT_LN_1_Y 16
644 #define TXT_LN_2_Y 32
645 #define TXT_LN_3_Y 48
646 #define TXT_LN_4_Y 64
647 #define TXT_LN_5_Y 80
648 
651 #define DBI_X_0 1
652 #define DBI_X_1 9
653 #define DBI_X_2 17
654 #define DBI_Y_0 8
655 #define DBI_Y_1 40
656 #define DBI_Y_2 72
658 /***********************************************************************
659  * Defines for DoDlgBox
660  ***********************************************************************/
661 
662 #define DB_NAME(name) \
663  extern uint8_t name[]; \
664  asm(".type " STRINGIFY(name) ",@object\n.section .data." STRINGIFY( \
665  name) ",\"aw\",@progbits\n" STRINGIFY(name) ":");
666 #define DB_NAME_SECT(name, sect) \
667  extern uint8_t name[]; \
668  asm(".type " STRINGIFY(name) ",@object\n.section ." STRINGIFY( \
669  sect) "." STRINGIFY(name) ",\"aw\",@progbits\n" STRINGIFY(name) ":");
670 #define DB_END(name) \
671  asm(".byte 0\n.size " STRINGIFY(name) ", . - " STRINGIFY(name));
672 #define DB_DEFPOS(pattern) asm(".byte 0x80|" STRINGIFY(pattern));
673 #define DB_SETPOS(pattern, top, bottom, left, right) \
674  asm(".byte " STRINGIFY(pattern) "\n.byte " STRINGIFY( \
675  top) "\n.byte " STRINGIFY(bottom) "\n.word " STRINGIFY(left) "\n." \
676  "word" \
677  " " STRINGIFY( \
678  right));
679 #define DB_ICON(icon, x, y) \
680  asm(".byte " STRINGIFY(icon) "\n.byte " STRINGIFY(x) "\n.byte " STRINGIFY(y));
681 #define DB_TXTSTR(x, y, text) \
682  asm(".byte 11\n.byte " STRINGIFY(x) "\n.byte " STRINGIFY( \
683  y) "\n.short " STRINGIFY(text));
684 #define DB_VARSTR(x, y, zp_ptr) \
685  asm(".byte 12\n.byte " STRINGIFY(x) "\n.byte " STRINGIFY( \
686  y) "\n.byte " STRINGIFY(zp_ptr));
687 #define DB_GETSTR(x, y, zp_ptr, length) \
688  asm(".byte 13\n.byte " STRINGIFY(x) "\n.byte " STRINGIFY( \
689  y) "\n.byte " STRINGIFY(zp_ptr) "\n.byte " STRINGIFY(length));
690 #define DB_SYSOPV() asm(".byte 14");
691 #define DB_GRPHSTR(ptr) asm(".byte 15\n.short " STRINGIFY(ptr));
692 #define DB_GETFILES(x, y) \
693  asm(".byte 16\n.byte " STRINGIFY(x) "\n.byte " STRINGIFY(y));
694 #define DB_OPVEC(ptr) asm(".byte 17\n.short " STRINGIFY(ptr));
695 #define DB_USRICON(x, y, icon_ptr) \
696  asm(".byte 18\n.byte " STRINGIFY(x) "\n.byte " STRINGIFY( \
697  y) "\n.short " STRINGIFY(icon_ptr));
698 #define DB_USRROUT(ptr) asm(".byte 19\n.short " STRINGIFY(ptr));
699 
700 /***********************************************************************
701  * VIC Chip Equates
702  ***********************************************************************/
703 
704 #define GRBANK0 0b11
705 #define GRBANK1 0b10
706 #define GRBANK2 0b01
707 #define GRBANK3 0b00
709 #define MOUSE_SPRNUM 0
711 #define VIC_YPOS_OFF \
712  50
717 #define VIC_XPOS_OFF \
718  24
721 #define ALARMMASK \
722  0b00000100
727 #define FG_SAVE 0b10000000
728 #define CLR_SAVE 0b01000000
730 /***********************************************************************
731  * C128 640 support
732  ***********************************************************************/
733 #define ADD1_W 0x2000
734 #define ADD1_B 0x20
735 #define DOUBLE_W 0x8000
736 #define DOUBLE_B 0x80
737 
738 /***********************************************************************
739  * C128 bsw128
740  ***********************************************************************/
741 #define ARROW 0
742 #define GR_40 0
743 #define GR_80 0x80
745 /***********************************************************************
746  * Unknown
747  ***********************************************************************/
748 
749 #define CLICK_COUNT 30
750 #define DISK_DRV_LGH 0x0d80
751 #define OS_VARS_LGH 0x0500
752 
753 #ifdef __cplusplus
754 }
755 #endif
756 
757 #endif
HDR_NOT_THERE
@ HDR_NOT_THERE
Definition: geos_constants.h:544
INV_RECORD
@ INV_RECORD
Definition: geos_constants.h:535
FULL_DIRECTORY
@ FULL_DIRECTORY
Definition: geos_constants.h:531
SYSTEM_BOOT
@ SYSTEM_BOOT
Definition: geos_constants.h:359
APPL_DATA
@ APPL_DATA
Definition: geos_constants.h:354
HORIZONTAL
@ HORIZONTAL
Definition: geos_constants.h:57
OUT_OF_RECORDS
@ OUT_OF_RECORDS
Definition: geos_constants.h:536
HDR_CHKSUM_ERR
@ HDR_CHKSUM_ERR
Definition: geos_constants.h:550
VERTICAL
@ VERTICAL
Definition: geos_constants.h:58
DAT_CHKSUM_ERR
@ DAT_CHKSUM_ERR
Definition: geos_constants.h:547
AUTO_EXEC
@ AUTO_EXEC
Definition: geos_constants.h:364
UN_CONSTRAINED
@ UN_CONSTRAINED
Definition: geos_constants.h:60
BAD_BAM
@ BAD_BAM
Definition: geos_constants.h:533
CANCEL_ERR
@ CANCEL_ERR
Definition: geos_constants.h:539
FONT
@ FONT
Definition: geos_constants.h:355
menu_type_t
menu_type_t
Definition: geos_constants.h:54
SEQUENTIAL
@ SEQUENTIAL
Definition: geos_constants.h:374
FILE_NOT_FOUND
@ FILE_NOT_FOUND
Definition: geos_constants.h:532
WR_VER_ERR
@ WR_VER_ERR
Definition: geos_constants.h:548
NUMFILETYPES
@ NUMFILETYPES
Definition: geos_constants.h:368
PRG
@ PRG
Definition: geos_constants.h:385
DESK_ACC
@ DESK_ACC
Definition: geos_constants.h:352
DYN_SUB_MENU
@ DYN_SUB_MENU
Definition: geos_constants.h:72
CONSTRAINED
@ CONSTRAINED
Definition: geos_constants.h:59
BASIC
@ BASIC
Definition: geos_constants.h:328
NO_SYNC
@ NO_SYNC
Definition: geos_constants.h:545
DEL
@ DEL
Definition: geos_constants.h:383
dos_file_type_t
dos_file_type_t
Definition: geos_constants.h:382
DOS_MISMATCH
@ DOS_MISMATCH
Definition: geos_constants.h:553
VLIR
@ VLIR
Definition: geos_constants.h:376
INCOMPATIBLE
@ INCOMPATIBLE
Definition: geos_constants.h:541
menu_action_t
menu_action_t
Definition: geos_constants.h:70
INV_TRACK
@ INV_TRACK
Definition: geos_constants.h:529
USR
@ USR
Definition: geos_constants.h:386
DSK_ID_MISMAT
@ DSK_ID_MISMAT
Definition: geos_constants.h:551
file_structure_t
file_structure_t
Definition: geos_constants.h:373
BYTE_DEC_ERR
@ BYTE_DEC_ERR
Definition: geos_constants.h:552
REL
@ REL
Definition: geos_constants.h:387
NOT_GEOS
@ NOT_GEOS
Definition: geos_constants.h:319
TEMPORARY
@ TEMPORARY
Definition: geos_constants.h:361
SEQ
@ SEQ
Definition: geos_constants.h:384
SUB_MENU
@ SUB_MENU
Definition: geos_constants.h:73
SYSTEM
@ SYSTEM
Definition: geos_constants.h:351
disk_err_t
disk_err_t
Definition: geos_constants.h:525
DISK_DEVICE
@ DISK_DEVICE
Definition: geos_constants.h:358
INSUFF_SPACE
@ INSUFF_SPACE
Definition: geos_constants.h:530
geos_file_type_t
geos_file_type_t
Definition: geos_constants.h:316
CBM
@ CBM
Definition: geos_constants.h:388
NO_BLOCKS
@ NO_BLOCKS
Definition: geos_constants.h:528
APPLICATION
@ APPLICATION
Definition: geos_constants.h:353
INPUT_DEVICE
@ INPUT_DEVICE
Definition: geos_constants.h:357
UNOPENED_VLIR
@ UNOPENED_VLIR
Definition: geos_constants.h:534
PRINTER
@ PRINTER
Definition: geos_constants.h:356
WR_PR_ON
@ WR_PR_ON
Definition: geos_constants.h:549
STRUCT_MISMAT
@ STRUCT_MISMAT
Definition: geos_constants.h:537
ASSEMBLY
@ ASSEMBLY
Definition: geos_constants.h:335
DATA
@ DATA
Definition: geos_constants.h:342
MENU_ACTION
@ MENU_ACTION
Definition: geos_constants.h:71
INPUT_128
@ INPUT_128
Definition: geos_constants.h:366
DEV_NOT_FOUND
@ DEV_NOT_FOUND
Definition: geos_constants.h:540
BFR_OVERFLOW
@ BFR_OVERFLOW
Definition: geos_constants.h:538
DBLK_NOT_THERE
@ DBLK_NOT_THERE
Definition: geos_constants.h:546