• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2// M6809/HD6309 PAGE1 instructions
3static const inst_page1 g_m6809_inst_page1_table[256] = {
4	// 0x0x, direct instructions
5	{ M680X_INS_NEG, dir_hid, inh_hid },
6	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
7	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
8	{ M680X_INS_COM, dir_hid, inh_hid },
9	{ M680X_INS_LSR, dir_hid, inh_hid },
10	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
11	{ M680X_INS_ROR, dir_hid, inh_hid },
12	{ M680X_INS_ASR, dir_hid, inh_hid },
13	{ M680X_INS_LSL, dir_hid, inh_hid },
14	{ M680X_INS_ROL, dir_hid, inh_hid },
15	{ M680X_INS_DEC, dir_hid, inh_hid },
16	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
17	{ M680X_INS_INC, dir_hid, inh_hid },
18	{ M680X_INS_TST, dir_hid, inh_hid },
19	{ M680X_INS_JMP, dir_hid, inh_hid },
20	{ M680X_INS_CLR, dir_hid, inh_hid },
21	// 0x1x, misc instructions
22	{ M680X_INS_ILLGL, illgl_hid, inh_hid }, // PAGE2
23	{ M680X_INS_ILLGL, illgl_hid, inh_hid }, // PAGE3
24	{ M680X_INS_NOP, inh_hid, inh_hid },
25	{ M680X_INS_SYNC, inh_hid, inh_hid },
26	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
27	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
28	{ M680X_INS_LBRA, rel16_hid, inh_hid },
29	{ M680X_INS_LBSR, rel16_hid, inh_hid },
30	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
31	{ M680X_INS_DAA, inh_hid, inh_hid },
32	{ M680X_INS_ORCC, imm8_hid, inh_hid },
33	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
34	{ M680X_INS_ANDCC, imm8_hid, inh_hid },
35	{ M680X_INS_SEX, inh_hid, inh_hid },
36	{ M680X_INS_EXG, rr09_hid, inh_hid },
37	{ M680X_INS_TFR, rr09_hid, inh_hid },
38	// 0x2x, relative branch instructions
39	{ M680X_INS_BRA, rel8_hid, inh_hid },
40	{ M680X_INS_BRN, rel8_hid, inh_hid },
41	{ M680X_INS_BHI, rel8_hid, inh_hid },
42	{ M680X_INS_BLS, rel8_hid, inh_hid },
43	{ M680X_INS_BCC, rel8_hid, inh_hid },
44	{ M680X_INS_BCS, rel8_hid, inh_hid },
45	{ M680X_INS_BNE, rel8_hid, inh_hid },
46	{ M680X_INS_BEQ, rel8_hid, inh_hid },
47	{ M680X_INS_BVC, rel8_hid, inh_hid },
48	{ M680X_INS_BVS, rel8_hid, inh_hid },
49	{ M680X_INS_BPL, rel8_hid, inh_hid },
50	{ M680X_INS_BMI, rel8_hid, inh_hid },
51	{ M680X_INS_BGE, rel8_hid, inh_hid },
52	{ M680X_INS_BLT, rel8_hid, inh_hid },
53	{ M680X_INS_BGT, rel8_hid, inh_hid },
54	{ M680X_INS_BLE, rel8_hid, inh_hid },
55	// 0x3x, misc instructions
56	{ M680X_INS_LEAX, idx09_hid, inh_hid },
57	{ M680X_INS_LEAY, idx09_hid, inh_hid },
58	{ M680X_INS_LEAS, idx09_hid, inh_hid },
59	{ M680X_INS_LEAU, idx09_hid, inh_hid },
60	{ M680X_INS_PSHS, rbits_hid, inh_hid },
61	{ M680X_INS_PULS, rbits_hid, inh_hid },
62	{ M680X_INS_PSHU, rbits_hid, inh_hid },
63	{ M680X_INS_PULU, rbits_hid, inh_hid },
64	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
65	{ M680X_INS_RTS, inh_hid, inh_hid },
66	{ M680X_INS_ABX, inh_hid, inh_hid },
67	{ M680X_INS_RTI, inh_hid, inh_hid },
68	{ M680X_INS_CWAI, imm8_hid, inh_hid },
69	{ M680X_INS_MUL, inh_hid, inh_hid },
70	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
71	{ M680X_INS_SWI, inh_hid, inh_hid },
72	// 0x4x, Register A instructions
73	{ M680X_INS_NEGA, inh_hid, inh_hid },
74	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
75	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
76	{ M680X_INS_COMA, inh_hid, inh_hid },
77	{ M680X_INS_LSRA, inh_hid, inh_hid },
78	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
79	{ M680X_INS_RORA, inh_hid, inh_hid },
80	{ M680X_INS_ASRA, inh_hid, inh_hid },
81	{ M680X_INS_LSLA, inh_hid, inh_hid },
82	{ M680X_INS_ROLA, inh_hid, inh_hid },
83	{ M680X_INS_DECA, inh_hid, inh_hid },
84	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
85	{ M680X_INS_INCA, inh_hid, inh_hid },
86	{ M680X_INS_TSTA, inh_hid, inh_hid },
87	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
88	{ M680X_INS_CLRA, inh_hid, inh_hid },
89	// 0x5x, Register B instructions
90	{ M680X_INS_NEGB, inh_hid, inh_hid },
91	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
92	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
93	{ M680X_INS_COMB, inh_hid, inh_hid },
94	{ M680X_INS_LSRB, inh_hid, inh_hid },
95	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
96	{ M680X_INS_RORB, inh_hid, inh_hid },
97	{ M680X_INS_ASRB, inh_hid, inh_hid },
98	{ M680X_INS_LSLB, inh_hid, inh_hid },
99	{ M680X_INS_ROLB, inh_hid, inh_hid },
100	{ M680X_INS_DECB, inh_hid, inh_hid },
101	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
102	{ M680X_INS_INCB, inh_hid, inh_hid },
103	{ M680X_INS_TSTB, inh_hid, inh_hid },
104	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
105	{ M680X_INS_CLRB, inh_hid, inh_hid },
106	// 0x6x, indexed instructions
107	{ M680X_INS_NEG, idx09_hid, inh_hid },
108	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
109	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
110	{ M680X_INS_COM, idx09_hid, inh_hid },
111	{ M680X_INS_LSR, idx09_hid, inh_hid },
112	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
113	{ M680X_INS_ROR, idx09_hid, inh_hid },
114	{ M680X_INS_ASR, idx09_hid, inh_hid },
115	{ M680X_INS_LSL, idx09_hid, inh_hid },
116	{ M680X_INS_ROL, idx09_hid, inh_hid },
117	{ M680X_INS_DEC, idx09_hid, inh_hid },
118	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
119	{ M680X_INS_INC, idx09_hid, inh_hid },
120	{ M680X_INS_TST, idx09_hid, inh_hid },
121	{ M680X_INS_JMP, idx09_hid, inh_hid },
122	{ M680X_INS_CLR, idx09_hid, inh_hid },
123	// 0x7x, extended instructions
124	{ M680X_INS_NEG, ext_hid, inh_hid },
125	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
126	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
127	{ M680X_INS_COM, ext_hid, inh_hid },
128	{ M680X_INS_LSR, ext_hid, inh_hid },
129	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
130	{ M680X_INS_ROR, ext_hid, inh_hid },
131	{ M680X_INS_ASR, ext_hid, inh_hid },
132	{ M680X_INS_LSL, ext_hid, inh_hid },
133	{ M680X_INS_ROL, ext_hid, inh_hid },
134	{ M680X_INS_DEC, ext_hid, inh_hid },
135	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
136	{ M680X_INS_INC, ext_hid, inh_hid },
137	{ M680X_INS_TST, ext_hid, inh_hid },
138	{ M680X_INS_JMP, ext_hid, inh_hid },
139	{ M680X_INS_CLR, ext_hid, inh_hid },
140	// 0x8x, immediate instructions with Register A,D,X
141	{ M680X_INS_SUBA, imm8_hid, inh_hid },
142	{ M680X_INS_CMPA, imm8_hid, inh_hid },
143	{ M680X_INS_SBCA, imm8_hid, inh_hid },
144	{ M680X_INS_SUBD, imm16_hid, inh_hid },
145	{ M680X_INS_ANDA, imm8_hid, inh_hid },
146	{ M680X_INS_BITA, imm8_hid, inh_hid },
147	{ M680X_INS_LDA, imm8_hid, inh_hid },
148	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
149	{ M680X_INS_EORA, imm8_hid, inh_hid },
150	{ M680X_INS_ADCA, imm8_hid, inh_hid },
151	{ M680X_INS_ORA, imm8_hid, inh_hid },
152	{ M680X_INS_ADDA, imm8_hid, inh_hid },
153	{ M680X_INS_CMPX, imm16_hid, inh_hid },
154	{ M680X_INS_BSR, rel8_hid, inh_hid },
155	{ M680X_INS_LDX, imm16_hid, inh_hid },
156	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
157	// 0x9x, direct instructions with register A,D,X
158	{ M680X_INS_SUBA, dir_hid, inh_hid },
159	{ M680X_INS_CMPA, dir_hid, inh_hid },
160	{ M680X_INS_SBCA, dir_hid, inh_hid },
161	{ M680X_INS_SUBD, dir_hid, inh_hid },
162	{ M680X_INS_ANDA, dir_hid, inh_hid },
163	{ M680X_INS_BITA, dir_hid, inh_hid },
164	{ M680X_INS_LDA, dir_hid, inh_hid },
165	{ M680X_INS_STA, dir_hid, inh_hid },
166	{ M680X_INS_EORA, dir_hid, inh_hid },
167	{ M680X_INS_ADCA, dir_hid, inh_hid },
168	{ M680X_INS_ORA, dir_hid, inh_hid },
169	{ M680X_INS_ADDA, dir_hid, inh_hid },
170	{ M680X_INS_CMPX, dir_hid, inh_hid },
171	{ M680X_INS_JSR, dir_hid, inh_hid },
172	{ M680X_INS_LDX, dir_hid, inh_hid },
173	{ M680X_INS_STX, dir_hid, inh_hid },
174	// 0xAx, indexed instructions with Register A,D,X
175	{ M680X_INS_SUBA, idx09_hid, inh_hid },
176	{ M680X_INS_CMPA, idx09_hid, inh_hid },
177	{ M680X_INS_SBCA, idx09_hid, inh_hid },
178	{ M680X_INS_SUBD, idx09_hid, inh_hid },
179	{ M680X_INS_ANDA, idx09_hid, inh_hid },
180	{ M680X_INS_BITA, idx09_hid, inh_hid },
181	{ M680X_INS_LDA, idx09_hid, inh_hid },
182	{ M680X_INS_STA, idx09_hid, inh_hid },
183	{ M680X_INS_EORA, idx09_hid, inh_hid },
184	{ M680X_INS_ADCA, idx09_hid, inh_hid },
185	{ M680X_INS_ORA, idx09_hid, inh_hid },
186	{ M680X_INS_ADDA, idx09_hid, inh_hid },
187	{ M680X_INS_CMPX, idx09_hid, inh_hid },
188	{ M680X_INS_JSR, idx09_hid, inh_hid },
189	{ M680X_INS_LDX, idx09_hid, inh_hid },
190	{ M680X_INS_STX, idx09_hid, inh_hid },
191	// 0xBx, extended instructions with register A,D,X
192	{ M680X_INS_SUBA, ext_hid, inh_hid },
193	{ M680X_INS_CMPA, ext_hid, inh_hid },
194	{ M680X_INS_SBCA, ext_hid, inh_hid },
195	{ M680X_INS_SUBD, ext_hid, inh_hid },
196	{ M680X_INS_ANDA, ext_hid, inh_hid },
197	{ M680X_INS_BITA, ext_hid, inh_hid },
198	{ M680X_INS_LDA, ext_hid, inh_hid },
199	{ M680X_INS_STA, ext_hid, inh_hid },
200	{ M680X_INS_EORA, ext_hid, inh_hid },
201	{ M680X_INS_ADCA, ext_hid, inh_hid },
202	{ M680X_INS_ORA, ext_hid, inh_hid },
203	{ M680X_INS_ADDA, ext_hid, inh_hid },
204	{ M680X_INS_CMPX, ext_hid, inh_hid },
205	{ M680X_INS_JSR, ext_hid, inh_hid },
206	{ M680X_INS_LDX, ext_hid, inh_hid },
207	{ M680X_INS_STX, ext_hid, inh_hid },
208	// 0xCx, immediate instructions with register B,D,U
209	{ M680X_INS_SUBB, imm8_hid, inh_hid },
210	{ M680X_INS_CMPB, imm8_hid, inh_hid },
211	{ M680X_INS_SBCB, imm8_hid, inh_hid },
212	{ M680X_INS_ADDD, imm16_hid, inh_hid },
213	{ M680X_INS_ANDB, imm8_hid, inh_hid },
214	{ M680X_INS_BITB, imm8_hid, inh_hid },
215	{ M680X_INS_LDB, imm8_hid, inh_hid },
216	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
217	{ M680X_INS_EORB, imm8_hid, inh_hid },
218	{ M680X_INS_ADCB, imm8_hid, inh_hid },
219	{ M680X_INS_ORB, imm8_hid, inh_hid },
220	{ M680X_INS_ADDB, imm8_hid, inh_hid },
221	{ M680X_INS_LDD, imm16_hid, inh_hid },
222	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
223	{ M680X_INS_LDU, imm16_hid, inh_hid },
224	{ M680X_INS_ILLGL, illgl_hid, inh_hid },
225	// 0xDx direct instructions with register B,D,U
226	{ M680X_INS_SUBB, dir_hid, inh_hid },
227	{ M680X_INS_CMPB, dir_hid, inh_hid },
228	{ M680X_INS_SBCB, dir_hid, inh_hid },
229	{ M680X_INS_ADDD, dir_hid, inh_hid },
230	{ M680X_INS_ANDB, dir_hid, inh_hid },
231	{ M680X_INS_BITB, dir_hid, inh_hid },
232	{ M680X_INS_LDB, dir_hid, inh_hid },
233	{ M680X_INS_STB, dir_hid, inh_hid },
234	{ M680X_INS_EORB, dir_hid, inh_hid },
235	{ M680X_INS_ADCB, dir_hid, inh_hid },
236	{ M680X_INS_ORB, dir_hid, inh_hid },
237	{ M680X_INS_ADDB, dir_hid, inh_hid },
238	{ M680X_INS_LDD, dir_hid, inh_hid },
239	{ M680X_INS_STD, dir_hid, inh_hid },
240	{ M680X_INS_LDU, dir_hid, inh_hid },
241	{ M680X_INS_STU, dir_hid, inh_hid },
242	// 0xEx, indexed instruction with register B,D,U
243	{ M680X_INS_SUBB, idx09_hid, inh_hid },
244	{ M680X_INS_CMPB, idx09_hid, inh_hid },
245	{ M680X_INS_SBCB, idx09_hid, inh_hid },
246	{ M680X_INS_ADDD, idx09_hid, inh_hid },
247	{ M680X_INS_ANDB, idx09_hid, inh_hid },
248	{ M680X_INS_BITB, idx09_hid, inh_hid },
249	{ M680X_INS_LDB, idx09_hid, inh_hid },
250	{ M680X_INS_STB, idx09_hid, inh_hid },
251	{ M680X_INS_EORB, idx09_hid, inh_hid },
252	{ M680X_INS_ADCB, idx09_hid, inh_hid },
253	{ M680X_INS_ORB, idx09_hid, inh_hid },
254	{ M680X_INS_ADDB, idx09_hid, inh_hid },
255	{ M680X_INS_LDD, idx09_hid, inh_hid },
256	{ M680X_INS_STD, idx09_hid, inh_hid },
257	{ M680X_INS_LDU, idx09_hid, inh_hid },
258	{ M680X_INS_STU, idx09_hid, inh_hid },
259	// 0xFx, extended instructions with register B,D,U
260	{ M680X_INS_SUBB, ext_hid, inh_hid },
261	{ M680X_INS_CMPB, ext_hid, inh_hid },
262	{ M680X_INS_SBCB, ext_hid, inh_hid },
263	{ M680X_INS_ADDD, ext_hid, inh_hid },
264	{ M680X_INS_ANDB, ext_hid, inh_hid },
265	{ M680X_INS_BITB, ext_hid, inh_hid },
266	{ M680X_INS_LDB, ext_hid, inh_hid },
267	{ M680X_INS_STB, ext_hid, inh_hid },
268	{ M680X_INS_EORB, ext_hid, inh_hid },
269	{ M680X_INS_ADCB, ext_hid, inh_hid },
270	{ M680X_INS_ORB, ext_hid, inh_hid },
271	{ M680X_INS_ADDB, ext_hid, inh_hid },
272	{ M680X_INS_LDD, ext_hid, inh_hid },
273	{ M680X_INS_STD, ext_hid, inh_hid },
274	{ M680X_INS_LDU, ext_hid, inh_hid },
275	{ M680X_INS_STU, ext_hid, inh_hid },
276};
277
278// The following array has to be sorted by increasing
279// opcodes. Otherwise the binary_search will fail.
280//
281// M6809 PAGE2 instructions (with prefix 0x10)
282static const inst_pageX g_m6809_inst_page2_table[] = {
283	// 0x2x, relative long branch instructions
284	{ 0x21, M680X_INS_LBRN, rel16_hid, inh_hid },
285	{ 0x22, M680X_INS_LBHI, rel16_hid, inh_hid },
286	{ 0x23, M680X_INS_LBLS, rel16_hid, inh_hid },
287	{ 0x24, M680X_INS_LBCC, rel16_hid, inh_hid },
288	{ 0x25, M680X_INS_LBCS, rel16_hid, inh_hid },
289	{ 0x26, M680X_INS_LBNE, rel16_hid, inh_hid },
290	{ 0x27, M680X_INS_LBEQ, rel16_hid, inh_hid },
291	{ 0x28, M680X_INS_LBVC, rel16_hid, inh_hid },
292	{ 0x29, M680X_INS_LBVS, rel16_hid, inh_hid },
293	{ 0x2a, M680X_INS_LBPL, rel16_hid, inh_hid },
294	{ 0x2b, M680X_INS_LBMI, rel16_hid, inh_hid },
295	{ 0x2c, M680X_INS_LBGE, rel16_hid, inh_hid },
296	{ 0x2d, M680X_INS_LBLT, rel16_hid, inh_hid },
297	{ 0x2e, M680X_INS_LBGT, rel16_hid, inh_hid },
298	{ 0x2f, M680X_INS_LBLE, rel16_hid, inh_hid },
299	// 0x3x
300	{ 0x3f, M680X_INS_SWI2, inh_hid, inh_hid },
301	// 0x8x, immediate instructions with register D,Y
302	{ 0x83, M680X_INS_CMPD, imm16_hid, inh_hid },
303	{ 0x8c, M680X_INS_CMPY, imm16_hid, inh_hid },
304	{ 0x8e, M680X_INS_LDY, imm16_hid, inh_hid },
305	// 0x9x, direct instructions with register D,Y
306	{ 0x93, M680X_INS_CMPD, dir_hid, inh_hid },
307	{ 0x9c, M680X_INS_CMPY, dir_hid, inh_hid },
308	{ 0x9e, M680X_INS_LDY, dir_hid, inh_hid },
309	{ 0x9f, M680X_INS_STY, dir_hid, inh_hid },
310	// 0xAx, indexed instructions with register D,Y
311	{ 0xa3, M680X_INS_CMPD, idx09_hid, inh_hid },
312	{ 0xac, M680X_INS_CMPY, idx09_hid, inh_hid },
313	{ 0xae, M680X_INS_LDY, idx09_hid, inh_hid },
314	{ 0xaf, M680X_INS_STY, idx09_hid, inh_hid },
315	// 0xBx, extended instructions with register D,Y
316	{ 0xb3, M680X_INS_CMPD, ext_hid, inh_hid },
317	{ 0xbc, M680X_INS_CMPY, ext_hid, inh_hid },
318	{ 0xbe, M680X_INS_LDY, ext_hid, inh_hid },
319	{ 0xbf, M680X_INS_STY, ext_hid, inh_hid },
320	// 0xCx, immediate instructions with register S
321	{ 0xce, M680X_INS_LDS, imm16_hid, inh_hid },
322	// 0xDx, direct instructions with register S
323	{ 0xde, M680X_INS_LDS, dir_hid, inh_hid },
324	{ 0xdf, M680X_INS_STS, dir_hid, inh_hid },
325	// 0xEx, indexed instructions with register S
326	{ 0xee, M680X_INS_LDS, idx09_hid, inh_hid },
327	{ 0xef, M680X_INS_STS, idx09_hid, inh_hid },
328	// 0xFx, extended instructions with register S
329	{ 0xfe, M680X_INS_LDS, ext_hid, inh_hid },
330	{ 0xff, M680X_INS_STS, ext_hid, inh_hid },
331};
332
333// The following array has to be sorted by increasing
334// opcodes. Otherwise the binary_search will fail.
335//
336// M6809 PAGE3 instructions (with prefix 0x11)
337static const inst_pageX g_m6809_inst_page3_table[] = {
338	{ 0x3f, M680X_INS_SWI3, inh_hid, inh_hid },
339	// 0x8x, immediate instructions with register U,S
340	{ 0x83, M680X_INS_CMPU, imm16_hid, inh_hid },
341	{ 0x8c, M680X_INS_CMPS, imm16_hid, inh_hid },
342	// 0x9x, direct instructions with register U,S
343	{ 0x93, M680X_INS_CMPU, dir_hid, inh_hid },
344	{ 0x9c, M680X_INS_CMPS, dir_hid, inh_hid },
345	// 0xAx, indexed instructions with register U,S
346	{ 0xa3, M680X_INS_CMPU, idx09_hid, inh_hid },
347	{ 0xac, M680X_INS_CMPS, idx09_hid, inh_hid },
348	// 0xBx, extended instructions with register U,S
349	{ 0xb3, M680X_INS_CMPU, ext_hid, inh_hid },
350	{ 0xbc, M680X_INS_CMPS, ext_hid, inh_hid },
351};
352
353