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