Commit | Line | Data |
---|---|---|
1a3b21a9 DR |
1 | /* |
2 | * Header for object code improver | |
3 | */ | |
4 | ||
5 | #include <stdio.h> | |
6 | ||
7 | #define JBR 1 | |
8 | #define CBR 2 | |
9 | #define JMP 3 | |
10 | #define LABEL 4 | |
11 | #define DLABEL 5 | |
12 | #define EROU 7 | |
13 | #define JSW 9 | |
14 | #define MOV 10 | |
15 | #define CLR 11 | |
16 | #define COM 12 | |
17 | #define INC 13 | |
18 | #define DEC 14 | |
19 | #define NEG 15 | |
20 | #define TST 16 | |
21 | #define ASR 17 | |
22 | #define ASL 18 | |
23 | #define SXT 19 | |
24 | #define CMP 20 | |
25 | #define ADD 21 | |
26 | #define SUB 22 | |
27 | #define BIT 23 | |
28 | #define BIC 24 | |
29 | #define BIS 25 | |
30 | #define MUL 26 | |
31 | #define DIV 27 | |
32 | #define ASH 28 | |
33 | #define XOR 29 | |
34 | #define TEXT 30 | |
35 | #define DATA 31 | |
36 | #define BSS 32 | |
37 | #define EVEN 33 | |
38 | #define MOVF 34 | |
39 | #define MOVOF 35 | |
40 | #define MOVFO 36 | |
41 | #define ADDF 37 | |
42 | #define SUBF 38 | |
43 | #define DIVF 39 | |
44 | #define MULF 40 | |
45 | #define CLRF 41 | |
46 | #define CMPF 42 | |
47 | #define NEGF 43 | |
48 | #define TSTF 44 | |
49 | #define CFCC 45 | |
50 | #define SOB 46 | |
51 | #define JSR 47 | |
52 | #define END 48 | |
53 | ||
54 | #define JEQ 0 | |
55 | #define JNE 1 | |
56 | #define JLE 2 | |
57 | #define JGE 3 | |
58 | #define JLT 4 | |
59 | #define JGT 5 | |
60 | #define JLO 6 | |
61 | #define JHI 7 | |
62 | #define JLOS 8 | |
63 | #define JHIS 9 | |
64 | ||
65 | #define BYTE 100 | |
66 | #define LSIZE 512 | |
67 | ||
68 | struct node { | |
69 | char op; | |
70 | char subop; | |
71 | struct node *forw; | |
72 | struct node *back; | |
73 | struct node *ref; | |
74 | int labno; | |
75 | char *code; | |
76 | int refc; | |
77 | }; | |
78 | ||
79 | struct optab { | |
80 | char *opstring; | |
81 | int opcode; | |
82 | } optab[]; | |
83 | ||
84 | char line[LSIZE]; | |
85 | struct node first; | |
86 | char *curlp; | |
87 | int nbrbr; | |
88 | int nsaddr; | |
89 | int redunm; | |
90 | int iaftbr; | |
91 | int njp1; | |
92 | int nrlab; | |
93 | int nxjump; | |
94 | int ncmot; | |
95 | int nrevbr; | |
96 | int loopiv; | |
97 | int nredunj; | |
98 | int nskip; | |
99 | int ncomj; | |
100 | int nsob; | |
101 | int nrtst; | |
102 | int nlit; | |
103 | ||
104 | int nchange; | |
105 | int isn; | |
106 | int debug; | |
107 | int lastseg; | |
108 | char *lasta; | |
109 | char *lastr; | |
110 | char *firstr; | |
111 | char revbr[]; | |
112 | char regs[12][20]; | |
113 | char conloc[20]; | |
114 | char conval[20]; | |
115 | char ccloc[20]; | |
116 | ||
117 | #define RT1 10 | |
118 | #define RT2 11 | |
119 | #define FREG 5 | |
120 | #define NREG 5 | |
121 | #define LABHS 127 | |
122 | #define OPHS 57 | |
123 | ||
124 | struct optab *ophash[OPHS]; | |
125 | struct node *nonlab(); | |
126 | char *copy(); | |
127 | char *sbrk(); | |
128 | char *findcon(); | |
129 | struct node *insertl(); | |
130 | struct node *codemove(); | |
131 | char *sbrk(); | |
132 | char *alloc(); |