6a120691bd6e90153a12a2397b78129ecb48d091
[lugburz] / src / amiga / amigalib.h
1 /* structures and functions necessary to access amiga ROM services */
2 #ifndef AMIGALIB_H_
3 #define AMIGALIB_H_
4
5 #include <stdint.h>
6
7 #define ALIB_MEMF_ANY           0L
8 #define ALIB_MEMF_PUBLIC        0x0001L
9 #define ALIB_MEMF_CHIP          0x0002L
10 #define ALIB_MEMF_FAST          0x0004L
11 #define ALIB_MEMF_CLEAR         0x0100L
12 #define ALIB_MEMF_LARGEST       0x0200L
13 #define ALIB_MEMF_REVERSE       0x0400L
14 #define ALIB_MEMF_TOTAL         0x0800L
15
16 #define ALIB_NODE_COMMON(NODE_TYPE) \
17         NODE_TYPE *n_next; \
18         NODE_TYPE *n_prev; \
19         uint8_t n_type; \
20         int8_t n_prio; \
21         char *n_name
22
23 struct alib_memchunk {
24         struct alib_memchunk *next;
25         uint32_t size;
26 };
27
28 struct alib_memnode {
29         ALIB_NODE_COMMON(struct alib_memnode);
30         uint16_t attrib;
31         struct alib_memchunk *freelist;
32         void *start, *end;
33         uint32_t freesz;
34 };
35
36 struct alib_memlist {
37         struct alib_memnode *head, *tail, *tailpred;
38         uint8_t type;
39         uint8_t pad;
40 };
41
42 struct alib_library {
43         ALIB_NODE_COMMON(struct alib_library);
44         uint8_t flags;
45         uint8_t pad;
46         uint16_t negsz, possz;
47         uint16_t ver_major, ver_minor;
48         char *idstr;
49         uint32_t csum;
50         uint16_t nref;
51 };
52
53 struct alib_intvec {
54         void *data;
55         void (*code)();
56         ALIB_NODE_COMMON(struct alib_intvec);
57 };
58
59 struct alib_execbase {
60         struct alib_library lib;
61         uint16_t softver;
62         int16_t lowmem_csum;
63         uint32_t chkbase;
64         void *coldcap_vect, *coolcap_vect, *warmcap_vect;
65         void *sysstack_upper, *sysstack_lower;
66         uint32_t chipmem_top;
67         void *dbg_entry, *dbg_data, *alert_data;
68         void *extmem_top;
69         uint16_t csum;
70
71         struct alib_intvec intvec[16];
72
73         void *curtask;
74         uint32_t idle_count, disp_count;
75         uint16_t tmslice, nticks;
76         uint16_t sysflags;
77         int8_t intr_dis_nest, task_dis_nest;
78         uint16_t attn_flags, attn_resched;
79         void *resmod;
80         void *tasktrap, *taskexcept, *taks_exit;
81         uint32_t task_sig_alloc;
82         uint16_t task_trap_alloc;
83
84         struct alib_memlist memlist;
85         /* ... more ... */
86 };
87
88 struct alib_execbase *execbase;
89
90 int alib_init(void);
91
92 #endif  /* AMIGALIB_H_ */