]>
Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* |
060d22b0 | 2 | Copyright 2001 Free Software Foundation, Inc. |
252b5132 | 3 | |
060d22b0 | 4 | This file is part of GNU Binutils. |
252b5132 | 5 | |
060d22b0 NC |
6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
252b5132 | 10 | |
060d22b0 NC |
11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
252b5132 | 15 | |
060d22b0 NC |
16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
252b5132 RH |
19 | |
20 | /* This program generates z8k-opc.h */ | |
21 | ||
28bab82b | 22 | #include <stdio.h> |
252b5132 RH |
23 | #include "sysdep.h" |
24 | ||
25 | #define BYTE_INFO_LEN 10 | |
26 | ||
27 | struct op | |
28 | { | |
29 | char *flags; | |
30 | int cycles; | |
31 | char type; | |
32 | char *bits; | |
33 | char *name; | |
34 | char *flavor; | |
35 | }; | |
36 | ||
37 | #define iswhite(x) ((x) == ' ' || (x) == '\t') | |
38 | struct op opt[] = | |
39 | { | |
40 | "------", 10, 8, "0000 1110 imm8", "ext0e imm8", 0, | |
41 | "------", 10, 8, "0000 1111 imm8", "ext0f imm8", 0, | |
42 | "------", 10, 8, "1000 1110 imm8", "ext8e imm8", 0, | |
43 | "------", 10, 8, "1000 1111 imm8", "ext8f imm8", 0, | |
44 | ||
45 | "------", 10, 8, "0011 0110 imm8", "rsvd36", 0, | |
46 | "------", 10, 8, "0011 1000 imm8", "rsvd38", 0, | |
47 | "------", 10, 8, "0111 1000 imm8", "rsvd78", 0, | |
48 | "------", 10, 8, "0111 1110 imm8", "rsvd7e", 0, | |
49 | ||
50 | "------", 10, 8, "1001 1101 imm8", "rsvd9d", 0, | |
51 | "------", 10, 8, "1001 1111 imm8", "rsvd9f", 0, | |
52 | ||
53 | "------", 10, 8, "1011 1001 imm8", "rsvdb9", 0, | |
54 | "------", 10, 8, "1011 1111 imm8", "rsvdbf", 0, | |
55 | ||
6840198f NC |
56 | "---V--", 11, 16, "1011 1011 ssN0 1001 0000 rrrr ddN0 1000", "ldd @rd,@rs,rr", 0, |
57 | "---V--", 11, 16, "1011 1011 ssN0 1001 0000 rrrr ddN0 0000", "lddr @rd,@rs,rr", 0, | |
58 | "---V--", 11, 8, "1011 1010 ssN0 1001 0000 rrrr ddN0 0000", "lddrb @rd,@rs,rr", 0, | |
252b5132 RH |
59 | "---V--", 11, 16, "1011 1011 ssN0 0001 0000 rrrr ddN0 0000", "ldir @rd,@rs,rr", 0, |
60 | "CZSV--", 11, 16, "1011 1011 ssN0 0000 0000 rrrr dddd cccc", "cpi rd,@rs,rr,cc", 0, | |
61 | "CZSV--", 11, 16, "1011 1011 ssN0 0100 0000 rrrr dddd cccc", "cpir rd,@rs,rr,cc", 0, | |
62 | "CZSV--", 11, 16, "1011 1011 ssN0 1100 0000 rrrr dddd cccc", "cpdr rd,@rs,rr,cc", 0, | |
63 | "---V--", 11, 16, "1011 1011 ssN0 0001 0000 rrrr ddN0 1000", "ldi @rd,@rs,rr", 0, | |
64 | "CZSV--", 11, 16, "1011 1011 ssN0 1000 0000 rrrr dddd cccc", "cpd rd,@rs,rr,cc", 0, | |
65 | "---V--", 11, 8, "1011 1010 ssN0 0001 0000 rrrr ddN0 0000", "ldirb @rd,@rs,rr", 0, | |
6840198f | 66 | "---V--", 11, 8, "1011 1010 ssN0 1001 0000 rrrr ddN0 1000", "lddb @rd,@rs,rr", 0, |
252b5132 RH |
67 | "---V--", 11, 8, "1011 1010 ssN0 0001 0000 rrrr ddN0 1000", "ldib @rd,@rs,rr", 0, |
68 | "CZSV--", 11, 8, "1011 1010 ssN0 1000 0000 rrrr dddd cccc", "cpdb rbd,@rs,rr,cc", 0, | |
69 | "CZSV--", 11, 8, "1011 1010 ssN0 1100 0000 rrrr dddd cccc", "cpdrb rbd,@rs,rr,cc", 0, | |
70 | "CZSV--", 11, 8, "1011 1010 ssN0 0000 0000 rrrr dddd cccc", "cpib rbd,@rs,rr,cc", 0, | |
71 | "CZSV--", 11, 8, "1011 1010 ssN0 0100 0000 rrrr dddd cccc", "cpirb rbd,@rs,rr,cc", 0, | |
72 | "CZSV--", 11, 16, "1011 1011 ssN0 1010 0000 rrrr ddN0 cccc", "cpsd @rd,@rs,rr,cc", 0, | |
73 | "CZSV--", 11, 8, "1011 1010 ssN0 1010 0000 rrrr ddN0 cccc", "cpsdb @rd,@rs,rr,cc", 0, | |
74 | "CZSV--", 11, 16, "1011 1011 ssN0 1110 0000 rrrr ddN0 cccc", "cpsdr @rd,@rs,rr,cc", 0, | |
75 | "CZSV--", 11, 8, "1011 1010 ssN0 1110 0000 rrrr ddN0 cccc", "cpsdrb @rd,@rs,rr,cc", 0, | |
76 | "CZSV--", 11, 16, "1011 1011 ssN0 0010 0000 rrrr ddN0 cccc", "cpsi @rd,@rs,rr,cc", 0, | |
77 | "CZSV--", 11, 8, "1011 1010 ssN0 0010 0000 rrrr ddN0 cccc", "cpsib @rd,@rs,rr,cc", 0, | |
78 | "CZSV--", 11, 16, "1011 1011 ssN0 0110 0000 rrrr ddN0 cccc", "cpsir @rd,@rs,rr,cc", 0, | |
79 | "CZSV--", 11, 8, "1011 1010 ssN0 0110 0000 rrrr ddN0 cccc", "cpsirb @rd,@rs,rr,cc", 0, | |
80 | ||
81 | "------", 2, 8, "0011 0110 0000 0000", "bpt", 0, | |
82 | "CZSV--", 5, 16, "1011 0101 ssss dddd", "adc rd,rs", 0, | |
83 | "CZSVDH", 5, 8, "1011 0100 ssss dddd", "adcb rbd,rbs", 0, | |
84 | "CZSV--", 7, 16, "0000 0001 ssN0 dddd", "add rd,@rs", 0, | |
28bab82b | 85 | "CZSV--", 9, 16, "0100 0001 0000 dddd address_src", "add rd,address_src", 0, |
252b5132 RH |
86 | "CZSV--", 10, 16, "0100 0001 ssN0 dddd address_src", "add rd,address_src(rs)", 0, |
87 | "CZSV--", 7, 16, "0000 0001 0000 dddd imm16", "add rd,imm16", 0, | |
88 | "CZSV--", 4, 16, "1000 0001 ssss dddd", "add rd,rs", 0, | |
89 | "CZSVDH", 7, 8, "0000 0000 ssN0 dddd", "addb rbd,@rs", 0, | |
28bab82b | 90 | "CZSVDH", 9, 8, "0100 0000 0000 dddd address_src", "addb rbd,address_src", 0, |
252b5132 RH |
91 | "CZSVDH", 10, 8, "0100 0000 ssN0 dddd address_src", "addb rbd,address_src(rs)", 0, |
92 | "CZSVDH", 7, 8, "0000 0000 0000 dddd imm8 imm8", "addb rbd,imm8", 0, | |
93 | "CZSVDH", 4, 8, "1000 0000 ssss dddd", "addb rbd,rbs", 0, | |
94 | "CZSV--", 14, 32, "0001 0110 ssN0 dddd", "addl rrd,@rs", 0, | |
95 | "CZSV--", 15, 32, "0101 0110 0000 dddd address_src", "addl rrd,address_src", 0, | |
96 | "CZSV--", 16, 32, "0101 0110 ssN0 dddd address_src", "addl rrd,address_src(rs)", 0, | |
97 | "CZSV--", 14, 32, "0001 0110 0000 dddd imm32", "addl rrd,imm32", 0, | |
98 | "CZSV--", 8, 32, "1001 0110 ssss dddd", "addl rrd,rrs", 0, | |
99 | ||
100 | "-ZS---", 7, 16, "0000 0111 ssN0 dddd", "and rd,@rs", 0, | |
28bab82b | 101 | "-ZS---", 9, 16, "0100 0111 0000 dddd address_src", "and rd,address_src", 0, |
252b5132 RH |
102 | "-ZS---", 10, 16, "0100 0111 ssN0 dddd address_src", "and rd,address_src(rs)", 0, |
103 | "-ZS---", 7, 16, "0000 0111 0000 dddd imm16", "and rd,imm16", 0, | |
104 | "-ZS---", 4, 16, "1000 0111 ssss dddd", "and rd,rs", 0, | |
105 | "-ZSP--", 7, 8, "0000 0110 ssN0 dddd", "andb rbd,@rs", 0, | |
28bab82b | 106 | "-ZSP--", 9, 8, "0100 0110 0000 dddd address_src", "andb rbd,address_src", 0, |
252b5132 RH |
107 | "-ZSP--", 10, 8, "0100 0110 ssN0 dddd address_src", "andb rbd,address_src(rs)", 0, |
108 | "-ZSP--", 7, 8, "0000 0110 0000 dddd imm8 imm8", "andb rbd,imm8", 0, | |
109 | "-ZSP--", 4, 8, "1000 0110 ssss dddd", "andb rbd,rbs", 0, | |
110 | ||
111 | "-Z----", 8, 16, "0010 0111 ddN0 imm4", "bit @rd,imm4", 0, | |
112 | "-Z----", 11, 16, "0110 0111 ddN0 imm4 address_dst", "bit address_dst(rd),imm4", 0, | |
113 | "-Z----", 10, 16, "0110 0111 0000 imm4 address_dst", "bit address_dst,imm4", 0, | |
114 | "-Z----", 4, 16, "1010 0111 dddd imm4", "bit rd,imm4", 0, | |
28bab82b | 115 | "-Z----", 10, 16, "0010 0111 0000 ssss 0000 dddd 0000 0000", "bit rd,rs", 0, |
252b5132 RH |
116 | |
117 | "-Z----", 8, 8, "0010 0110 ddN0 imm4", "bitb @rd,imm4", 0, | |
118 | "-Z----", 11, 8, "0110 0110 ddN0 imm4 address_dst", "bitb address_dst(rd),imm4", 0, | |
119 | "-Z----", 10, 8, "0110 0110 0000 imm4 address_dst", "bitb address_dst,imm4", 0, | |
120 | "-Z----", 4, 8, "1010 0110 dddd imm4", "bitb rbd,imm4", 0, | |
28bab82b | 121 | "-Z----", 10, 8, "0010 0110 0000 ssss 0000 dddd 0000 0000", "bitb rbd,rs", 0, |
252b5132 RH |
122 | |
123 | "------", 10, 32, "0001 1111 ddN0 0000", "call @rd", 0, | |
124 | "------", 12, 32, "0101 1111 0000 0000 address_dst", "call address_dst", 0, | |
125 | "------", 13, 32, "0101 1111 ddN0 0000 address_dst", "call address_dst(rd)", 0, | |
126 | "------", 10, 16, "1101 disp12", "calr disp12", 0, | |
127 | ||
128 | "------", 8, 16, "0000 1101 ddN0 1000", "clr @rd", 0, | |
129 | "------", 11, 16, "0100 1101 0000 1000 address_dst", "clr address_dst", 0, | |
130 | "------", 12, 16, "0100 1101 ddN0 1000 address_dst", "clr address_dst(rd)", 0, | |
131 | "------", 7, 16, "1000 1101 dddd 1000", "clr rd", 0, | |
132 | "------", 8, 8, "0000 1100 ddN0 1000", "clrb @rd", 0, | |
133 | "------", 11, 8, "0100 1100 0000 1000 address_dst", "clrb address_dst", 0, | |
134 | "------", 12, 8, "0100 1100 ddN0 1000 address_dst", "clrb address_dst(rd)", 0, | |
135 | "------", 7, 8, "1000 1100 dddd 1000", "clrb rbd", 0, | |
136 | "-ZS---", 12, 16, "0000 1101 ddN0 0000", "com @rd", 0, | |
137 | "-ZS---", 15, 16, "0100 1101 0000 0000 address_dst", "com address_dst", 0, | |
138 | "-ZS---", 16, 16, "0100 1101 ddN0 0000 address_dst", "com address_dst(rd)", 0, | |
139 | "-ZS---", 7, 16, "1000 1101 dddd 0000", "com rd", 0, | |
140 | "-ZSP--", 12, 8, "0000 1100 ddN0 0000", "comb @rd", 0, | |
141 | "-ZSP--", 15, 8, "0100 1100 0000 0000 address_dst", "comb address_dst", 0, | |
142 | "-ZSP--", 16, 8, "0100 1100 ddN0 0000 address_dst", "comb address_dst(rd)", 0, | |
143 | "-ZSP--", 7, 8, "1000 1100 dddd 0000", "comb rbd", 0, | |
6840198f | 144 | "CZSP--", 7, 16, "1000 1101 flags 0101", "comflg flags", 0, |
252b5132 RH |
145 | |
146 | "CZSV--", 11, 16, "0000 1101 ddN0 0001 imm16", "cp @rd,imm16", 0, | |
147 | "CZSV--", 15, 16, "0100 1101 ddN0 0001 address_dst imm16", "cp address_dst(rd),imm16", 0, | |
148 | "CZSV--", 14, 16, "0100 1101 0000 0001 address_dst imm16", "cp address_dst,imm16", 0, | |
149 | ||
150 | "CZSV--", 7, 16, "0000 1011 ssN0 dddd", "cp rd,@rs", 0, | |
151 | "CZSV--", 9, 16, "0100 1011 0000 dddd address_src", "cp rd,address_src", 0, | |
152 | "CZSV--", 10, 16, "0100 1011 ssN0 dddd address_src", "cp rd,address_src(rs)", 0, | |
153 | "CZSV--", 7, 16, "0000 1011 0000 dddd imm16", "cp rd,imm16", 0, | |
154 | "CZSV--", 4, 16, "1000 1011 ssss dddd", "cp rd,rs", 0, | |
155 | ||
156 | "CZSV--", 11, 8, "0000 1100 ddN0 0001 imm8 imm8", "cpb @rd,imm8", 0, | |
157 | "CZSV--", 15, 8, "0100 1100 ddN0 0001 address_dst imm8 imm8", "cpb address_dst(rd),imm8", 0, | |
158 | "CZSV--", 14, 8, "0100 1100 0000 0001 address_dst imm8 imm8", "cpb address_dst,imm8", 0, | |
159 | "CZSV--", 7, 8, "0000 1010 ssN0 dddd", "cpb rbd,@rs", 0, | |
28bab82b | 160 | "CZSV--", 9, 8, "0100 1010 0000 dddd address_src", "cpb rbd,address_src", 0, |
252b5132 RH |
161 | "CZSV--", 10, 8, "0100 1010 ssN0 dddd address_src", "cpb rbd,address_src(rs)", 0, |
162 | "CZSV--", 7, 8, "0000 1010 0000 dddd imm8 imm8", "cpb rbd,imm8", 0, | |
163 | "CZSV--", 4, 8, "1000 1010 ssss dddd", "cpb rbd,rbs", 0, | |
164 | ||
165 | "CZSV--", 14, 32, "0001 0000 ssN0 dddd", "cpl rrd,@rs", 0, | |
166 | "CZSV--", 15, 32, "0101 0000 0000 dddd address_src", "cpl rrd,address_src", 0, | |
167 | "CZSV--", 16, 32, "0101 0000 ssN0 dddd address_src", "cpl rrd,address_src(rs)", 0, | |
168 | "CZSV--", 14, 32, "0001 0000 0000 dddd imm32", "cpl rrd,imm32", 0, | |
169 | "CZSV--", 8, 32, "1001 0000 ssss dddd", "cpl rrd,rrs", 0, | |
170 | ||
171 | "CZS---", 5, 8, "1011 0000 dddd 0000", "dab rbd", 0, | |
6840198f | 172 | "------", 11, 16, "1111 dddd 0disp7", "dbjnz rbd,disp7", 0, |
252b5132 RH |
173 | "-ZSV--", 11, 16, "0010 1011 ddN0 imm4m1", "dec @rd,imm4m1", 0, |
174 | "-ZSV--", 14, 16, "0110 1011 ddN0 imm4m1 address_dst", "dec address_dst(rd),imm4m1", 0, | |
175 | "-ZSV--", 13, 16, "0110 1011 0000 imm4m1 address_dst", "dec address_dst,imm4m1", 0, | |
176 | "-ZSV--", 4, 16, "1010 1011 dddd imm4m1", "dec rd,imm4m1", 0, | |
177 | "-ZSV--", 11, 8, "0010 1010 ddN0 imm4m1", "decb @rd,imm4m1", 0, | |
178 | "-ZSV--", 14, 8, "0110 1010 ddN0 imm4m1 address_dst", "decb address_dst(rd),imm4m1", 0, | |
179 | "-ZSV--", 13, 8, "0110 1010 0000 imm4m1 address_dst", "decb address_dst,imm4m1", 0, | |
180 | "-ZSV--", 4, 8, "1010 1010 dddd imm4m1", "decb rbd,imm4m1", 0, | |
181 | ||
182 | "------", 7, 16, "0111 1100 0000 00ii", "di i2", 0, | |
183 | "CZSV--", 107, 16, "0001 1011 ssN0 dddd", "div rrd,@rs", 0, | |
184 | "CZSV--", 107, 16, "0101 1011 0000 dddd address_src", "div rrd,address_src", 0, | |
185 | "CZSV--", 107, 16, "0101 1011 ssN0 dddd address_src", "div rrd,address_src(rs)", 0, | |
186 | "CZSV--", 107, 16, "0001 1011 0000 dddd imm16", "div rrd,imm16", 0, | |
187 | "CZSV--", 107, 16, "1001 1011 ssss dddd", "div rrd,rs", 0, | |
188 | "CZSV--", 744, 32, "0001 1010 ssN0 dddd", "divl rqd,@rs", 0, | |
189 | "CZSV--", 745, 32, "0101 1010 0000 dddd address_src", "divl rqd,address_src", 0, | |
190 | "CZSV--", 746, 32, "0101 1010 ssN0 dddd address_src", "divl rqd,address_src(rs)", 0, | |
191 | "CZSV--", 744, 32, "0001 1010 0000 dddd imm32", "divl rqd,imm32", 0, | |
192 | "CZSV--", 744, 32, "1001 1010 ssss dddd", "divl rqd,rrs", 0, | |
193 | ||
6840198f | 194 | "------", 11, 16, "1111 dddd 1disp7", "djnz rd,disp7", 0, |
252b5132 RH |
195 | "------", 7, 16, "0111 1100 0000 01ii", "ei i2", 0, |
196 | "------", 6, 16, "1010 1101 ssss dddd", "ex rd,rs", 0, | |
197 | "------", 12, 16, "0010 1101 ssN0 dddd", "ex rd,@rs", 0, | |
28bab82b | 198 | "------", 15, 16, "0110 1101 0000 dddd address_src", "ex rd,address_src", 0, |
252b5132 RH |
199 | "------", 16, 16, "0110 1101 ssN0 dddd address_src", "ex rd,address_src(rs)", 0, |
200 | ||
201 | "------", 12, 8, "0010 1100 ssN0 dddd", "exb rbd,@rs", 0, | |
28bab82b | 202 | "------", 15, 8, "0110 1100 0000 dddd address_src", "exb rbd,address_src", 0, |
252b5132 RH |
203 | "------", 16, 8, "0110 1100 ssN0 dddd address_src", "exb rbd,address_src(rs)", 0, |
204 | "------", 6, 8, "1010 1100 ssss dddd", "exb rbd,rbs", 0, | |
205 | ||
206 | "------", 11, 16, "1011 0001 dddd 1010", "exts rrd", 0, | |
207 | "------", 11, 8, "1011 0001 dddd 0000", "extsb rd", 0, | |
208 | "------", 11, 32, "1011 0001 dddd 0111", "extsl rqd", 0, | |
209 | ||
210 | "------", 8, 16, "0111 1010 0000 0000", "halt", 0, | |
211 | "------", 10, 16, "0011 1101 ssN0 dddd", "in rd,@rs", 0, | |
212 | "------", 12, 16, "0011 1101 dddd 0100 imm16", "in rd,imm16", 0, | |
213 | "------", 12, 8, "0011 1100 ssN0 dddd", "inb rbd,@rs", 0, | |
6840198f | 214 | "------", 10, 8, "0011 1010 dddd 0100 imm16", "inb rbd,imm16", 0, |
252b5132 RH |
215 | "-ZSV--", 11, 16, "0010 1001 ddN0 imm4m1", "inc @rd,imm4m1", 0, |
216 | "-ZSV--", 14, 16, "0110 1001 ddN0 imm4m1 address_dst", "inc address_dst(rd),imm4m1", 0, | |
217 | "-ZSV--", 13, 16, "0110 1001 0000 imm4m1 address_dst", "inc address_dst,imm4m1", 0, | |
218 | "-ZSV--", 4, 16, "1010 1001 dddd imm4m1", "inc rd,imm4m1", 0, | |
219 | "-ZSV--", 11, 8, "0010 1000 ddN0 imm4m1", "incb @rd,imm4m1", 0, | |
220 | "-ZSV--", 14, 8, "0110 1000 ddN0 imm4m1 address_dst", "incb address_dst(rd),imm4m1", 0, | |
221 | "-ZSV--", 13, 8, "0110 1000 0000 imm4m1 address_dst", "incb address_dst,imm4m1", 0, | |
222 | "-ZSV--", 4, 8, "1010 1000 dddd imm4m1", "incb rbd,imm4m1", 0, | |
223 | "---V--", 21, 16, "0011 1011 ssN0 1000 0000 aaaa ddN0 1000", "ind @rd,@rs,ra", 0, | |
224 | "---V--", 21, 8, "0011 1010 ssN0 1000 0000 aaaa ddN0 1000", "indb @rd,@rs,rba", 0, | |
6840198f NC |
225 | "---V--", 21, 8, "0011 1010 ssN0 0000 0000 aaaa ddN0 1000", "inib @rd,@rs,ra", 0, |
226 | "---V--", 21, 16, "0011 1010 ssN0 0000 0000 aaaa ddN0 0000", "inibr @rd,@rs,ra", 0, | |
252b5132 RH |
227 | "CZSVDH", 13, 16, "0111 1011 0000 0000", "iret", 0, |
228 | "------", 10, 16, "0001 1110 ddN0 cccc", "jp cc,@rd", 0, | |
229 | "------", 7, 16, "0101 1110 0000 cccc address_dst", "jp cc,address_dst", 0, | |
230 | "------", 8, 16, "0101 1110 ddN0 cccc address_dst", "jp cc,address_dst(rd)", 0, | |
231 | "------", 6, 16, "1110 cccc disp8", "jr cc,disp8", 0, | |
232 | ||
233 | "------", 7, 16, "0000 1101 ddN0 0101 imm16", "ld @rd,imm16", 0, | |
234 | "------", 8, 16, "0010 1111 ddN0 ssss", "ld @rd,rs", 0, | |
235 | "------", 15, 16, "0100 1101 ddN0 0101 address_dst imm16", "ld address_dst(rd),imm16", 0, | |
236 | "------", 12, 16, "0110 1111 ddN0 ssss address_dst", "ld address_dst(rd),rs", 0, | |
237 | "------", 14, 16, "0100 1101 0000 0101 address_dst imm16", "ld address_dst,imm16", 0, | |
28bab82b | 238 | "------", 11, 16, "0110 1111 0000 ssss address_dst", "ld address_dst,rs", 0, |
252b5132 RH |
239 | "------", 14, 16, "0011 0011 ddN0 ssss imm16", "ld rd(imm16),rs", 0, |
240 | "------", 14, 16, "0111 0011 ddN0 ssss 0000 xxxx 0000 0000", "ld rd(rx),rs", 0, | |
241 | "------", 7, 16, "0010 0001 ssN0 dddd", "ld rd,@rs", 0, | |
242 | "------", 9, 16, "0110 0001 0000 dddd address_src", "ld rd,address_src", 0, | |
243 | "------", 10, 16, "0110 0001 ssN0 dddd address_src", "ld rd,address_src(rs)", 0, | |
244 | "------", 7, 16, "0010 0001 0000 dddd imm16", "ld rd,imm16", 0, | |
245 | "------", 3, 16, "1010 0001 ssss dddd", "ld rd,rs", 0, | |
246 | "------", 14, 16, "0011 0001 ssN0 dddd imm16", "ld rd,rs(imm16)", 0, | |
247 | "------", 14, 16, "0111 0001 ssN0 dddd 0000 xxxx 0000 0000", "ld rd,rs(rx)", 0, | |
248 | ||
249 | "------", 7, 8, "0000 1100 ddN0 0101 imm8 imm8", "ldb @rd,imm8", 0, | |
250 | "------", 8, 8, "0010 1110 ddN0 ssss", "ldb @rd,rbs", 0, | |
251 | "------", 15, 8, "0100 1100 ddN0 0101 address_dst imm8 imm8", "ldb address_dst(rd),imm8", 0, | |
6840198f | 252 | "------", 12, 8, "0110 1110 ddN0 ssss address_dst", "ldb address_dst(rd),rbs", 0, |
252b5132 | 253 | "------", 14, 8, "0100 1100 0000 0101 address_dst imm8 imm8", "ldb address_dst,imm8", 0, |
28bab82b | 254 | "------", 11, 8, "0110 1110 0000 ssss address_dst", "ldb address_dst,rbs", 0, |
252b5132 RH |
255 | "------", 14, 8, "0011 0010 ddN0 ssss imm16", "ldb rd(imm16),rbs", 0, |
256 | "------", 14, 8, "0111 0010 ddN0 ssss 0000 xxxx 0000 0000", "ldb rd(rx),rbs", 0, | |
257 | "------", 7, 8, "0010 0000 ssN0 dddd", "ldb rbd,@rs", 0, | |
28bab82b | 258 | "------", 9, 8, "0110 0000 0000 dddd address_src", "ldb rbd,address_src", 0, |
252b5132 RH |
259 | "------", 10, 8, "0110 0000 ssN0 dddd address_src", "ldb rbd,address_src(rs)", 0, |
260 | "------", 5, 8, "1100 dddd imm8", "ldb rbd,imm8", 0, | |
261 | "------", 3, 8, "1010 0000 ssss dddd", "ldb rbd,rbs", 0, | |
262 | "------", 14, 8, "0011 0000 ssN0 dddd imm16", "ldb rbd,rs(imm16)", 0, | |
263 | "------", 14, 8, "0111 0000 ssN0 dddd 0000 xxxx 0000 0000", "ldb rbd,rs(rx)", 0, | |
264 | ||
265 | "------", 11, 32, "0001 1101 ddN0 ssss", "ldl @rd,rrs", 0, | |
266 | "------", 14, 32, "0101 1101 ddN0 ssss address_dst", "ldl address_dst(rd),rrs", 0, | |
267 | "------", 15, 32, "0101 1101 0000 ssss address_dst", "ldl address_dst,rrs", 0, | |
268 | "------", 17, 32, "0011 0111 ddN0 ssss imm16", "ldl rd(imm16),rrs", 0, | |
269 | "------", 17, 32, "0111 0111 ddN0 ssss 0000 xxxx 0000 0000", "ldl rd(rx),rrs", 0, | |
270 | "------", 11, 32, "0001 0100 ssN0 dddd", "ldl rrd,@rs", 0, | |
271 | "------", 12, 32, "0101 0100 0000 dddd address_src", "ldl rrd,address_src", 0, | |
272 | "------", 13, 32, "0101 0100 ssN0 dddd address_src", "ldl rrd,address_src(rs)", 0, | |
273 | "------", 11, 32, "0001 0100 0000 dddd imm32", "ldl rrd,imm32", 0, | |
274 | "------", 5, 32, "1001 0100 ssss dddd", "ldl rrd,rrs", 0, | |
275 | "------", 17, 32, "0011 0101 ssN0 dddd imm16", "ldl rrd,rs(imm16)", 0, | |
276 | "------", 17, 32, "0111 0101 ssN0 dddd 0000 xxxx 0000 0000", "ldl rrd,rs(rx)", 0, | |
277 | ||
278 | "------", 12, 16, "0111 0110 0000 dddd address_src", "lda prd,address_src", 0, | |
279 | "------", 13, 16, "0111 0110 ssN0 dddd address_src", "lda prd,address_src(rs)", 0, | |
280 | "------", 15, 16, "0011 0100 ssN0 dddd imm16", "lda prd,rs(imm16)", 0, | |
281 | "------", 15, 16, "0111 0100 ssN0 dddd 0000 xxxx 0000 0000", "lda prd,rs(rx)", 0, | |
282 | "------", 15, 16, "0011 0100 0000 dddd disp16", "ldar prd,disp16", 0, | |
283 | "------", 7, 32, "0111 1101 ssss 1ccc", "ldctl ctrl,rs", 0, | |
284 | "------", 7, 32, "0111 1101 dddd 0ccc", "ldctl rd,ctrl", 0, | |
285 | ||
286 | "------", 5, 16, "1011 1101 dddd imm4", "ldk rd,imm4", 0, | |
287 | ||
288 | "------", 11, 16, "0001 1100 ddN0 1001 0000 ssss 0000 nminus1", "ldm @rd,rs,n", 0, | |
6840198f | 289 | "------", 15, 16, "0101 1100 ddN0 1001 0000 ssss 0000 nminus1 address_dst", "ldm address_dst(rd),rs,n", 0, |
252b5132 RH |
290 | "------", 14, 16, "0101 1100 0000 1001 0000 ssss 0000 nminus1 address_dst", "ldm address_dst,rs,n", 0, |
291 | "------", 11, 16, "0001 1100 ssN0 0001 0000 dddd 0000 nminus1", "ldm rd,@rs,n", 0, | |
292 | "------", 15, 16, "0101 1100 ssN0 0001 0000 dddd 0000 nminus1 address_src", "ldm rd,address_src(rs),n", 0, | |
293 | "------", 14, 16, "0101 1100 0000 0001 0000 dddd 0000 nminus1 address_src", "ldm rd,address_src,n", 0, | |
294 | ||
295 | "CZSVDH", 12, 16, "0011 1001 ssN0 0000", "ldps @rs", 0, | |
296 | "CZSVDH", 16, 16, "0111 1001 0000 0000 address_src", "ldps address_src", 0, | |
297 | "CZSVDH", 17, 16, "0111 1001 ssN0 0000 address_src", "ldps address_src(rs)", 0, | |
298 | ||
299 | "------", 14, 16, "0011 0011 0000 ssss disp16", "ldr disp16,rs", 0, | |
300 | "------", 14, 16, "0011 0001 0000 dddd disp16", "ldr rd,disp16", 0, | |
301 | "------", 14, 8, "0011 0010 0000 ssss disp16", "ldrb disp16,rbs", 0, | |
302 | "------", 14, 8, "0011 0000 0000 dddd disp16", "ldrb rbd,disp16", 0, | |
303 | "------", 17, 32, "0011 0111 0000 ssss disp16", "ldrl disp16,rrs", 0, | |
304 | "------", 17, 32, "0011 0101 0000 dddd disp16", "ldrl rrd,disp16", 0, | |
305 | ||
306 | "CZS---", 7, 16, "0111 1011 0000 1010", "mbit", 0, | |
307 | "-ZS---", 12, 16, "0111 1011 dddd 1101", "mreq rd", 0, | |
308 | "------", 5, 16, "0111 1011 0000 1001", "mres", 0, | |
309 | "------", 5, 16, "0111 1011 0000 1000", "mset", 0, | |
310 | ||
311 | "CZSV--", 70, 16, "0001 1001 ssN0 dddd", "mult rrd,@rs", 0, | |
312 | "CZSV--", 70, 16, "0101 1001 0000 dddd address_src", "mult rrd,address_src", 0, | |
313 | "CZSV--", 70, 16, "0101 1001 ssN0 dddd address_src", "mult rrd,address_src(rs)", 0, | |
314 | "CZSV--", 70, 16, "0001 1001 0000 dddd imm16", "mult rrd,imm16", 0, | |
315 | "CZSV--", 70, 16, "1001 1001 ssss dddd", "mult rrd,rs", 0, | |
316 | "CZSV--", 282, 32, "0001 1000 ssN0 dddd", "multl rqd,@rs", 0, | |
317 | "CZSV--", 282, 32, "0101 1000 0000 dddd address_src", "multl rqd,address_src", 0, | |
318 | "CZSV--", 282, 32, "0101 1000 ssN0 dddd address_src", "multl rqd,address_src(rs)", 0, | |
319 | "CZSV--", 282, 32, "0001 1000 0000 dddd imm32", "multl rqd,imm32", 0, | |
320 | "CZSV--", 282, 32, "1001 1000 ssss dddd", "multl rqd,rrs", 0, | |
321 | "CZSV--", 12, 16, "0000 1101 ddN0 0010", "neg @rd", 0, | |
322 | "CZSV--", 15, 16, "0100 1101 0000 0010 address_dst", "neg address_dst", 0, | |
323 | "CZSV--", 16, 16, "0100 1101 ddN0 0010 address_dst", "neg address_dst(rd)", 0, | |
324 | "CZSV--", 7, 16, "1000 1101 dddd 0010", "neg rd", 0, | |
325 | "CZSV--", 12, 8, "0000 1100 ddN0 0010", "negb @rd", 0, | |
326 | "CZSV--", 15, 8, "0100 1100 0000 0010 address_dst", "negb address_dst", 0, | |
327 | "CZSV--", 16, 8, "0100 1100 ddN0 0010 address_dst", "negb address_dst(rd)", 0, | |
328 | "CZSV--", 7, 8, "1000 1100 dddd 0010", "negb rbd", 0, | |
329 | ||
330 | "------", 7, 16, "1000 1101 0000 0111", "nop", 0, | |
331 | ||
332 | "CZS---", 7, 16, "0000 0101 ssN0 dddd", "or rd,@rs", 0, | |
333 | "CZS---", 9, 16, "0100 0101 0000 dddd address_src", "or rd,address_src", 0, | |
334 | "CZS---", 10, 16, "0100 0101 ssN0 dddd address_src", "or rd,address_src(rs)", 0, | |
335 | "CZS---", 7, 16, "0000 0101 0000 dddd imm16", "or rd,imm16", 0, | |
336 | "CZS---", 4, 16, "1000 0101 ssss dddd", "or rd,rs", 0, | |
337 | ||
338 | "CZSP--", 7, 8, "0000 0100 ssN0 dddd", "orb rbd,@rs", 0, | |
28bab82b | 339 | "CZSP--", 9, 8, "0100 0100 0000 dddd address_src", "orb rbd,address_src", 0, |
252b5132 RH |
340 | "CZSP--", 10, 8, "0100 0100 ssN0 dddd address_src", "orb rbd,address_src(rs)", 0, |
341 | "CZSP--", 7, 8, "0000 0100 0000 dddd imm8 imm8", "orb rbd,imm8", 0, | |
342 | "CZSP--", 4, 8, "1000 0100 ssss dddd", "orb rbd,rbs", 0, | |
343 | ||
344 | "---V--", 0, 16, "0011 1111 ddN0 ssss", "out @rd,rs", 0, | |
345 | "---V--", 0, 16, "0011 1011 ssss 0110 imm16", "out imm16,rs", 0, | |
346 | "---V--", 0, 8, "0011 1110 ddN0 ssss", "outb @rd,rbs", 0, | |
347 | "---V--", 0, 8, "0011 1010 ssss 0110 imm16", "outb imm16,rbs", 0, | |
348 | "---V--", 0, 16, "0011 1011 ssN0 1010 0000 aaaa ddN0 1000", "outd @rd,@rs,ra", 0, | |
6840198f NC |
349 | "---V--", 0, 16, "0011 1010 ssN0 1010 0000 aaaa ddN0 1000", "outdb @rd,@rs,rba", 0, |
350 | "---V--", 0, 16, "0011 1011 ssN0 0010 0000 aaaa ddN0 1000", "outi @rd,@rs,ra", 0, | |
351 | "---V--", 0, 16, "0011 1010 ssN0 0010 0000 aaaa ddN0 1000", "outib @rd,@rs,ra", 0, | |
352 | "---V--", 0, 16, "0011 1010 ssN0 0010 0000 aaaa ddN0 0000", "outibr @rd,@rs,ra", 0, | |
252b5132 RH |
353 | |
354 | "------", 12, 16, "0001 0111 ssN0 ddN0", "pop @rd,@rs", 0, | |
355 | "------", 16, 16, "0101 0111 ssN0 ddN0 address_dst", "pop address_dst(rd),@rs", 0, | |
356 | "------", 16, 16, "0101 0111 ssN0 0000 address_dst", "pop address_dst,@rs", 0, | |
357 | "------", 8, 16, "1001 0111 ssN0 dddd", "pop rd,@rs", 0, | |
358 | ||
359 | "------", 19, 32, "0001 0101 ssN0 ddN0", "popl @rd,@rs", 0, | |
360 | "------", 23, 32, "0101 0101 ssN0 ddN0 address_dst", "popl address_dst(rd),@rs", 0, | |
361 | "------", 23, 32, "0101 0101 ssN0 0000 address_dst", "popl address_dst,@rs", 0, | |
362 | "------", 12, 32, "1001 0101 ssN0 dddd", "popl rrd,@rs", 0, | |
363 | ||
364 | "------", 13, 16, "0001 0011 ddN0 ssN0", "push @rd,@rs", 0, | |
365 | "------", 14, 16, "0101 0011 ddN0 0000 address_src", "push @rd,address_src", 0, | |
366 | "------", 14, 16, "0101 0011 ddN0 ssN0 address_src", "push @rd,address_src(rs)", 0, | |
367 | "------", 12, 16, "0000 1101 ddN0 1001 imm16", "push @rd,imm16", 0, | |
368 | "------", 9, 16, "1001 0011 ddN0 ssss", "push @rd,rs", 0, | |
369 | ||
370 | "------", 20, 32, "0001 0001 ddN0 ssN0", "pushl @rd,@rs", 0, | |
371 | "------", 21, 32, "0101 0001 ddN0 ssN0 address_src", "pushl @rd,address_src(rs)", 0, | |
372 | "------", 21, 32, "0101 0001 ddN0 0000 address_src", "pushl @rd,address_src", 0, | |
373 | "------", 12, 32, "1001 0001 ddN0 ssss", "pushl @rd,rrs", 0, | |
374 | ||
375 | "------", 11, 16, "0010 0011 ddN0 imm4", "res @rd,imm4", 0, | |
376 | "------", 14, 16, "0110 0011 ddN0 imm4 address_dst", "res address_dst(rd),imm4", 0, | |
377 | "------", 13, 16, "0110 0011 0000 imm4 address_dst", "res address_dst,imm4", 0, | |
378 | "------", 4, 16, "1010 0011 dddd imm4", "res rd,imm4", 0, | |
28bab82b | 379 | "------", 10, 16, "0010 0011 0000 ssss 0000 dddd 0000 0000", "res rd,rs", 0, |
252b5132 RH |
380 | |
381 | "------", 11, 8, "0010 0010 ddN0 imm4", "resb @rd,imm4", 0, | |
382 | "------", 14, 8, "0110 0010 ddN0 imm4 address_dst", "resb address_dst(rd),imm4", 0, | |
383 | "------", 13, 8, "0110 0010 0000 imm4 address_dst", "resb address_dst,imm4", 0, | |
384 | "------", 4, 8, "1010 0010 dddd imm4", "resb rbd,imm4", 0, | |
28bab82b | 385 | "------", 10, 8, "0010 0010 0000 ssss 0000 dddd 0000 0000", "resb rbd,rs", 0, |
252b5132 | 386 | |
6840198f | 387 | "CZSV--", 7, 16, "1000 1101 flags 0011", "resflg flags", 0, |
252b5132 RH |
388 | "------", 10, 16, "1001 1110 0000 cccc", "ret cc", 0, |
389 | ||
390 | "CZSV--", 6, 16, "1011 0011 dddd 00I0", "rl rd,imm1or2", 0, | |
391 | "CZSV--", 6, 8, "1011 0010 dddd 00I0", "rlb rbd,imm1or2", 0, | |
392 | "CZSV--", 6, 16, "1011 0011 dddd 10I0", "rlc rd,imm1or2", 0, | |
393 | ||
394 | "-Z----", 9, 8, "1011 0010 dddd 10I0", "rlcb rbd,imm1or2", 0, | |
395 | "-Z----", 9, 8, "1011 1110 aaaa bbbb", "rldb rbb,rba", 0, | |
396 | ||
397 | "CZSV--", 6, 16, "1011 0011 dddd 01I0", "rr rd,imm1or2", 0, | |
398 | "CZSV--", 6, 8, "1011 0010 dddd 01I0", "rrb rbd,imm1or2", 0, | |
399 | "CZSV--", 6, 16, "1011 0011 dddd 11I0", "rrc rd,imm1or2", 0, | |
400 | ||
401 | "-Z----", 9, 8, "1011 0010 dddd 11I0", "rrcb rbd,imm1or2", 0, | |
402 | "-Z----", 9, 8, "1011 1100 aaaa bbbb", "rrdb rbb,rba", 0, | |
403 | "CZSV--", 5, 16, "1011 0111 ssss dddd", "sbc rd,rs", 0, | |
404 | "CZSVDH", 5, 8, "1011 0110 ssss dddd", "sbcb rbd,rbs", 0, | |
405 | ||
406 | "CZSVDH", 33, 8, "0111 1111 imm8", "sc imm8", 0, | |
407 | ||
28bab82b NC |
408 | "CZSV--", 15, 16, "1011 0011 dddd 1011 0000 ssss 0000 0000", "sda rd,rs", 0, |
409 | "CZSV--", 15, 8, "1011 0010 dddd 1011 0000 ssss 0000 0000", "sdab rbd,rs", 0, | |
252b5132 RH |
410 | "CZSV--", 15, 32, "1011 0011 dddd 1111 0000 ssss 0000 0000", "sdal rrd,rs", 0, |
411 | ||
28bab82b NC |
412 | "CZS---", 15, 16, "1011 0011 dddd 0011 0000 ssss 0000 0000", "sdl rd,rs", 0, |
413 | "CZS---", 15, 8, "1011 0010 dddd 0011 0000 ssss 0000 0000", "sdlb rbd,rs", 0, | |
252b5132 RH |
414 | "CZS---", 15, 32, "1011 0011 dddd 0111 0000 ssss 0000 0000", "sdll rrd,rs", 0, |
415 | ||
416 | "------", 11, 16, "0010 0101 ddN0 imm4", "set @rd,imm4", 0, | |
417 | "------", 14, 16, "0110 0101 ddN0 imm4 address_dst", "set address_dst(rd),imm4", 0, | |
418 | "------", 13, 16, "0110 0101 0000 imm4 address_dst", "set address_dst,imm4", 0, | |
419 | "------", 4, 16, "1010 0101 dddd imm4", "set rd,imm4", 0, | |
28bab82b | 420 | "------", 10, 16, "0010 0101 0000 ssss 0000 dddd 0000 0000", "set rd,rs", 0, |
252b5132 RH |
421 | "------", 11, 8, "0010 0100 ddN0 imm4", "setb @rd,imm4", 0, |
422 | "------", 14, 8, "0110 0100 ddN0 imm4 address_dst", "setb address_dst(rd),imm4", 0, | |
423 | "------", 13, 8, "0110 0100 0000 imm4 address_dst", "setb address_dst,imm4", 0, | |
424 | "------", 4, 8, "1010 0100 dddd imm4", "setb rbd,imm4", 0, | |
28bab82b | 425 | "------", 10, 8, "0010 0100 0000 ssss 0000 dddd 0000 0000", "setb rbd,rs", 0, |
252b5132 | 426 | |
6840198f | 427 | "CZSV--", 7, 16, "1000 1101 flags 0001", "setflg flags", 0, |
252b5132 | 428 | |
6840198f NC |
429 | "------", 0, 8, "0011 1010 dddd 0101 imm16", "sinb rbd,imm16", 0, |
430 | "------", 0, 8, "0011 1011 dddd 0101 imm16", "sin rd,imm16", 0, | |
252b5132 RH |
431 | "------", 0, 16, "0011 1011 ssN0 1000 0001 aaaa ddN0 1000", "sind @rd,@rs,ra", 0, |
432 | "------", 0, 8, "0011 1010 ssN0 1000 0001 aaaa ddN0 1000", "sindb @rd,@rs,rba", 0, | |
6840198f NC |
433 | "------", 0, 8, "0011 1010 ssN0 0001 0000 aaaa ddN0 1000", "sinib @rd,@rs,ra", 0, |
434 | "------", 0, 16, "0011 1010 ssN0 0001 0000 aaaa ddN0 0000", "sinibr @rd,@rs,ra", 0, | |
252b5132 RH |
435 | |
436 | "CZSV--", 13, 16, "1011 0011 dddd 1001 0000 0000 imm8", "sla rd,imm8", 0, | |
437 | "CZSV--", 13, 8, "1011 0010 dddd 1001 0000 0000 imm8", "slab rbd,imm8", 0, | |
438 | "CZSV--", 13, 32, "1011 0011 dddd 1101 0000 0000 imm8", "slal rrd,imm8", 0, | |
439 | ||
440 | "CZS---", 13, 16, "1011 0011 dddd 0001 0000 0000 imm8", "sll rd,imm8", 0, | |
441 | "CZS---", 13, 8, "1011 0010 dddd 0001 0000 0000 imm8", "sllb rbd,imm8", 0, | |
442 | "CZS---", 13, 32, "1011 0011 dddd 0101 0000 0000 imm8", "slll rrd,imm8", 0, | |
443 | ||
444 | "------", 0, 16, "0011 1011 ssss 0111 imm16", "sout imm16,rs", 0, | |
445 | "------", 0, 8, "0011 1010 ssss 0111 imm16", "soutb imm16,rbs", 0, | |
446 | "------", 0, 16, "0011 1011 ssN0 1011 0000 aaaa ddN0 1000", "soutd @rd,@rs,ra", 0, | |
447 | "------", 0, 8, "0011 1010 ssN0 1011 0000 aaaa ddN0 1000", "soutdb @rd,@rs,rba", 0, | |
6840198f NC |
448 | "------", 0, 8, "0011 1010 ssN0 0011 0000 aaaa ddN0 1000", "soutib @rd,@rs,ra", 0, |
449 | "------", 0, 16, "0011 1010 ssN0 0011 0000 aaaa ddN0 0000", "soutibr @rd,@rs,ra", 0, | |
252b5132 RH |
450 | |
451 | "CZSV--", 13, 16, "1011 0011 dddd 1001 1111 1111 nim8", "sra rd,imm8", 0, | |
6840198f | 452 | "CZSV--", 13, 8, "1011 0010 dddd 1001 0000 0000 nim8", "srab rbd,imm8", 0, |
252b5132 RH |
453 | "CZSV--", 13, 32, "1011 0011 dddd 1101 1111 1111 nim8", "sral rrd,imm8", 0, |
454 | ||
455 | "CZSV--", 13, 16, "1011 0011 dddd 0001 1111 1111 nim8", "srl rd,imm8", 0, | |
6840198f | 456 | "CZSV--", 13, 8, "1011 0010 dddd 0001 0000 0000 nim8", "srlb rbd,imm8", 0, |
252b5132 RH |
457 | "CZSV--", 13, 32, "1011 0011 dddd 0101 1111 1111 nim8", "srll rrd,imm8", 0, |
458 | ||
459 | "CZSV--", 7, 16, "0000 0011 ssN0 dddd", "sub rd,@rs", 0, | |
28bab82b | 460 | "CZSV--", 9, 16, "0100 0011 0000 dddd address_src", "sub rd,address_src", 0, |
252b5132 | 461 | "CZSV--", 10, 16, "0100 0011 ssN0 dddd address_src", "sub rd,address_src(rs)", 0, |
6840198f | 462 | "CZSV--", 7, 16, "0000 0011 0000 dddd imm16", "sub rd,imm16", 0, |
252b5132 RH |
463 | "CZSV--", 4, 16, "1000 0011 ssss dddd", "sub rd,rs", 0, |
464 | ||
465 | "CZSVDH", 7, 8, "0000 0010 ssN0 dddd", "subb rbd,@rs", 0, | |
28bab82b | 466 | "CZSVDH", 9, 8, "0100 0010 0000 dddd address_src", "subb rbd,address_src", 0, |
252b5132 RH |
467 | "CZSVDH", 10, 8, "0100 0010 ssN0 dddd address_src", "subb rbd,address_src(rs)", 0, |
468 | "CZSVDH", 7, 8, "0000 0010 0000 dddd imm8 imm8", "subb rbd,imm8", 0, | |
469 | "CZSVDH", 4, 8, "1000 0010 ssss dddd", "subb rbd,rbs", 0, | |
470 | ||
471 | "CZSV--", 14, 32, "0001 0010 ssN0 dddd", "subl rrd,@rs", 0, | |
472 | "CZSV--", 15, 32, "0101 0010 0000 dddd address_src", "subl rrd,address_src", 0, | |
473 | "CZSV--", 16, 32, "0101 0010 ssN0 dddd address_src", "subl rrd,address_src(rs)", 0, | |
474 | "CZSV--", 14, 32, "0001 0010 0000 dddd imm32", "subl rrd,imm32", 0, | |
475 | "CZSV--", 8, 32, "1001 0010 ssss dddd", "subl rrd,rrs", 0, | |
476 | ||
477 | "------", 5, 16, "1010 1111 dddd cccc", "tcc cc,rd", 0, | |
478 | "------", 5, 8, "1010 1110 dddd cccc", "tccb cc,rbd", 0, | |
479 | ||
480 | "-ZS---", 8, 16, "0000 1101 ddN0 0100", "test @rd", 0, | |
481 | "------", 11, 16, "0100 1101 0000 0100 address_dst", "test address_dst", 0, | |
482 | "------", 12, 16, "0100 1101 ddN0 0100 address_dst", "test address_dst(rd)", 0, | |
483 | "------", 7, 16, "1000 1101 dddd 0100", "test rd", 0, | |
484 | ||
485 | "-ZSP--", 8, 8, "0000 1100 ddN0 0100", "testb @rd", 0, | |
486 | "-ZSP--", 11, 8, "0100 1100 0000 0100 address_dst", "testb address_dst", 0, | |
487 | "-ZSP--", 12, 8, "0100 1100 ddN0 0100 address_dst", "testb address_dst(rd)", 0, | |
488 | "-ZSP--", 7, 8, "1000 1100 dddd 0100", "testb rbd", 0, | |
489 | ||
490 | "-ZS---", 13, 32, "0001 1100 ddN0 1000", "testl @rd", 0, | |
28bab82b | 491 | "-ZS---", 16, 32, "0101 1100 0000 1000 address_dst", "testl address_dst", 0, |
252b5132 RH |
492 | "-ZS---", 17, 32, "0101 1100 ddN0 1000 address_dst", "testl address_dst(rd)", 0, |
493 | "-ZS---", 13, 32, "1001 1100 dddd 1000", "testl rrd", 0, | |
494 | ||
495 | "-ZSV--", 25, 8, "1011 1000 ddN0 1000 0000 aaaa ssN0 0000", "trdb @rd,@rs,rba", 0, | |
496 | "-ZSV--", 25, 8, "1011 1000 ddN0 1100 0000 aaaa ssN0 0000", "trdrb @rd,@rs,rba", 0, | |
497 | "-ZSV--", 25, 8, "1011 1000 ddN0 0000 0000 rrrr ssN0 0000", "trib @rd,@rs,rbr", 0, | |
498 | "-ZSV--", 25, 8, "1011 1000 ddN0 0100 0000 rrrr ssN0 0000", "trirb @rd,@rs,rbr", 0, | |
6840198f | 499 | "-ZSV--", 25, 8, "1011 1000 aaN0 1010 0000 rrrr bbN0 0000", "trtdb @ra,@rb,rbr", 0, |
252b5132 | 500 | "-ZSV--", 25, 8, "1011 1000 aaN0 1110 0000 rrrr bbN0 1110", "trtdrb @ra,@rb,rbr", 0, |
6840198f | 501 | "-ZSV--", 25, 8, "1011 1000 aaN0 0010 0000 rrrr bbN0 0000", "trtib @ra,@rb,rbr", 0, |
252b5132 RH |
502 | "-ZSV--", 25, 8, "1011 1000 aaN0 0110 0000 rrrr bbN0 1110", "trtirb @ra,@rb,rbr", 0, |
503 | "-ZSV--", 25, 8, "1011 1000 aaN0 1010 0000 rrrr bbN0 0000", "trtrb @ra,@rb,rbr", 0, | |
504 | ||
505 | "--S---", 11, 16, "0000 1101 ddN0 0110", "tset @rd", 0, | |
506 | "--S---", 14, 16, "0100 1101 0000 0110 address_dst", "tset address_dst", 0, | |
507 | "--S---", 15, 16, "0100 1101 ddN0 0110 address_dst", "tset address_dst(rd)", 0, | |
508 | "--S---", 7, 16, "1000 1101 dddd 0110", "tset rd", 0, | |
509 | ||
510 | "--S---", 11, 8, "0000 1100 ddN0 0110", "tsetb @rd", 0, | |
511 | "--S---", 14, 8, "0100 1100 0000 0110 address_dst", "tsetb address_dst", 0, | |
512 | "--S---", 15, 8, "0100 1100 ddN0 0110 address_dst", "tsetb address_dst(rd)", 0, | |
513 | "--S---", 7, 8, "1000 1100 dddd 0110", "tsetb rbd", 0, | |
514 | ||
515 | "-ZS---", 7, 16, "0000 1001 ssN0 dddd", "xor rd,@rs", 0, | |
28bab82b | 516 | "-ZS---", 9, 16, "0100 1001 0000 dddd address_src", "xor rd,address_src", 0, |
252b5132 RH |
517 | "-ZS---", 10, 16, "0100 1001 ssN0 dddd address_src", "xor rd,address_src(rs)", 0, |
518 | "-ZS---", 7, 16, "0000 1001 0000 dddd imm16", "xor rd,imm16", 0, | |
519 | "-ZS---", 4, 16, "1000 1001 ssss dddd", "xor rd,rs", 0, | |
520 | ||
521 | "-ZSP--", 7, 8, "0000 1000 ssN0 dddd", "xorb rbd,@rs", 0, | |
28bab82b | 522 | "-ZSP--", 9, 8, "0100 1000 0000 dddd address_src", "xorb rbd,address_src", 0, |
252b5132 RH |
523 | "-ZSP--", 10, 8, "0100 1000 ssN0 dddd address_src", "xorb rbd,address_src(rs)", 0, |
524 | "-ZSP--", 7, 8, "0000 1000 0000 dddd imm8 imm8", "xorb rbd,imm8", 0, | |
525 | "-ZSP--", 4, 8, "1000 1000 ssss dddd", "xorb rbd,rbs", 0, | |
6840198f NC |
526 | |
527 | "------", 7, 32, "1000 1100 dddd 0001", "ldctlb rbd,ctrl", 0, | |
528 | "CZSVDH", 7, 32, "1000 1100 ssss 1001", "ldctlb ctrl,rbs", 0, | |
529 | ||
252b5132 RH |
530 | "*", 4, 8, "1000 1000 ssss dddd", "xorb rbd,rbs", 0, |
531 | "*", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 | |
532 | }; | |
533 | ||
534 | int | |
535 | count () | |
536 | { | |
537 | struct op *p = opt; | |
538 | int r = 0; | |
539 | ||
540 | while (p->name) | |
541 | { | |
542 | r++; | |
543 | p++; | |
544 | } | |
545 | return r; | |
546 | ||
547 | } | |
548 | ||
549 | static | |
550 | int | |
551 | func (a, b) | |
552 | struct op *a; | |
553 | struct op *b; | |
554 | { | |
555 | return strcmp ((a)->name, (b)->name); | |
556 | } | |
557 | ||
558 | ||
559 | /* opcode | |
560 | ||
561 | literal 0000 nnnn insert nnn into stream | |
562 | operand 0001 nnnn insert operand reg nnn into stream | |
563 | */ | |
564 | ||
565 | struct tok_struct | |
566 | { | |
567 | ||
568 | char *match; | |
569 | char *token; | |
570 | int length; | |
571 | }; | |
572 | ||
573 | struct tok_struct args[] = | |
574 | { | |
575 | ||
576 | {"address_src(rs)", "CLASS_X+(ARG_RS)",}, | |
577 | {"address_dst(rd)", "CLASS_X+(ARG_RD)",}, | |
578 | ||
579 | {"rs(imm16)", "CLASS_BA+(ARG_RS)",}, | |
580 | {"rd(imm16)", "CLASS_BA+(ARG_RD)",}, | |
581 | {"prd", "CLASS_PR+(ARG_RD)",}, | |
582 | {"address_src", "CLASS_DA+(ARG_SRC)",}, | |
583 | {"address_dst", "CLASS_DA+(ARG_DST)",}, | |
584 | {"rd(rx)", "CLASS_BX+(ARG_RD)",}, | |
585 | {"rs(rx)", "CLASS_BX+(ARG_RS)",}, | |
586 | ||
587 | {"disp16", "CLASS_DISP",}, | |
588 | {"disp12", "CLASS_DISP",}, | |
589 | {"disp7", "CLASS_DISP",}, | |
590 | {"disp8", "CLASS_DISP",}, | |
591 | {"flags", "CLASS_FLAGS",}, | |
592 | ||
593 | {"imm16", "CLASS_IMM+(ARG_IMM16)",}, | |
594 | {"imm1or2", "CLASS_IMM+(ARG_IMM1OR2)",}, | |
595 | {"imm32", "CLASS_IMM+(ARG_IMM32)",}, | |
596 | {"imm4m1", "CLASS_IMM +(ARG_IMM4M1)",}, | |
597 | {"imm4", "CLASS_IMM +(ARG_IMM4)",}, | |
598 | {"n", "CLASS_IMM + (ARG_IMMN)",}, | |
599 | {"ctrl", "CLASS_CTRL",}, | |
600 | {"rba", "CLASS_REG_BYTE+(ARG_RA)",}, | |
601 | {"rbb", "CLASS_REG_BYTE+(ARG_RB)",}, | |
602 | {"rbd", "CLASS_REG_BYTE+(ARG_RD)",}, | |
603 | {"rbs", "CLASS_REG_BYTE+(ARG_RS)",}, | |
604 | {"rbr", "CLASS_REG_BYTE+(ARG_RR)",}, | |
605 | ||
606 | {"rrd", "CLASS_REG_LONG+(ARG_RD)",}, | |
607 | {"rrs", "CLASS_REG_LONG+(ARG_RS)",}, | |
608 | ||
609 | {"rqd", "CLASS_REG_QUAD+(ARG_RD)",}, | |
610 | ||
611 | {"rd", "CLASS_REG_WORD+(ARG_RD)",}, | |
612 | {"rs", "CLASS_REG_WORD+(ARG_RS)",}, | |
613 | ||
614 | {"@rd", "CLASS_IR+(ARG_RD)",}, | |
615 | {"@ra", "CLASS_IR+(ARG_RA)",}, | |
616 | {"@rb", "CLASS_IR+(ARG_RB)",}, | |
617 | {"@rs", "CLASS_IR+(ARG_RS)",}, | |
618 | ||
619 | {"imm8", "CLASS_IMM+(ARG_IMM8)",}, | |
620 | {"i2", "CLASS_IMM+(ARG_IMM2)",}, | |
621 | {"cc", "CLASS_CC",}, | |
622 | ||
623 | {"rr", "CLASS_REG_WORD+(ARG_RR)",}, | |
624 | {"ra", "CLASS_REG_WORD+(ARG_RA)",}, | |
625 | {"rs", "CLASS_REG_WORD+(ARG_RS)",}, | |
626 | ||
627 | {"1", "CLASS_IMM+(ARG_IMM_1)",}, | |
628 | {"2", "CLASS_IMM+(ARG_IMM_2)",}, | |
629 | ||
630 | 0, 0 | |
631 | }; | |
632 | ||
633 | struct tok_struct toks[] = | |
634 | { | |
635 | "0000", "CLASS_BIT+0", 1, | |
636 | "0001", "CLASS_BIT+1", 1, | |
637 | "0010", "CLASS_BIT+2", 1, | |
638 | "0011", "CLASS_BIT+3", 1, | |
639 | "0100", "CLASS_BIT+4", 1, | |
640 | "0101", "CLASS_BIT+5", 1, | |
641 | "0110", "CLASS_BIT+6", 1, | |
642 | "0111", "CLASS_BIT+7", 1, | |
643 | "1000", "CLASS_BIT+8", 1, | |
644 | "1001", "CLASS_BIT+9", 1, | |
645 | "1010", "CLASS_BIT+0xa", 1, | |
646 | "1011", "CLASS_BIT+0xb", 1, | |
647 | "1100", "CLASS_BIT+0xc", 1, | |
648 | "1101", "CLASS_BIT+0xd", 1, | |
649 | "1110", "CLASS_BIT+0xe", 1, | |
650 | "1111", "CLASS_BIT+0xf", 1, | |
651 | ||
652 | "00I0", "CLASS_BIT_1OR2+0", 1, | |
653 | "00I0", "CLASS_BIT_1OR2+1", 1, | |
654 | "00I0", "CLASS_BIT_1OR2+2", 1, | |
655 | "00I0", "CLASS_BIT_1OR2+3", 1, | |
656 | "01I0", "CLASS_BIT_1OR2+4", 1, | |
657 | "01I0", "CLASS_BIT_1OR2+5", 1, | |
658 | "01I0", "CLASS_BIT_1OR2+6", 1, | |
659 | "01I0", "CLASS_BIT_1OR2+7", 1, | |
660 | "10I0", "CLASS_BIT_1OR2+8", 1, | |
661 | "10I0", "CLASS_BIT_1OR2+9", 1, | |
662 | "10I0", "CLASS_BIT_1OR2+0xa", 1, | |
663 | "10I0", "CLASS_BIT_1OR2+0xb", 1, | |
664 | "11I0", "CLASS_BIT_1OR2+0xc", 1, | |
665 | "11I0", "CLASS_BIT_1OR2+0xd", 1, | |
666 | "11I0", "CLASS_BIT_1OR2+0xe", 1, | |
667 | "11I0", "CLASS_BIT_1OR2+0xf", 1, | |
668 | ||
669 | "ssss", "CLASS_REG+(ARG_RS)", 1, | |
670 | "dddd", "CLASS_REG+(ARG_RD)", 1, | |
671 | "aaaa", "CLASS_REG+(ARG_RA)", 1, | |
672 | "bbbb", "CLASS_REG+(ARG_RB)", 1, | |
673 | "rrrr", "CLASS_REG+(ARG_RR)", 1, | |
674 | ||
675 | "ssN0", "CLASS_REGN0+(ARG_RS)", 1, | |
676 | "ddN0", "CLASS_REGN0+(ARG_RD)", 1, | |
677 | "aaN0", "CLASS_REGN0+(ARG_RA)", 1, | |
678 | "bbN0", "CLASS_REGN0+(ARG_RB)", 1, | |
679 | "rrN0", "CLASS_REGN0+(ARG_RR)", 1, | |
680 | ||
681 | "cccc", "CLASS_CC", 1, | |
682 | "nnnn", "CLASS_IMM+(ARG_IMMN)", 1, | |
683 | "xxxx", "CLASS_REG+(ARG_RX)", 1, | |
684 | "xxN0", "CLASS_REGN0+(ARG_RX)", 1, | |
685 | "nminus1", "CLASS_IMM+(ARG_IMMNMINUS1)", 1, | |
686 | ||
687 | "disp16", "CLASS_DISP+(ARG_DISP16)", 4, | |
688 | "disp12", "CLASS_DISP+(ARG_DISP12)", 3, | |
689 | "flags", "CLASS_FLAGS", 1, | |
690 | "address_dst", "CLASS_ADDRESS+(ARG_DST)", 4, | |
691 | "address_src", "CLASS_ADDRESS+(ARG_SRC)", 4, | |
692 | "imm4m1", "CLASS_IMM+(ARG_IMM4M1)", 1, | |
693 | "imm4", "CLASS_IMM+(ARG_IMM4)", 1, | |
694 | ||
695 | "imm8", "CLASS_IMM+(ARG_IMM8)", 2, | |
696 | "imm16", "CLASS_IMM+(ARG_IMM16)", 4, | |
697 | "imm32", "CLASS_IMM+(ARG_IMM32)", 8, | |
698 | "nim8", "CLASS_IMM+(ARG_NIM8)", 2, | |
699 | "0ccc", "CLASS_0CCC", 1, | |
700 | "1ccc", "CLASS_1CCC", 1, | |
701 | "disp8", "CLASS_DISP8", 2, | |
702 | "0disp7", "CLASS_0DISP7", 2, | |
703 | "1disp7", "CLASS_1DISP7", 2, | |
704 | "01ii", "CLASS_01II", 1, | |
705 | "00ii", "CLASS_00II", 1, | |
706 | 0, 0 | |
252b5132 RH |
707 | }; |
708 | ||
709 | char * | |
710 | translate (table, x, length) | |
711 | struct tok_struct *table; | |
712 | char *x; | |
713 | int *length; | |
714 | { | |
715 | ||
716 | int found; | |
717 | ||
718 | found = 0; | |
719 | while (table->match) | |
720 | { | |
721 | int l = strlen (table->match); | |
722 | ||
723 | if (strncmp (table->match, x, l) == 0) | |
724 | { | |
725 | /* Got a hit */ | |
726 | printf ("%s", table->token); | |
727 | *length += table->length; | |
728 | return x + l; | |
729 | } | |
730 | ||
731 | table++; | |
732 | } | |
733 | fprintf (stderr, "Can't find %s\n", x); | |
734 | printf ("**** Can't find %s\n", x); | |
735 | while (*x) | |
736 | x++; | |
737 | return x; | |
738 | } | |
739 | ||
740 | void | |
741 | chewbits (bits, length) | |
742 | char *bits; | |
743 | int *length; | |
744 | { | |
745 | int n = 0; | |
746 | ||
747 | *length = 0; | |
748 | printf ("{"); | |
749 | while (*bits) | |
750 | { | |
751 | while (*bits == ' ') | |
752 | { | |
753 | bits++; | |
754 | } | |
755 | bits = translate (toks, bits, length); | |
756 | n++; | |
757 | printf (","); | |
758 | ||
759 | } | |
760 | while (n < BYTE_INFO_LEN - 1) | |
761 | { | |
762 | printf ("0,"); | |
763 | n++; | |
764 | } | |
765 | printf ("}"); | |
766 | } | |
767 | ||
768 | ||
769 | static | |
770 | int | |
771 | chewname (name) | |
772 | char *name; | |
773 | { | |
774 | char *n; | |
775 | int nargs = 0; | |
776 | ||
777 | n = name; | |
778 | printf ("\""); | |
779 | while (*n && !iswhite (*n)) | |
780 | { | |
781 | printf ("%c", *n); | |
782 | n++; | |
783 | } | |
784 | printf ("\","); /* Scan the operands and make entires for | |
785 | them -remember indirect things */ | |
786 | ||
787 | n = name; | |
788 | printf ("OPC_"); | |
789 | while (*n && !iswhite (*n)) | |
790 | { | |
791 | printf ("%c", *n); | |
792 | n++; | |
793 | } | |
794 | printf (",0,{"); | |
795 | ||
796 | while (*n) | |
797 | { | |
798 | int d; | |
799 | ||
800 | while (*n == ',' || iswhite (*n)) | |
801 | n++; | |
802 | nargs++; | |
803 | n = translate (args, n, &d); | |
804 | printf (","); | |
805 | } | |
806 | if (nargs == 0) | |
807 | { | |
808 | printf ("0"); | |
809 | } | |
810 | printf ("},"); | |
811 | return nargs; | |
812 | } | |
813 | ||
814 | static | |
815 | void | |
816 | sub (x, c) | |
817 | char *x; | |
818 | char c; | |
819 | { | |
820 | while (*x) | |
821 | { | |
822 | if (x[0] == c && x[1] == c && | |
823 | x[2] == c && x[3] == c) | |
824 | { | |
825 | x[2] = 'N'; | |
826 | x[3] = '0'; | |
827 | } | |
828 | x++; | |
829 | } | |
830 | } | |
831 | ||
832 | ||
833 | #if 0 | |
834 | #define D(x) ((x) == '1' || (x) =='0') | |
835 | #define M(y) (strncmp(y,x,4)==0) | |
836 | printmangled (x) | |
837 | char *x; | |
838 | { | |
839 | return; | |
840 | while (*x) | |
841 | { | |
842 | if (D (x[0]) && D (x[1]) && D (x[2]) && D (x[3])) | |
843 | { | |
844 | printf ("XXXX"); | |
845 | } | |
846 | else if (M ("ssss")) | |
847 | { | |
848 | printf ("ssss"); | |
849 | } | |
850 | else if (M ("dddd")) | |
851 | { | |
852 | printf ("dddd"); | |
853 | } | |
854 | else | |
855 | printf ("____"); | |
856 | ||
857 | x += 4; | |
858 | ||
859 | if (x[0] == ' ') | |
860 | { | |
861 | printf ("_"); | |
862 | x++; | |
863 | } | |
864 | } | |
865 | ||
866 | } | |
867 | ||
868 | #endif | |
869 | /*#define WORK_TYPE*/ | |
870 | void | |
871 | print_type (n) | |
872 | struct op *n; | |
873 | { | |
874 | #ifdef WORK_TYPE | |
875 | while (*s && !iswhite (*s)) | |
876 | { | |
877 | l = *s; | |
878 | s++; | |
879 | } | |
880 | switch (l) | |
881 | { | |
882 | case 'l': | |
883 | printf ("32,"); | |
884 | break; | |
885 | case 'b': | |
886 | printf ("8,"); | |
887 | break; | |
888 | default: | |
889 | printf ("16,"); | |
890 | break; | |
891 | } | |
892 | #else | |
893 | printf ("%2d,", n->type); | |
894 | #endif | |
895 | } | |
896 | ||
897 | ||
898 | void | |
899 | internal () | |
900 | { | |
901 | int c = count (); | |
28bab82b | 902 | struct op *new = (struct op *) xmalloc (sizeof (struct op) * c); |
252b5132 RH |
903 | struct op *p = opt; |
904 | memcpy (new, p, c * sizeof (struct op)); | |
905 | ||
906 | /* sort all names in table alphabetically */ | |
907 | qsort (new, c, sizeof (struct op), func); | |
908 | ||
909 | p = new; | |
910 | while (p->flags[0] != '*') | |
911 | { | |
912 | /* If there are any @rs, sub the ssss into a ssn0, | |
913 | (rs), (ssn0) | |
914 | */ | |
915 | int loop = 1; | |
916 | ||
917 | printf ("\"%s\",%2d, ", p->flags, p->cycles); | |
918 | while (loop) | |
919 | { | |
920 | char *s = p->name; | |
921 | ||
922 | loop = 0; | |
923 | while (*s) | |
924 | { | |
925 | if (s[0] == '@') | |
926 | { | |
927 | char c; | |
928 | ||
929 | /* skip the r and sub the string */ | |
930 | s++; | |
931 | c = s[1]; | |
932 | sub (p->bits, c); | |
933 | } | |
934 | if (s[0] == '(' && s[3] == ')') | |
935 | { | |
936 | sub (p->bits, s[2]); | |
937 | } | |
938 | if (s[0] == '(') | |
939 | { | |
940 | sub (p->bits, s[-1]); | |
941 | } | |
942 | ||
943 | s++; | |
944 | } | |
945 | ||
946 | } | |
947 | print_type (p); | |
948 | printf ("\"%s\",\"%s\",0,\n", p->bits, p->name); | |
949 | p++; | |
950 | } | |
951 | } | |
952 | ||
953 | static | |
954 | void | |
955 | gas () | |
956 | { | |
957 | int c = count (); | |
958 | struct op *p = opt; | |
959 | int idx = 0; | |
960 | char *oldname = ""; | |
28bab82b | 961 | struct op *new = (struct op *) xmalloc (sizeof (struct op) * c); |
252b5132 RH |
962 | |
963 | memcpy (new, p, c * sizeof (struct op)); | |
964 | ||
965 | /* sort all names in table alphabetically */ | |
966 | qsort (new, c, sizeof (struct op), func); | |
967 | ||
968 | printf (" /* THIS FILE IS AUTOMAGICALLY GENERATED, DON'T EDIT IT */\n"); | |
969 | ||
970 | printf ("#define ARG_MASK 0x0f\n"); | |
971 | ||
972 | printf ("#define ARG_SRC 0x01\n"); | |
973 | printf ("#define ARG_DST 0x02\n"); | |
974 | ||
975 | printf ("#define ARG_RS 0x01\n"); | |
976 | printf ("#define ARG_RD 0x02\n"); | |
977 | printf ("#define ARG_RA 0x03\n"); | |
978 | printf ("#define ARG_RB 0x04\n"); | |
979 | printf ("#define ARG_RR 0x05\n"); | |
980 | printf ("#define ARG_RX 0x06\n"); | |
981 | printf ("#define ARG_IMM4 0x01\n"); | |
982 | printf ("#define ARG_IMM8 0x02\n"); | |
983 | printf ("#define ARG_IMM16 0x03\n"); | |
984 | printf ("#define ARG_IMM32 0x04\n"); | |
985 | printf ("#define ARG_IMMN 0x05\n"); | |
986 | printf ("#define ARG_IMMNMINUS1 0x05\n"); | |
987 | printf ("#define ARG_IMM_1 0x06\n"); | |
988 | printf ("#define ARG_IMM_2 0x07\n"); | |
989 | printf ("#define ARG_DISP16 0x08\n"); | |
990 | printf ("#define ARG_NIM8 0x09\n"); | |
991 | printf ("#define ARG_IMM2 0x0a\n"); | |
992 | printf ("#define ARG_IMM1OR2 0x0b\n"); | |
993 | ||
994 | printf ("#define ARG_DISP12 0x0b\n"); | |
995 | printf ("#define ARG_DISP8 0x0c\n"); | |
996 | printf ("#define ARG_IMM4M1 0x0d\n"); | |
997 | printf ("#define CLASS_MASK 0x1fff0\n"); | |
998 | printf ("#define CLASS_X 0x10\n"); | |
999 | printf ("#define CLASS_BA 0x20\n"); | |
1000 | printf ("#define CLASS_DA 0x30\n"); | |
1001 | printf ("#define CLASS_BX 0x40\n"); | |
1002 | printf ("#define CLASS_DISP 0x50\n"); | |
1003 | printf ("#define CLASS_IMM 0x60\n"); | |
1004 | printf ("#define CLASS_CC 0x70\n"); | |
1005 | printf ("#define CLASS_CTRL 0x80\n"); | |
1006 | printf ("#define CLASS_ADDRESS 0xd0\n"); | |
1007 | printf ("#define CLASS_0CCC 0xe0\n"); | |
1008 | printf ("#define CLASS_1CCC 0xf0\n"); | |
1009 | printf ("#define CLASS_0DISP7 0x100\n"); | |
1010 | printf ("#define CLASS_1DISP7 0x200\n"); | |
1011 | printf ("#define CLASS_01II 0x300\n"); | |
1012 | printf ("#define CLASS_00II 0x400\n"); | |
1013 | printf ("#define CLASS_BIT 0x500\n"); | |
1014 | printf ("#define CLASS_FLAGS 0x600\n"); | |
1015 | printf ("#define CLASS_IR 0x700\n"); | |
1016 | printf ("#define CLASS_DISP8 0x800\n"); | |
1017 | ||
1018 | printf ("#define CLASS_BIT_1OR2 0x900\n"); | |
1019 | printf ("#define CLASS_REG 0x7000\n"); | |
1020 | printf ("#define CLASS_REG_BYTE 0x2000\n"); | |
1021 | printf ("#define CLASS_REG_WORD 0x3000\n"); | |
1022 | printf ("#define CLASS_REG_QUAD 0x4000\n"); | |
1023 | printf ("#define CLASS_REG_LONG 0x5000\n"); | |
1024 | printf ("#define CLASS_REGN0 0x8000\n"); | |
1025 | printf ("#define CLASS_PR 0x10000\n"); | |
1026 | ||
1027 | printf ("#define OPC_adc 0\n"); | |
1028 | printf ("#define OPC_adcb 1\n"); | |
1029 | printf ("#define OPC_add 2\n"); | |
1030 | printf ("#define OPC_addb 3\n"); | |
1031 | printf ("#define OPC_addl 4\n"); | |
1032 | printf ("#define OPC_and 5\n"); | |
1033 | printf ("#define OPC_andb 6\n"); | |
1034 | printf ("#define OPC_bit 7\n"); | |
1035 | printf ("#define OPC_bitb 8\n"); | |
1036 | printf ("#define OPC_call 9\n"); | |
1037 | printf ("#define OPC_calr 10\n"); | |
1038 | printf ("#define OPC_clr 11\n"); | |
1039 | printf ("#define OPC_clrb 12\n"); | |
1040 | printf ("#define OPC_com 13\n"); | |
1041 | printf ("#define OPC_comb 14\n"); | |
1042 | printf ("#define OPC_comflg 15\n"); | |
1043 | printf ("#define OPC_cp 16\n"); | |
1044 | printf ("#define OPC_cpb 17\n"); | |
1045 | printf ("#define OPC_cpd 18\n"); | |
1046 | printf ("#define OPC_cpdb 19\n"); | |
1047 | printf ("#define OPC_cpdr 20\n"); | |
1048 | printf ("#define OPC_cpdrb 21\n"); | |
1049 | printf ("#define OPC_cpi 22\n"); | |
1050 | printf ("#define OPC_cpib 23\n"); | |
1051 | printf ("#define OPC_cpir 24\n"); | |
1052 | printf ("#define OPC_cpirb 25\n"); | |
1053 | printf ("#define OPC_cpl 26\n"); | |
1054 | printf ("#define OPC_cpsd 27\n"); | |
1055 | printf ("#define OPC_cpsdb 28\n"); | |
1056 | printf ("#define OPC_cpsdr 29\n"); | |
1057 | printf ("#define OPC_cpsdrb 30\n"); | |
1058 | printf ("#define OPC_cpsi 31\n"); | |
1059 | printf ("#define OPC_cpsib 32\n"); | |
1060 | printf ("#define OPC_cpsir 33\n"); | |
1061 | printf ("#define OPC_cpsirb 34\n"); | |
1062 | printf ("#define OPC_dab 35\n"); | |
1063 | printf ("#define OPC_dbjnz 36\n"); | |
1064 | printf ("#define OPC_dec 37\n"); | |
1065 | printf ("#define OPC_decb 38\n"); | |
1066 | printf ("#define OPC_di 39\n"); | |
1067 | printf ("#define OPC_div 40\n"); | |
1068 | printf ("#define OPC_divl 41\n"); | |
1069 | printf ("#define OPC_djnz 42\n"); | |
1070 | printf ("#define OPC_ei 43\n"); | |
1071 | printf ("#define OPC_ex 44\n"); | |
1072 | printf ("#define OPC_exb 45\n"); | |
1073 | printf ("#define OPC_exts 46\n"); | |
1074 | printf ("#define OPC_extsb 47\n"); | |
1075 | printf ("#define OPC_extsl 48\n"); | |
1076 | printf ("#define OPC_halt 49\n"); | |
1077 | printf ("#define OPC_in 50\n"); | |
1078 | printf ("#define OPC_inb 51\n"); | |
1079 | printf ("#define OPC_inc 52\n"); | |
1080 | printf ("#define OPC_incb 53\n"); | |
1081 | printf ("#define OPC_ind 54\n"); | |
1082 | printf ("#define OPC_indb 55\n"); | |
1083 | printf ("#define OPC_inib 56\n"); | |
1084 | printf ("#define OPC_inibr 57\n"); | |
1085 | printf ("#define OPC_iret 58\n"); | |
1086 | printf ("#define OPC_jp 59\n"); | |
1087 | printf ("#define OPC_jr 60\n"); | |
1088 | printf ("#define OPC_ld 61\n"); | |
1089 | printf ("#define OPC_lda 62\n"); | |
1090 | printf ("#define OPC_ldar 63\n"); | |
1091 | printf ("#define OPC_ldb 64\n"); | |
1092 | printf ("#define OPC_ldctl 65\n"); | |
1093 | printf ("#define OPC_ldir 66\n"); | |
1094 | printf ("#define OPC_ldirb 67\n"); | |
1095 | printf ("#define OPC_ldk 68\n"); | |
1096 | printf ("#define OPC_ldl 69\n"); | |
1097 | printf ("#define OPC_ldm 70\n"); | |
1098 | printf ("#define OPC_ldps 71\n"); | |
1099 | printf ("#define OPC_ldr 72\n"); | |
1100 | printf ("#define OPC_ldrb 73\n"); | |
1101 | printf ("#define OPC_ldrl 74\n"); | |
1102 | printf ("#define OPC_mbit 75\n"); | |
1103 | printf ("#define OPC_mreq 76\n"); | |
1104 | printf ("#define OPC_mres 77\n"); | |
1105 | printf ("#define OPC_mset 78\n"); | |
1106 | printf ("#define OPC_mult 79\n"); | |
1107 | printf ("#define OPC_multl 80\n"); | |
1108 | printf ("#define OPC_neg 81\n"); | |
1109 | printf ("#define OPC_negb 82\n"); | |
1110 | printf ("#define OPC_nop 83\n"); | |
1111 | printf ("#define OPC_or 84\n"); | |
1112 | printf ("#define OPC_orb 85\n"); | |
1113 | printf ("#define OPC_out 86\n"); | |
1114 | printf ("#define OPC_outb 87\n"); | |
1115 | printf ("#define OPC_outd 88\n"); | |
1116 | printf ("#define OPC_outdb 89\n"); | |
1117 | printf ("#define OPC_outib 90\n"); | |
1118 | printf ("#define OPC_outibr 91\n"); | |
1119 | printf ("#define OPC_pop 92\n"); | |
1120 | printf ("#define OPC_popl 93\n"); | |
1121 | printf ("#define OPC_push 94\n"); | |
1122 | printf ("#define OPC_pushl 95\n"); | |
1123 | printf ("#define OPC_res 96\n"); | |
1124 | printf ("#define OPC_resb 97\n"); | |
1125 | printf ("#define OPC_resflg 98\n"); | |
1126 | printf ("#define OPC_ret 99\n"); | |
1127 | printf ("#define OPC_rl 100\n"); | |
1128 | printf ("#define OPC_rlb 101\n"); | |
1129 | printf ("#define OPC_rlc 102\n"); | |
1130 | printf ("#define OPC_rlcb 103\n"); | |
1131 | printf ("#define OPC_rldb 104\n"); | |
1132 | printf ("#define OPC_rr 105\n"); | |
1133 | printf ("#define OPC_rrb 106\n"); | |
1134 | printf ("#define OPC_rrc 107\n"); | |
1135 | printf ("#define OPC_rrcb 108\n"); | |
1136 | printf ("#define OPC_rrdb 109\n"); | |
1137 | printf ("#define OPC_sbc 110\n"); | |
1138 | printf ("#define OPC_sbcb 111\n"); | |
1139 | printf ("#define OPC_sda 112\n"); | |
1140 | printf ("#define OPC_sdab 113\n"); | |
1141 | printf ("#define OPC_sdal 114\n"); | |
1142 | printf ("#define OPC_sdl 115\n"); | |
1143 | printf ("#define OPC_sdlb 116\n"); | |
1144 | printf ("#define OPC_sdll 117\n"); | |
1145 | printf ("#define OPC_set 118\n"); | |
1146 | printf ("#define OPC_setb 119\n"); | |
1147 | printf ("#define OPC_setflg 120\n"); | |
1148 | printf ("#define OPC_sinb 121\n"); | |
1149 | printf ("#define OPC_sind 122\n"); | |
1150 | printf ("#define OPC_sindb 123\n"); | |
1151 | printf ("#define OPC_sinib 124\n"); | |
1152 | printf ("#define OPC_sinibr 125\n"); | |
1153 | printf ("#define OPC_sla 126\n"); | |
1154 | printf ("#define OPC_slab 127\n"); | |
1155 | printf ("#define OPC_slal 128\n"); | |
1156 | printf ("#define OPC_sll 129\n"); | |
1157 | printf ("#define OPC_sllb 130\n"); | |
1158 | printf ("#define OPC_slll 131\n"); | |
1159 | printf ("#define OPC_sout 132\n"); | |
1160 | printf ("#define OPC_soutb 133\n"); | |
1161 | printf ("#define OPC_soutd 134\n"); | |
1162 | printf ("#define OPC_soutdb 135\n"); | |
1163 | printf ("#define OPC_soutib 136\n"); | |
1164 | printf ("#define OPC_soutibr 137\n"); | |
1165 | printf ("#define OPC_sra 138\n"); | |
1166 | printf ("#define OPC_srab 139\n"); | |
1167 | printf ("#define OPC_sral 140\n"); | |
1168 | printf ("#define OPC_srl 141\n"); | |
1169 | printf ("#define OPC_srlb 142\n"); | |
1170 | printf ("#define OPC_srll 143\n"); | |
1171 | printf ("#define OPC_sub 144\n"); | |
1172 | printf ("#define OPC_subb 145\n"); | |
1173 | printf ("#define OPC_subl 146\n"); | |
1174 | printf ("#define OPC_tcc 147\n"); | |
1175 | printf ("#define OPC_tccb 148\n"); | |
1176 | printf ("#define OPC_test 149\n"); | |
1177 | printf ("#define OPC_testb 150\n"); | |
1178 | printf ("#define OPC_testl 151\n"); | |
1179 | printf ("#define OPC_trdb 152\n"); | |
1180 | printf ("#define OPC_trdrb 153\n"); | |
1181 | printf ("#define OPC_trib 154\n"); | |
1182 | printf ("#define OPC_trirb 155\n"); | |
1183 | printf ("#define OPC_trtdrb 156\n"); | |
1184 | printf ("#define OPC_trtib 157\n"); | |
1185 | printf ("#define OPC_trtirb 158\n"); | |
1186 | printf ("#define OPC_trtrb 159\n"); | |
1187 | printf ("#define OPC_tset 160\n"); | |
1188 | printf ("#define OPC_tsetb 161\n"); | |
1189 | printf ("#define OPC_xor 162\n"); | |
1190 | printf ("#define OPC_xorb 163\n"); | |
1191 | ||
1192 | printf ("#define OPC_ldd 164 \n"); | |
1193 | printf ("#define OPC_lddb 165 \n"); | |
1194 | printf ("#define OPC_lddr 166 \n"); | |
1195 | printf ("#define OPC_lddrb 167 \n"); | |
1196 | printf ("#define OPC_ldi 168 \n"); | |
1197 | printf ("#define OPC_ldib 169 \n"); | |
1198 | printf ("#define OPC_sc 170\n"); | |
1199 | printf ("#define OPC_bpt 171\n"); | |
1200 | printf ("#define OPC_ext0e 172\n"); | |
1201 | printf ("#define OPC_ext0f 172\n"); | |
1202 | printf ("#define OPC_ext8e 172\n"); | |
1203 | printf ("#define OPC_ext8f 172\n"); | |
1204 | printf ("#define OPC_rsvd36 172\n"); | |
1205 | printf ("#define OPC_rsvd38 172\n"); | |
1206 | printf ("#define OPC_rsvd78 172\n"); | |
1207 | printf ("#define OPC_rsvd7e 172\n"); | |
1208 | printf ("#define OPC_rsvd9d 172\n"); | |
1209 | printf ("#define OPC_rsvd9f 172\n"); | |
1210 | printf ("#define OPC_rsvdb9 172\n"); | |
1211 | printf ("#define OPC_rsvdbf 172\n"); | |
6840198f NC |
1212 | printf ("#define OPC_outi 173\n"); |
1213 | printf ("#define OPC_ldctlb 174\n"); | |
1214 | printf ("#define OPC_sin 175\n"); | |
1215 | printf ("#define OPC_trtdb 176\n"); | |
252b5132 RH |
1216 | #if 0 |
1217 | for (i = 0; toks[i].token; i++) | |
1218 | printf ("#define %s\t0x%x\n", toks[i].token, i * 16); | |
1219 | #endif | |
1220 | printf ("typedef struct {\n"); | |
1221 | ||
1222 | printf ("#ifdef NICENAMES\n"); | |
1223 | printf ("char *nicename;\n"); | |
1224 | printf ("int type;\n"); | |
1225 | printf ("int cycles;\n"); | |
1226 | printf ("int flags;\n"); | |
1227 | printf ("#endif\n"); | |
1228 | printf ("char *name;\n"); | |
1229 | printf ("unsigned char opcode;\n"); | |
fc05c67f | 1230 | printf ("void (*func) PARAMS ((void));\n"); |
252b5132 RH |
1231 | printf ("unsigned int arg_info[4];\n"); |
1232 | printf ("unsigned int byte_info[%d];\n", BYTE_INFO_LEN); | |
1233 | printf ("int noperands;\n"); | |
1234 | printf ("int length;\n"); | |
1235 | printf ("int idx;\n"); | |
1236 | printf ("} opcode_entry_type;\n"); | |
1237 | printf ("#ifdef DEFINE_TABLE\n"); | |
1238 | printf ("opcode_entry_type z8k_table[] = {\n"); | |
1239 | ||
1240 | while (new->flags && new->flags[0]) | |
1241 | { | |
1242 | int nargs; | |
1243 | int length; | |
1244 | ||
1245 | printf ("\n\n/* %s *** %s */\n", new->bits, new->name); | |
1246 | printf ("{\n"); | |
1247 | ||
1248 | printf ("#ifdef NICENAMES\n"); | |
1249 | printf ("\"%s\",%d,%d,\n", new->name, new->type, new->cycles); | |
1250 | { | |
1251 | int answer = 0; | |
1252 | char *p = new->flags; | |
1253 | ||
1254 | while (*p) | |
1255 | { | |
1256 | answer <<= 1; | |
1257 | ||
1258 | if (*p != '-') | |
1259 | answer |= 1; | |
1260 | p++; | |
1261 | } | |
1262 | printf ("0x%02x,\n", answer); | |
1263 | } | |
1264 | ||
1265 | printf ("#endif\n"); | |
1266 | ||
1267 | nargs = chewname (new->name); | |
1268 | ||
1269 | printf ("\n\t"); | |
1270 | chewbits (new->bits, &length); | |
1271 | length /= 2; | |
1272 | if (length & 1) | |
1273 | abort(); | |
1274 | ||
1275 | printf (",%d,%d,%d", nargs, length, idx); | |
1276 | idx++; | |
1277 | oldname = new->name; | |
1278 | printf ("},\n"); | |
1279 | new++; | |
1280 | } | |
28bab82b NC |
1281 | printf ("\n/* end marker */\n"); |
1282 | printf ("{\n#ifdef NICENAMES\nNULL,0,0,\n0,\n#endif\n"); | |
1283 | printf ("NULL,0,0,{0,0,0,0},{0,0,0,0,0,0,0,0,0,0},0,0,0}\n};\n"); | |
252b5132 RH |
1284 | printf ("#endif\n"); |
1285 | } | |
1286 | ||
1287 | ||
1288 | int | |
1289 | main (ac, av) | |
1290 | int ac; | |
1291 | char **av; | |
1292 | { | |
1293 | struct op *p = opt; | |
1294 | ||
1295 | if (ac == 2 && strcmp (av[1], "-t") == 0) | |
1296 | { | |
1297 | internal (); | |
1298 | } | |
1299 | else if (ac == 2 && strcmp (av[1], "-h") == 0) | |
1300 | { | |
1301 | while (p->name) | |
1302 | { | |
1303 | printf ("%-25s\t%s\n", p->name, p->bits); | |
1304 | p++; | |
1305 | } | |
1306 | } | |
1307 | ||
1308 | else if (ac == 2 && strcmp (av[1], "-a") == 0) | |
1309 | { | |
1310 | gas (); | |
1311 | } | |
1312 | else if (ac == 2 && strcmp (av[1], "-d") == 0) | |
1313 | { | |
1314 | /*dis();*/ | |
1315 | } | |
1316 | else | |
1317 | { | |
1318 | printf ("Usage: %s -t\n", av[0]); | |
1319 | printf ("-t : generate new z8.c internal table\n"); | |
1320 | printf ("-a : generate new table for gas\n"); | |
1321 | printf ("-d : generate new table for disassemble\n"); | |
1322 | printf ("-h : generate new table for humans\n"); | |
1323 | } | |
28bab82b | 1324 | return 0; |
252b5132 | 1325 | } |