]> git.sur5r.net Git - cc65/blob - include/geos/gstruct.h
9e5f0ddda0212786cd7641089b45019b1fae5ef5
[cc65] / include / geos / gstruct.h
1 /*
2   GEOS structs
3
4   by Maciej 'YTM/Elysium' Witkowiak
5 */
6
7 /*
8    apart from initializing data, structures below can be used to
9    speed up access to data and let cc65 to generate better code
10    e.g. if you have menu defined as TopMenu and you want to change the number of
11    menu items use:
12     ((struct menu*)&TopMenu)->number=newNumber;
13    This will be translated into single lda/sta pair
14 */
15
16 #ifndef _GSTRUCT_H
17 #define _GSTRUCT_H
18
19 typedef void (*void_func) (void);
20
21 struct s_date {                 /* system date & time */
22         char s_year;
23         char s_month;
24         char s_day;
25         char s_hour;
26         char s_minutes;
27         char s_seconds;
28 };
29
30 struct tr_se {                  /* track and sector */
31         char track;
32         char sector;
33 };
34
35 struct fileheader {             /* header block (like fileHeader) */
36         struct tr_se n_block;
37         char icon_desc[3];
38         char icon_pic[63];
39         char dostype;
40         char type;
41         char structure;
42         unsigned load_address;
43         unsigned end_address;
44         unsigned exec_address;
45         char class_name[19];
46         char column_flag;
47         char author[63];
48         char note[96];
49 };
50
51 #ifdef __GEOS_CBM__
52
53 struct f_date {                 /* date in filedesctiptor */
54         char f_year;
55         char f_month;
56         char f_day;
57         char f_hour;
58         char f_minute;
59 };
60
61 struct filehandle {             /* filehandle in directory sectors */
62         char dostype;           /* or in dirEntryBuf               */
63         struct tr_se n_block;
64         char name[16];
65         struct tr_se header;
66         char structure;
67         char type;
68         struct f_date date;
69         unsigned size;
70 };
71
72 #else /* #ifdef __GEOS_CBM__ */
73
74 struct f_date {                 /* date in filedesctiptor */
75         unsigned f_day:5;
76         unsigned f_month:4;
77         unsigned f_year:7;
78         char f_minute;
79         char f_hour;
80 };
81
82 struct filehandle {             /* filehandle in directory sectors */
83         unsigned name_len:4;    /* or in dirEntryBuf               */
84         unsigned structure:4;
85         char name[15];
86         char type;
87         struct tr_se n_block;
88         unsigned size;
89         char byte_size[3];
90         struct f_date date;
91         char version;
92         char min_version;
93         char access;
94         struct tr_se header;
95         struct f_date mod_date;
96         struct tr_se dir_head;
97 };
98
99 #endif /* #ifdef __GEOS_CBM__ */
100
101 struct pixel {                  /* describes point              */
102         unsigned x;
103         char y;
104 };
105
106 struct fontdesc {               /* describes font               */
107         char baseline;
108         char width;
109         char height;
110         char *index_tbl;
111         char *data_ptr;
112 };
113
114 struct window {                 /* describes screen region      */
115         char top;
116         char bot;
117         unsigned left;
118         unsigned right;
119 };
120
121 struct VLIR_info {              /* VLIR information             */
122         char curRecord;         /* currently only used in VLIR  */
123         char usedRecords;       /* as system info (curRecord is mainly of your interest */
124         char fileWritten;
125         unsigned fileSize;
126 };
127
128 struct process {                /* process info, declare table of that type */
129         unsigned pointer;       /* (like: struct process proctab[2]=...    */
130         unsigned jiffies;       /* last entry HAVE TO BE {0,0}              */
131 };
132
133 struct iconpic {                /* icon/encoded bitmap description          */
134         char *pic_ptr;          /* ptr to a photo scrap (or encoded bitmap) */
135         char x;                 /* position in cards (*8 pixels)            */
136         char y;
137         char width;             /* in cards                                 */
138         char heigth;            /* in lines (pixels)                        */
139 };
140
141 struct icondef {                /* icon definition for DoIcons              */
142         char *pic_ptr;          /* ptr to a photo scrap (or encoded bitmap) */
143         char x;                 /* position in cards (*8 pixels)            */
144         char y;
145         char width;             /* of icon (in cards)                       */
146         char heigth;            /* of icon in lines (pixels)                */
147         unsigned proc_ptr;      /* pointer to function handling that icon   */
148 };
149
150 struct icontab {
151         char number;            /* number of declared icons                 */
152         struct pixel mousepos;  /* position of mouse after DoIcons          */
153         struct icondef tab[];   /* table of size declared by icontab.number */
154 };
155
156 struct menuitem {
157         char *name;
158         char type;
159         void *rest;             /* may be ptr to function, or ptr to struct menu (submenu) */
160 };
161
162 struct menu {
163         struct window size;
164         char number;
165         struct menuitem items[];
166 };
167
168 struct inittab {                /* use struct inittab mytab[n] for initram              */
169         unsigned ptr;           /* ptr to 1st byte                                      */
170         char number;            /* number of following bytes                            */
171         char values[];          /* actual string of bytes                               */
172 };
173
174 #endif