1 #define RCSID4 "$Id: mach4.c,v 3.5 1994/06/24 12:54:07 ceriel Exp $"
4 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
5 * See the copyright notice in the ACK home directory, in the file "Copyright".
10 * Mostek 6500 parsing tables.
14 /* From the READ_ME file - translation by Albert Koelmans:
17 * De .h en .l extensions van expressies zijn hard nodig.
18 * Ze zorgen er echter ook voor dat er geen relocatable code geproduceerd
19 * kan worden. Beschouw het volgende voorbeeld:
21 * The .h and .l extensions of expressions are vital. However, they prevent
22 * relocatable code from being generated. Consider the following example:
33 * Wat voor relocation struct moet er nu voor de instructie in regel 3
34 * worden geproduceerd?
36 * What kind of relocation structure needs to be generated for the instruction
42 { $$.val = ($1.val >> $2) & 0xFF;
44 $$.typ = combine($1.typ, S_ABS, '&');
45 /* This will generate an 'invalid operator' */
46 /* error if $1.typ is not absolute after pass 1. */
48 $$.typ = $1.typ; /* Even if $1.typ is relocatable, it should be */
49 /* absolute by the final pass. */
50 #endif /* RELOCATION */
61 newrelo($2.typ, RELO2);
68 newrelo($3.typ, RELO2);
75 newrelo($2.typ, RELO2);
82 newrelo($3.typ, RELO1);
87 { code($2,0xA6,0xAE); }
89 { code($2,0xB6,0xBE); }
93 newrelo($3.typ, RELO1);
98 { code($2,0xA4,0xAC); }
100 { code($2,0xB4,0xBC); }
102 { code($2,$1+0x06,$1+0x0E); }
106 newrelo($2.typ, RELO1);
111 { code($2,$1+0x04,$1+0x0C); }
115 newrelo($2.typ, RELO1);
120 { if ($1==0x80) serror("no store immediate");
123 newrelo($3.typ, RELO1);
128 { code($2,$1+0x05,$1+0x0D); }
130 { code($2,$1+0x15,$1+0x1D); }
134 newrelo($2.typ, RELO2);
138 | addop '(' expr ',' X ')'
141 newrelo($3.typ, RELO1);
145 | addop '(' expr ')' ',' Y
148 newrelo($3.typ, RELO1);
152 | ROLOP /* Default is A. */
157 { code($2,$1+0x06,$1+0x0E); }
159 { code($2,$1+0x16,$1+0x1E); }
165 newrelo($3.typ, RELO1);
170 { code($2,$1+0x04,$1+0x0C); }
172 { code($2,$1+0x06,$1+0x0E); }
174 { code($2,$1+0x16,$1+0x1E); }
179 { emit1($1>>8); $$ = $1 & 0xFF; }