summaryrefslogtreecommitdiff
path: root/as/type.h
blob: 171790e9d8d0b02b1f9bf7c5331b8dfe478e7d32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/* type.h - types for assembler */

typedef unsigned short u2_t;
typedef unsigned u2_pt;
typedef unsigned long u4_t;
typedef unsigned long u4_pt;

/* redefine foo_t's because their use has become non-portable */

#define bool_t bool_T
#define count_t count_T
#define fd_t fd_T
#define indcount_t indcount_T
#define offset_t offset_T
#define opcode_t opcode_T
#define opsize_t opsize_T
#define scale_t scale_T
#define sem_t sem_T
#define smallcount_t smallcount_T
#define soffset_t soffset_T

typedef unsigned char bool_t;
typedef int bool_pt;
typedef unsigned count_t;
typedef int fd_t;
typedef unsigned char indcount_t;
#ifdef I80386
typedef unsigned long offset_t;
typedef long soffset_t;
# define SIZEOF_OFFSET_T 4	/* non-portable */
#endif
#ifdef MC6809
typedef unsigned offset_t;
typedef int soffset_t;
# define SIZEOF_OFFSET_T 2	/* but sizeof (offset_t) often breaks cpp */
#endif
typedef int opcode_pt;
typedef unsigned char opcode_t;
typedef int opsize_pt;
typedef unsigned char opsize_t;
typedef unsigned reg_pt;
typedef unsigned char scale_t;
typedef unsigned char smallcount_t;
typedef /* signed */ char sem_t;
typedef unsigned u16_pt;
typedef unsigned short u16_T;
typedef unsigned long u32_T;

/* symbol table entry */

struct sym_s
{
    struct sym_s *next;		/* next symbol in hash chain (NUL_PTR if none) */
				/* zero offset because it is accessed most */
    unsigned char type;
    unsigned char data;		/* flags valid for expressions as well as syms*/
    union
    {
	offset_t value;		/* value, if sym is a label */
	unsigned char reg;	/* register code, if sym is a register */
	struct
	{
	    unsigned char routine;	/* routine number */
	    opcode_t opcode;	/* opcode, if sym is a hardware op */
	}
	    op;			/* if sym is pseudo-op or hardware op */
    }
        value_reg_or_op;
    unsigned char length;	/* length of symbol string */
    char name[1];		/* string of variable length */
};

/* address */

struct address_s
{
    offset_t offset;
    unsigned char data;
    struct sym_s *sym;
};

#ifdef I80386

/* effective address */

struct ea_s
{
    indcount_t indcount;
    opsize_t size;
    reg_pt base;
    reg_pt index;
    scale_t scale;
    struct address_s displ;
};

#endif

/* flags */

struct flags_s
{
    bool_t global;
    bool_t current;
    int semaphore;
};

/* location counter */

struct lc_s
{
    unsigned char data;
    offset_t lc;
};

/* string chain */

struct schain_s
{
    struct schain_s *next;
    char string[2];		/* variable length */
};

/* block stack */

struct block_s
{
    unsigned char data;
    unsigned char dp;
    offset_t lc;
};

/* if stack */

struct if_s
{
    bool_t ifflag;
    bool_t elseflag;
};

/* macro stack */

struct macro_s
{
    char *text;
    struct schain_s *parameters;
};

/* symbol listing format */

struct sym_listing_s
{
    char name[SYMLIS_NAMELEN];
    char zname[2];
    char segm[1];
    char pad1[1];
    char value[4];
    char pad2[1];
    char ar[1];
    char pad3[1];
    char cein[1];
    char pad4[1];
    char nullterm;
};

#if __STDC__
typedef void (*pfv)(void);
#else
typedef void (*pfv)();
#endif

#include "proto.h"