Pristine Ack-5.5
[Ack-5.5.git] / mach / 6800 / as / mach4.c
1 #define RCSID4 "$Id: mach4.c,v 3.3 1994/06/24 12:55:21 ceriel Exp $"
2
3 /*
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".
6  *
7  */
8
9 /*
10  * Motorola 6800 parsing rules
11  */
12
13 operation
14         :
15                 NOARG
16                         {       emit1($1);}
17         |
18                 BRANCH expr
19                         {       branch($1,$2);}
20         |
21                 XOP '#' expr
22                         {       emit1($1 - 0x20);
23                                 switch ($1 & 0x0F) {
24                                 case 0x03:
25                                 case 0x0C:
26                                 case 0x0E:
27 #ifdef RELOCATION
28                                                 newrelo($3.typ, RELBR | RELO2);
29 #endif
30                                                 emit2($3.val);
31                                                 break;
32                                 default:
33 #ifdef RELOCATION
34                                                 newrelo($3.typ, RELO1);
35 #endif
36                                                 emit1($3.val);
37                                 }
38                         }
39         |
40                 XOP '<' expr
41                         {       emit1($1 - 0x10);
42 #ifdef RELOCATION
43                                 newrelo($3.typ, RELO1);
44 #endif
45                                 emit1($3.val);
46                         }
47         |
48                 memref expr
49                         {       emit1($1 + 0x10);
50 #ifdef RELOCATION
51                                 newrelo($2.typ, RELO2);
52 #endif
53                                 emit2($2.val);
54                         }
55         |
56                 memref expr ',' X
57                         {       emit1($1);
58 #ifdef RELOCATION
59                                 newrelo($2.typ, RELO1);
60 #endif
61                                 emit1($2.val);
62                         }
63         ;
64 memref  :
65                 AOP
66         |
67                 XOP
68         ;