gas:
[binutils.git] / opcodes / rl78-decode.opc
blob4af2bf3a7bbb27cc74fe6827587cc0d8cdb02f18
1 /* -*- c -*- */
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
6 #include "config.h"
7 #include "ansidecl.h"
8 #include "opcode/rl78.h"
10 static int trace = 0;
12 typedef struct
14   RL78_Opcode_Decoded * rl78;
15   int (* getbyte)(void *);
16   void * ptr;
17   unsigned char * op;
18 } LocalData;
20 #define ID(x) rl78->id = RLO_##x, rl78->lineno = __LINE__
21 #define OP(n,t,r,a) (rl78->op[n].type = t, \
22                      rl78->op[n].reg = r,            \
23                      rl78->op[n].addend = a )
24 #define OPX(n,t,r1,r2,a) \
25         (rl78->op[n].type = t, \
26         rl78->op[n].reg = r1, \
27         rl78->op[n].reg2 = r2, \
28         rl78->op[n].addend = a )
30 #define W() rl78->size = RL78_Word
32 #define AU ATTRIBUTE_UNUSED
33 #define GETBYTE() (ld->op [ld->rl78->n_bytes++] = ld->getbyte (ld->ptr))
34 #define B ((unsigned long) GETBYTE())
36 #define SYNTAX(x) rl78->syntax = x
38 #define UNSUPPORTED() \
39   rl78->syntax = "*unknown*"
41 #define RB(x) ((x)+RL78_Reg_X)
42 #define RW(x) ((x)+RL78_Reg_AX)
44 #define Fz      rl78->flags = RL78_PSW_Z
45 #define Fza     rl78->flags = RL78_PSW_Z | RL78_PSW_AC
46 #define Fzc     rl78->flags = RL78_PSW_Z | RL78_PSW_CY
47 #define Fzac    rl78->flags = RL78_PSW_Z | RL78_PSW_AC | RL78_PSW_CY
48 #define Fa      rl78->flags = RL78_PSW_AC
49 #define Fc      rl78->flags = RL78_PSW_CY
50 #define Fac     rl78->flags = RL78_PSW_AC | RL78_PSW_CY
52 #define IMMU(bytes)   immediate (bytes, 0, ld)
53 #define IMMS(bytes)   immediate (bytes, 1, ld)
55 static int
56 immediate (int bytes, int sign_extend, LocalData * ld)
58   unsigned long i = 0;
60   switch (bytes)
61     {
62     case 1:
63       i |= B;
64       if (sign_extend && (i & 0x80))
65         i -= 0x100;
66       break;
67     case 2:
68       i |= B;
69       i |= B << 8;
70       if (sign_extend && (i & 0x8000))
71         i -= 0x10000;
72       break;
73     case 3:
74       i |= B;
75       i |= B << 8;
76       i |= B << 16;
77       if (sign_extend && (i & 0x800000))
78         i -= 0x1000000;
79       break;
80     default:
81       fprintf (stderr, "Programmer error: immediate() called with invalid byte count %d\n", bytes);
82       abort();
83     }
84   return i;
87 #define DC(c)           OP (0, RL78_Operand_Immediate, 0, c)
88 #define DR(r)           OP (0, RL78_Operand_Register, RL78_Reg_##r, 0)
89 #define DRB(r)          OP (0, RL78_Operand_Register, RB(r), 0)
90 #define DRW(r)          OP (0, RL78_Operand_Register, RW(r), 0)
91 #define DM(r,a)         OP (0, RL78_Operand_Indirect, RL78_Reg_##r, a)
92 #define DM2(r1,r2,a)    OPX (0, RL78_Operand_Indirect, RL78_Reg_##r1, RL78_Reg_##r2, a)
93 #define DE()            rl78->op[0].use_es = 1
94 #define DB(b)           set_bit (rl78->op, b)
95 #define DCY()           DR(PSW); DB(0)
96 #define DPUSH()         OP (0, RL78_Operand_PreDec, RL78_Reg_SP, 0);
98 #define SC(c)           OP (1, RL78_Operand_Immediate, 0, c)
99 #define SR(r)           OP (1, RL78_Operand_Register, RL78_Reg_##r, 0)
100 #define SRB(r)          OP (1, RL78_Operand_Register, RB(r), 0)
101 #define SRW(r)          OP (1, RL78_Operand_Register, RW(r), 0)
102 #define SM(r,a)         OP (1, RL78_Operand_Indirect, RL78_Reg_##r, a)
103 #define SM2(r1,r2,a)    OPX (1, RL78_Operand_Indirect, RL78_Reg_##r1, RL78_Reg_##r2, a)
104 #define SE()            rl78->op[1].use_es = 1
105 #define SB(b)           set_bit (rl78->op+1, b)
106 #define SCY()           SR(PSW); SB(0)
107 #define COND(c)         rl78->op[1].condition = RL78_Condition_##c
108 #define SPOP()          OP (1, RL78_Operand_PostInc, RL78_Reg_SP, 0);
110 static void
111 set_bit (RL78_Opcode_Operand *op, int bit)
113   op->bit_number = bit;
114   switch (op->type) {
115   case RL78_Operand_Register:
116     op->type = RL78_Operand_Bit;
117     break;
118   case RL78_Operand_Indirect:
119     op->type = RL78_Operand_BitIndirect;
120     break;
121   default:
122     break;
123   }
126 static int
127 saddr (int x)
129   if (x < 0x20)
130     return 0xfff00 + x;
131   return 0xffe00 + x;
134 static int
135 sfr (int x)
137   return 0xfff00 + x;
140 #define SADDR saddr (IMMU (1))
141 #define SFR sfr (IMMU (1))
144 rl78_decode_opcode (unsigned long pc AU,
145                   RL78_Opcode_Decoded * rl78,
146                   int (* getbyte)(void *),
147                   void * ptr)
149   LocalData lds, * ld = &lds;
150   unsigned char op_buf[20] = {0};
151   unsigned char *op = op_buf;
152   int op0, op1;
154   lds.rl78 = rl78;
155   lds.getbyte = getbyte;
156   lds.ptr = ptr;
157   lds.op = op;
159   memset (rl78, 0, sizeof (*rl78));
161  start_again:
163 /* Byte registers, not including A.  */
164 /** VARY rba 000 010 011 100 101 110 111 */
165 /* Word registers, not including AX.  */
166 /** VARY ra 01 10 11 */
168 /*----------------------------------------------------------------------*/
169 /* ES: prefix                                                           */
171 /** 0001 0001                   es:                                     */
172   DE(); SE();
173   op ++;
174   pc ++;
175   goto start_again;
177 /*----------------------------------------------------------------------*/
179 /** 0000 1111                   add     %0, %e1%!1                      */
180   ID(add); DR(A); SM(None, IMMU(2)); Fzac;
182 /** 0000 1101                   add     %0, %e1%1                       */
183   ID(add); DR(A); SM(HL, 0); Fzac;
185 /** 0110 0001 1000 000          add     %0, %e1%1                       */
186   ID(add); DR(A); SM2(HL, B, 0); Fzac;
188 /** 0000 1110                   add     %0, %e1%1                       */
189   ID(add); DR(A); SM(HL, IMMU(1)); Fzac;
191 /** 0110 0001 1000 0010         add     %0, %e1%1                       */
192   ID(add); DR(A); SM2(HL, C, 0); Fzac;
194 /** 0000 1100                   add     %0, #%1                         */
195   ID(add); DR(A); SC(IMMU(1)); Fzac;
197 /** 0110 0001 0000 1rba         add     %0, %1                          */
198   ID(add); DR(A); SRB(rba); Fzac;
200 /** 0000 1011                   add     %0, %1                          */
201   ID(add); DR(A); SM(None, SADDR); Fzac;
203 /** 0110 0001 0000 0reg         add     %0, %1                          */
204   ID(add); DRB(reg); SR(A); Fzac;
206 /** 0000 1010                   add     %0, #%1                         */
207   ID(add); DM(None, SADDR); SC(IMMU(1)); Fzac;
209 /*----------------------------------------------------------------------*/
211 /** 0001 1111                   addc    %0, %e1%!1                      */
212   ID(addc); DR(A); SM(None, IMMU(2)); Fzac;
214 /** 0001 1101                   addc    %0, %e1%1                       */
215   ID(addc); DR(A); SM(HL, 0); Fzac;
217 /** 0110 0001 1001 0000         addc    %0, %e1%1                       */
218   ID(addc); DR(A); SM2(HL, B, 0); Fzac;
220 /** 0110 0001 1001 0010         addc    %0, %e1%1                       */
221   ID(addc); DR(A); SM2(HL, C, 0); Fzac;
223 /** 0001 1110                   addc    %0, %e1%1                       */
224   ID(addc); DR(A); SM(HL, IMMU(1)); Fzac;
226 /** 0001 1100                   addc    %0, #%1                         */
227   ID(addc); DR(A); SC(IMMU(1)); Fzac;
229 /** 0110 0001 0001 1rba         addc    %0, %1                          */
230   ID(addc); DR(A); SRB(rba); Fzac;
232 /** 0110 0001 0001 0reg         addc    %0, %1                          */
233   ID(addc); DRB(reg); SR(A); Fzac;
235 /** 0001 1011                   addc    %0, %1                          */
236   ID(addc); DR(A); SM(None, SADDR); Fzac;
238 /** 0001 1010                   addc    %0, #%1                         */
239   ID(addc); DM(None, SADDR); SC(IMMU(1)); Fzac;
241 /*----------------------------------------------------------------------*/
243 /** 0000 0010                   addw    %0, %e1%!1                      */
244   ID(add); W(); DR(AX); SM(None, IMMU(2)); Fzac;
246 /** 0110 0001 0000 1001         addw    %0, %e1%1                       */
247   ID(add); W(); DR(AX); SM(HL, IMMU(1)); Fzac;
249 /** 0000 0100                   addw    %0, #%1                         */
250   ID(add); W(); DR(AX); SC(IMMU(2)); Fzac;
252 /** 0000 0rw1                   addw    %0, %1                          */
253   ID(add); W(); DR(AX); SRW(rw); Fzac;
255 /** 0000 0110                   addw    %0, %1                          */
256   ID(add); W(); DR(AX); SM(None, SADDR); Fzac;
258 /** 0001 0000                   addw    %0, #%1                         */
259   ID(add); W(); DR(SP); SC(IMMU(1)); Fzac;
261 /*----------------------------------------------------------------------*/
263 /** 0101 1111                   and     %0, %e1%!1                      */
264   ID(and); DR(A); SM(None, IMMU(2)); Fz;
266 /** 0101 1101                   and     %0, %e1%1                       */
267   ID(and); DR(A); SM(HL, 0); Fz;
269 /** 0110 0001 1101 0000         and     %0, %e1%1                       */
270   ID(and); DR(A); SM2(HL, B, 0); Fz;
272 /** 0101 1110                   and     %0, %e1%1                       */
273   ID(and); DR(A); SM(HL, IMMU(1)); Fz;
275 /** 0110 0001 1101 0010         and     %0, %e1%1                       */
276   ID(and); DR(A); SM2(HL, C, 0); Fz;
278 /** 0101 1100                   and     %0, #%1                         */
279   ID(and); DR(A); SC(IMMU(1)); Fz;
281 /** 0110 0001 0101 1rba         and     %0, %1                          */
282   ID(and); DR(A); SRB(rba); Fz;
284 /** 0110 0001 0101 0reg         and     %0, %1                          */
285   ID(and); DRB(reg); SR(A); Fz;
287 /** 0101 1011                   and     %0, %1                          */
288   ID(and); DR(A); SM(None, SADDR); Fz;
290 /** 0101 1010                   and     %0, #%1                         */
291   ID(and); DM(None, SADDR); SC(IMMU(1)); Fz;
293 /*----------------------------------------------------------------------*/
295 /** 0111 0001 1bit 0101         and1    cy, %e1%1                       */
296   ID(and); DCY(); SM(HL, 0); SB(bit);
298 /** 0111 0001 1bit 1101         and1    cy, %1                          */
299   ID(and); DCY(); SR(A); SB(bit);
301 /** 0111 0001 0bit 1101         and1    cy, %s1                         */
302   ID(and); DCY(); SM(None, SFR); SB(bit);
304 /** 0111 0001 0bit 0101         and1    cy, %s1                         */
305   ID(and); DCY(); SM(None, SADDR); SB(bit);
307 /*----------------------------------------------------------------------*/
309 /* Note that the branch insns need to be listed before the shift
310    ones, as "shift count of zero" means "branch insn" */
312 /** 1101 1100                   bc      $%a0                            */
313   ID(branch_cond); DC(pc+IMMS(1)+2); SR(None); COND(C);
315 /** 1101 1110                   bnc     $%a0                            */
316   ID(branch_cond); DC(pc+IMMS(1)+2); SR(None); COND(NC);
318 /** 0110 0001 1100 0011         bh      $%a0                            */
319   ID(branch_cond); DC(pc+IMMS(1)+3); SR(None); COND(H);
321 /** 0110 0001 1101 0011         bnh     $%a0                            */
322   ID(branch_cond); DC(pc+IMMS(1)+3); SR(None); COND(NH);
324 /** 1101 1101                   bz      $%a0                            */
325   ID(branch_cond); DC(pc+IMMS(1)+2); SR(None); COND(Z);
327 /** 1101 1111                   bnz     $%a0                            */
328   ID(branch_cond); DC(pc+IMMS(1)+2); SR(None); COND(NZ);
330 /*----------------------------------------------------------------------*/
332 /** 0011 0001 1bit 0101         bf      %e1%1, $%a0                     */
333   ID(branch_cond); DC(pc+IMMS(1)+3); SM(HL,0); SB(bit); COND(F);
335 /** 0011 0001 0bit 0101         bf      %1, $%a0                        */
336   ID(branch_cond); DC(pc+IMMS(1)+3); SR(A); SB(bit); COND(F);
338 /** 0011 0001 1bit 0100         bf      %s1, $%a0                       */
339   ID(branch_cond); SM(None, SFR); SB(bit); DC(pc+IMMS(1)+4); COND(F);
341 /** 0011 0001 0bit 0100         bf      %s1, $%a0                       */
342   ID(branch_cond); SM(None, SADDR); SB(bit); DC(pc+IMMS(1)+4); COND(F);
344 /*----------------------------------------------------------------------*/
346 /** 1110 1100                   br      !%!a0                           */
347   ID(branch); DC(IMMU(3));
349 /** 1110 1101                   br      %!a0                            */
350   ID(branch); DC(IMMU(2));
352 /** 1110 1110                   br      $%!a0                           */
353   ID(branch); DC(pc+IMMS(2)+3);
355 /** 1110 1111                   br      $%a0                            */
356   ID(branch); DC(pc+IMMS(1)+2);
358 /** 0110 0001 1100 1011         br      ax                              */
359   ID(branch); DR(AX);
361 /*----------------------------------------------------------------------*/
363 /** 1111 1111                   brk1                                    */
364   ID(break);
366 /** 0110 0001 1100 1100         brk                                     */
367   ID(break);
369 /*----------------------------------------------------------------------*/
371 /** 0011 0001 1bit 0011         bt      %e1%1, $%a0                     */
372   ID(branch_cond); DC(pc+IMMS(1)+3); SM(HL,0); SB(bit); COND(T);
374 /** 0011 0001 0bit 0011         bt      %1, $%a0                        */
375   ID(branch_cond); DC(pc+IMMS(1)+3); SR(A); SB(bit); COND(T);
377 /** 0011 0001 1bit 0010         bt      %s1, $%a0                       */
378   ID(branch_cond); SM(None, SFR); SB(bit); DC(pc+IMMS(1)+4); COND(T);
380 /** 0011 0001 0bit 0010         bt      %s1, $%a0                       */
381   ID(branch_cond); SM(None, SADDR); SB(bit); DC(pc+IMMS(1)+4); COND(T);
383 /*----------------------------------------------------------------------*/
385 /** 0011 0001 1bit 0001         btclr   %e1%1, $%a0                     */
386   ID(branch_cond_clear); DC(pc+IMMS(1)+3); SM(HL,0); SB(bit); COND(T);
388 /** 0011 0001 0bit 0001         btclr   %1, $%a0                        */
389   ID(branch_cond_clear); DC(pc+IMMS(1)+3); SR(A); SB(bit); COND(T);
391 /** 0011 0001 1bit 0000         btclr   %s1, $%a0                       */
392   ID(branch_cond_clear); SM(None, SFR); SB(bit); DC(pc+IMMS(1)+4); COND(T);
394 /** 0011 0001 0bit 0000         btclr   %s1, $%a0                       */
395   ID(branch_cond_clear); SM(None, SADDR); SB(bit); DC(pc+IMMS(1)+4); COND(T);
397 /*----------------------------------------------------------------------*/
399 /** 1111 1100                   call    !%!a0                           */
400   ID(call); DC(IMMU(3));
402 /** 1111 1101                   call    %!a0                            */
403   ID(call); DC(IMMU(2));
405 /** 1111 1110                   call    $%!a0                           */
406   ID(call); DC(pc+IMMS(2)+3);
408 /** 0110 0001 11rg 1010         call    %0                              */
409   ID(call); DRW(rg);
411 /** 0110 0001 1nnn 01mm         callt   [%x0]                           */
412   ID(call); DM(None, 0x80 + mm*16 + nnn*2);
414 /*----------------------------------------------------------------------*/
416 /** 0111 0001 0bit 1000         clr1    %e0%!0                          */
417   ID(mov); DM(None, IMMU(2)); DB(bit); SC(0);
419 /** 0111 0001 1bit 0011         clr1    %e0%0                           */
420   ID(mov); DM(HL, 0); DB(bit); SC(0);
422 /** 0111 0001 1bit 1011         clr1    %0                              */
423   ID(mov); DR(A); DB(bit); SC(0);
425 /** 0111 0001 1000 1000         clr1    cy                              */
426   ID(mov); DCY(); SC(0);
428 /** 0111 0001 0bit 1011         clr1    %s0                             */
429   op0 = SFR;
430   ID(mov); DM(None, op0); DB(bit); SC(0);
431   if (op0 == RL78_SFR_PSW && bit == 7)
432     rl78->syntax = "di";
434 /** 0111 0001 0bit 0011         clr1    %0                              */
435   ID(mov); DM(None, SADDR); DB(bit); SC(0);
437 /*----------------------------------------------------------------------*/
439 /** 1111 0101                   clrb    %e0%!0                          */
440   ID(mov); DM(None, IMMU(2)); SC(0);
442 /** 1111 00rg                   clrb    %0                              */
443   ID(mov); DRB(rg); SC(0);
445 /** 1111 0100                   clrb    %0                              */
446   ID(mov); DM(None, SADDR); SC(0);
448 /*----------------------------------------------------------------------*/
450 /** 1111 0110                   clrw    %0                              */
451   ID(mov); DR(AX); SC(0);
453 /** 1111 0111                   clrw    %0                              */
454   ID(mov); DR(BC); SC(0);
456 /*----------------------------------------------------------------------*/
458 /** 0100 0000                   cmp     %e0%!0, #%1                     */
459   ID(cmp); DM(None, IMMU(2)); SC(IMMU(1)); Fzac;
461 /** 0100 1010                   cmp     %0, #%1                         */
462   ID(cmp); DM(None, SADDR); SC(IMMU(1)); Fzac;
464 /** 0100 1111                   cmp     %0, %e1%!1                      */
465   ID(cmp); DR(A); SM(None, IMMU(2)); Fzac;
467 /** 0100 1101                   cmp     %0, %e1%1                       */
468   ID(cmp); DR(A); SM(HL, 0); Fzac;
470 /** 0110 0001 1100 0000         cmp     %0, %e1%1                       */
471   ID(cmp); DR(A); SM2(HL, B, 0); Fzac;
473 /** 0110 0001 1100 0010         cmp     %0, %e1%1                       */
474   ID(cmp); DR(A); SM2(HL, C, 0); Fzac;
476 /** 0100 1110                   cmp     %0, %e1%1                       */
477   ID(cmp); DR(A); SM(HL, IMMU(1)); Fzac;
479 /** 0100 1100                   cmp     %0, #%1                         */
480   ID(cmp); DR(A); SC(IMMU(1)); Fzac;
482 /** 0110 0001 0100 1rba         cmp     %0, %1                          */
483   ID(cmp); DR(A); SRB(rba); Fzac;
485 /** 0110 0001 0100 0reg         cmp     %0, %1                          */
486   ID(cmp); DRB(reg); SR(A); Fzac;
488 /** 0100 1011                   cmp     %0, %1                          */
489   ID(cmp); DR(A); SM(None, SADDR); Fzac;
491 /*----------------------------------------------------------------------*/
493 /** 1101 0101                   cmp0    %e0%!0                          */
494   ID(cmp); DM(None, IMMU(2)); SC(0); Fzac;
496 /** 1101 00rg                   cmp0    %0                              */
497   ID(cmp); DRB(rg); SC(0); Fzac;
499 /** 1101 0100                   cmp0    %0                              */
500   ID(cmp); DM(None, SADDR); SC(0); Fzac;
502 /*----------------------------------------------------------------------*/
504 /** 0110 0001 1101 1110         cmps    %0, %e1%1                       */
505   ID(cmp); DR(X); SM(HL, IMMU(1)); Fzac;
507 /*----------------------------------------------------------------------*/
509 /** 0100 0010                   cmpw    %0, %e1%!1                      */
510   ID(cmp); W(); DR(AX); SM(None, IMMU(2)); Fzac;
512 /** 0110 0001 0100 1001         cmpw    %0, %e1%1                       */
513   ID(cmp); W(); DR(AX); SM(HL, IMMU(1)); Fzac;
515 /** 0100 0100                   cmpw    %0, #%1                         */
516   ID(cmp); W(); DR(AX); SC(IMMU(2)); Fzac;
518 /** 0100 0ra1                   cmpw    %0, %1                          */
519   ID(cmp); W(); DR(AX); SRW(ra); Fzac;
521 /** 0100 0110                   cmpw    %0, %1                          */
522   ID(cmp); W(); DR(AX); SM(None, SADDR); Fzac;
524 /*----------------------------------------------------------------------*/
526 /** 1011 0000                   dec     %e0%!0                          */
527   ID(sub); DM(None, IMMU(2)); SC(1); Fza;
529 /** 0110 0001 0110 1001         dec     %e0%0                           */
530   ID(sub); DM(HL, IMMU(1)); SC(1); Fza;
532 /** 1001 0reg                   dec     %0                              */
533   ID(sub); DRB(reg); SC(1); Fza;
535 /** 1011 0100                   dec     %0                              */
536   ID(sub); DM(None, SADDR); SC(1); Fza;
538 /*----------------------------------------------------------------------*/
540 /** 1011 0010                   decw    %e0%!0                          */
541   ID(sub); W(); DM(None, IMMU(2)); SC(1);
543 /** 0110 0001 1000 1001         decw    %e0%0                           */
544   ID(sub); W(); DM(HL, IMMU(1)); SC(1);
546 /** 1011 0rg1                   decw    %0                              */
547   ID(sub); W(); DRW(rg); SC(1);
549 /** 1011 0110                   decw    %0                              */
550   ID(sub); W(); DM(None, SADDR); SC(1);
552 /*----------------------------------------------------------------------*/
554 /** 0110 0001 1110 1101         halt                                    */
555   ID(halt);
557 /*----------------------------------------------------------------------*/
559 /** 1010 0000                   inc     %e0%!0                          */
560   ID(add); DM(None, IMMU(2)); SC(1); Fza;
562 /** 0110 0001 0101 1001         inc     %e0%0                           */
563   ID(add); DM(HL, IMMU(1)); SC(1); Fza;
565 /** 1000 0reg                   inc     %0                              */
566   ID(add); DRB(reg); SC(1); Fza;
568 /** 1010 0100                   inc     %0                              */
569   ID(add); DM(None, SADDR); SC(1); Fza;
571 /*----------------------------------------------------------------------*/
573 /** 1010 0010                   incw    %e0%!0                          */
574   ID(add); W(); DM(None, IMMU(2)); SC(1);
576 /** 0110 0001 0111 1001         incw    %e0%0                           */
577   ID(add); W(); DM(HL, IMMU(1)); SC(1);
579 /** 1010 0rg1                   incw    %0                              */
580   ID(add); W(); DRW(rg); SC(1);
582 /** 1010 0110                   incw    %0                              */
583   ID(add); W(); DM(None, SADDR); SC(1);
585 /*----------------------------------------------------------------------*/
587 /** 1100 1111                   mov     %e0%!0, #%1                     */
588   ID(mov); DM(None, IMMU(2)); SC(IMMU(1));
590 /** 1001 1111                   mov     %e0%!0, %1                      */
591   ID(mov); DM(None, IMMU(2)); SR(A);
593 /** 1001 1001                   mov     %e0%0,%1                        */
594   ID(mov); DM(DE, 0); SR(A);
596 /** 1100 1010                   mov     %e0%0, #%1                      */
597   ID(mov); DM(DE, IMMU(1)); SC(IMMU(1));
599 /** 1001 1010                   mov     %e0%0, %1                       */
600   ID(mov); DM(DE, IMMU(1)); SR(A);
602 /** 1001 1011                   mov     %e0%0,%1                        */
603   ID(mov); DM(HL, 0); SR(A);
605 /** 0110 0001 1101 1001         mov     %e0%0, %1                       */
606   ID(mov); DM2(HL, B, 0); SR(A);
608 /** 1100 1100                   mov     %e0%0, #%1                      */
609   ID(mov); DM(HL, IMMU(1)); SC(IMMU(1));
611 /** 1001 1100                   mov     %e0%0, %1                       */
612   ID(mov); DM(HL, IMMU(1)); SR(A);
614 /** 0110 0001 1111 1001         mov     %e0%0, %1                       */
615   ID(mov); DM2(HL, C, 0); SR(A);
617 /** 1100 1000                   mov     %0, #%1                         */
618   ID(mov); DM(SP, IMMU(1)); SC(IMMU(1));
620 /** 1001 1000                   mov     %0, %1                          */
621   ID(mov); DM(SP, IMMU(1)); SR(A);
623 /** 1000 1111                   mov     %0, %e1%!1                      */
624   ID(mov); DR(A); SM(None, IMMU(2));
626 /** 1000 1001                   mov     %0, %e1%1                       */
627   ID(mov); DR(A); SM(DE, 0);
629 /** 1000 1010                   mov     %0, %e1%1                       */
630   ID(mov); DR(A); SM(DE, IMMU(1));
632 /** 1000 1011                   mov     %0, %e1%1                       */
633   ID(mov); DR(A); SM(HL, 0);
635 /** 1000 1100                   mov     %0, %e1%1                       */
636   ID(mov); DR(A); SM(HL, IMMU(1));
638 /** 0110 0001 1100 1001         mov     %0, %e1%1                       */
639   ID(mov); DR(A); SM2(HL, B, 0);
641 /** 0110 0001 1110 1001         mov     %0, %e1%1                       */
642   ID(mov); DR(A); SM2(HL, C, 0);
644 /** 1000 1000                   mov     %0, %e1%1                       */
645   ID(mov); DR(A); SM(SP, IMMU(1));
647 /** 0101 0reg                   mov     %0, #%1                         */
648   ID(mov); DRB(reg); SC(IMMU(1));
650 /** 0110 0rba                   mov     %0, %1                          */
651   ID(mov); DR(A); SRB(rba);
653 /** 1000 1110 1111 1101         mov     %0, %1                          */
654   ID(mov); DR(A); SR(ES);
656 /** 0000 1001                   mov     %0, %e1%1                       */
657   ID(mov); DR(A); SM(B, IMMU(2));
659 /** 0100 1001                   mov     %0, %e1%1                       */
660   ID(mov); DR(A); SM(BC, IMMU(2));
662 /** 0010 1001                   mov     %0, %e1%1                       */
663   ID(mov); DR(A); SM(C, IMMU(2));
665 /** 1000 1110                   mov     %0, %s1                         */
666   ID(mov); DR(A); SM(None, SFR);
668 /** 1000 1101                   mov     %0, %1                          */
669   ID(mov); DR(A); SM(None, SADDR);
671 /** 1110 1001                   mov     %0, %e1%!1                      */
672   ID(mov); DR(B); SM(None, IMMU(2));
674 /** 0111 0rba                   mov     %0, %1                          */
675   ID(mov); DRB(rba); SR(A);
677 /** 1110 1000                   mov     %0, %1                          */
678   ID(mov); DR(B); SM(None, SADDR);
680 /** 1111 1001                   mov     %0, %e1%!1                      */
681   ID(mov); DR(C); SM(None, IMMU(2));
683 /** 1111 1000                   mov     %0, %1                          */
684   ID(mov); DR(C); SM(None, SADDR);
686 /** 1101 1001                   mov     %0, %e1%!1                      */
687   ID(mov); DR(X); SM(None, IMMU(2));
689 /** 1101 1000                   mov     %0, %1                          */
690   ID(mov); DR(X); SM(None, SADDR);
692 /** 1001 1110 1111 1100         mov     %0, %1                          */
693   ID(mov); DR(CS); SR(A);
695 /** 0100 0001                   mov     %0, #%1                         */
696   ID(mov); DR(ES); SC(IMMU(1)); 
698 /** 1001 1110 1111 1101         mov     %0, %1                          */
699   ID(mov); DR(ES); SR(A);       
701 /** 0110 0001 1011 1000         mov     %0, %1                          */
702   ID(mov); DR(ES); SM(None, SADDR);     
704 /** 0001 1001                   mov     %e0%0, #%1                      */
705   ID(mov); DM(B, IMMU(2)); SC(IMMU(1)); 
707 /** 0001 1000                   mov     %e0%0, %1                       */
708   ID(mov); DM(B, IMMU(2)); SR(A);       
710 /** 0011 1001                   mov     %e0%0, #%1                      */
711   ID(mov); DM(BC, IMMU(2)); SC(IMMU(1));        
713 /** 0100 1000                   mov     %e0%0, %1                       */
714   ID(mov); DM(BC, IMMU(2)); SR(A);      
716 /** 0011 1000                   mov     %e0%0, #%1                      */
717   ID(mov); DM(C, IMMU(2)); SC(IMMU(1)); 
719 /** 0010 1000                   mov     %e0%0, %1                       */
720   ID(mov); DM(C, IMMU(2)); SR(A);
722 /** 1100 1101                   mov     %0, #%1                         */
723   ID(mov); DM(None, SADDR); SC(IMMU(1));
725 /** 1001 1101                   mov     %0, %1                          */
726   ID(mov); DM(None, SADDR); SR(A);
728 /** 1100 1110                   mov     %s0, #%1                        */
729   op0 = SFR;
730   op1 = IMMU(1);
731   ID(mov); DM(None, op0); SC(op1);
732   if (op0 == 0xffffb)
733     switch (op1)
734       {
735       case 0x01:
736         rl78->syntax = "mulhu"; ID(mulhu);
737         break;
738       case 0x02:
739         rl78->syntax = "mulh"; ID(mulh);
740         break;
741       case 0x03:
742         rl78->syntax = "divhu"; ID(divhu);
743         break;
744       case 0x04:
745         rl78->syntax = "divwu"; ID(divwu);
746         break;
747       case 0x05:
748         rl78->syntax = "machu"; ID(machu);
749         break;
750       case 0x06:
751         rl78->syntax = "mach"; ID(mach);
752         break;
753       }
755 /** 1001 1110                   mov     %0, %1                          */
756   ID(mov); DM(None, SFR); SR(A);
758 /*----------------------------------------------------------------------*/
760 /** 0111 0001 1bit 0001         mov1    %e0%0, cy                       */
761   ID(mov); DM(HL, 0); DB(bit); SCY();
763 /** 0111 0001 1bit 1001         mov1    %e0%0, cy                       */
764   ID(mov); DR(A); DB(bit); SCY();
766 /** 0111 0001 1bit 0100         mov1    cy, %e1%1                       */
767   ID(mov); DCY(); SM(HL, 0); SB(bit);
769 /** 0111 0001 1bit 1100         mov1    cy, %e1%1                       */
770   ID(mov); DCY(); SR(A); SB(bit);
772 /** 0111 0001 0bit 0100         mov1    cy, %1                          */
773   ID(mov); DCY(); SM(None, SADDR); SB(bit);
775 /** 0111 0001 0bit 1100         mov1    cy, %s1                         */
776   ID(mov); DCY(); SM(None, SFR); SB(bit);
778 /** 0111 0001 0bit 0001         mov1    %0, cy                          */
779   ID(mov); DM(None, SADDR); DB(bit); SCY();
781 /** 0111 0001 0bit 1001         mov1    %s0, cy                         */
782   ID(mov); DM(None, SFR); DB(bit); SCY();
784 /*----------------------------------------------------------------------*/
786 /** 0110 0001 1100 1110         movs    %e0%0, %1                       */
787   ID(mov); DM(HL, IMMU(1)); SR(X); Fzc;
789 /*----------------------------------------------------------------------*/
791 /** 1011 1111                   movw    %e0%!0, %1                      */
792   ID(mov); W(); DM(None, IMMU(2)); SR(AX);
794 /** 1011 1001                   movw    %e0%0, %1                       */
795   ID(mov); W(); DM(DE, 0); SR(AX);
797 /** 1011 1010                   movw    %e0%0, %1                       */
798   ID(mov); W(); DM(DE, IMMU(1)); SR(AX);
800 /** 1011 1011                   movw    %e0%0, %1                       */
801   ID(mov); W(); DM(HL, 0); SR(AX);
803 /** 1011 1100                   movw    %e0%0, %1                       */
804   ID(mov); W(); DM(HL, IMMU(1)); SR(AX);
806 /** 1011 1000                   movw    %0, %1                          */
807   ID(mov); W(); DM(SP, IMMU(1)); SR(AX);
809 /** 1010 1111                   movw    %0, %e1%!1                      */
810   ID(mov); W(); DR(AX); SM(None, IMMU(2));
813 /** 1010 1001                   movw    %0, %e1%1                       */
814   ID(mov); W(); DR(AX); SM(DE, 0);
816 /** 1010 1010                   movw    %0, %e1%1                       */
817   ID(mov); W(); DR(AX); SM(DE, IMMU(1));
819 /** 1010 1011                   movw    %0, %e1%1                       */
820   ID(mov); W(); DR(AX); SM(HL, 0);
822 /** 1010 1100                   movw    %0, %e1%1                       */
823   ID(mov); W(); DR(AX); SM(HL, IMMU(1));
825 /** 1010 1000                   movw    %0, %1                          */
826   ID(mov); W(); DR(AX); SM(SP, IMMU(1));
828 /** 0011 0rg0                   movw    %0, #%1                         */
829   ID(mov); W(); DRW(rg); SC(IMMU(2));
831 /** 0001 0ra1                   movw    %0, %1                          */
832   ID(mov); W(); DR(AX); SRW(ra);
834 /** 0001 0ra0                   movw    %0, %1                          */
835   ID(mov); W(); DRW(ra); SR(AX);
837 /** 0101 1001                   movw    %0, %e1%1                       */
838   ID(mov); W(); DR(AX); SM(B, IMMU(2));
840 /** 0110 1001                   movw    %0, %e1%1                       */
841   ID(mov); W(); DR(AX); SM(C, IMMU(2));
843 /** 0111 1001                   movw    %0, %e1%1                       */
844   ID(mov); W(); DR(AX); SM(BC, IMMU(2));
846 /** 0101 1000                   movw    %e0%0, %1                       */
847   ID(mov); W(); DM(B, IMMU(2)); SR(AX);
849 /** 0110 1000                   movw    %e0%0, %1                       */
850   ID(mov); W(); DM(C, IMMU(2)); SR(AX);
852 /** 0111 1000                   movw    %e0%0, %1                       */
853   ID(mov); W(); DM(BC, IMMU(2)); SR(AX);
855 /** 1010 1101                   movw    %0, %1                          */
856   ID(mov); W(); DR(AX); SM(None, SADDR);
858 /** 1010 1110                   movw    %0, %s1                         */
859   ID(mov); W(); DR(AX); SM(None, SFR);
861 /** 11ra 1011                   movw    %0, %e1%!1                      */
862   ID(mov); W(); DRW(ra); SM(None, IMMU(2));
864 /** 11ra 1010                   movw    %0, %1                          */
865   ID(mov); W(); DRW(ra); SM(None, SADDR);
867 /** 1100 1001                   movw    %0, #%1                         */
868   ID(mov); W(); DM(None, SADDR); SC(IMMU(2));
870 /** 1011 1101                   movw    %0, %1                          */
871   ID(mov); W(); DM(None, SADDR); SR(AX);
873 /** 1100 1011                   movw    %0, #%1                         */
874   ID(mov); W(); DM(None, SFR); SC(IMMU(2));
876 /** 1011 1110                   movw    %0, %1                          */
877   ID(mov); W(); DM(None, SFR); SR(AX);
879 /*----------------------------------------------------------------------*/
881 /** 1101 0110                   mulu    x                               */
882   ID(mulu);
884 /*----------------------------------------------------------------------*/
886 /** 0000 0000                   nop                                     */
887   ID(nop);
889 /*----------------------------------------------------------------------*/
891 /** 0111 0001 1100 0000         not1    cy                              */
892   ID(xor); DCY(); SC(1);
894 /*----------------------------------------------------------------------*/
896 /** 1110 0101                   oneb    %e0%!0                          */
897   ID(mov); DM(None, IMMU(2)); SC(1);
899 /** 1110 00rg                   oneb    %0                              */
900   ID(mov); DRB(rg); SC(1);
902 /** 1110 0100                   oneb    %0                              */
903   ID(mov); DM(None, SADDR); SC(1);
905 /*----------------------------------------------------------------------*/
907 /** 1110 0110                   onew    %0                              */
908   ID(mov); DR(AX); SC(1);
910 /** 1110 0111                   onew    %0                              */
911   ID(mov); DR(BC); SC(1);
913 /*----------------------------------------------------------------------*/
915 /** 0110 1111                   or      %0, %e1%!1                      */
916   ID(or); DR(A); SM(None, IMMU(2)); Fz;
918 /** 0110 1101                   or      %0, %e1%1                       */
919   ID(or); DR(A); SM(HL, 0); Fz;
921 /** 0110 0001 1110 0000         or      %0, %e1%1                       */
922   ID(or); DR(A); SM2(HL, B, 0); Fz;
924 /** 0110 1110                   or      %0, %e1%1                       */
925   ID(or); DR(A); SM(HL, IMMU(1)); Fz;
927 /** 0110 0001 1110 0010         or      %0, %e1%1                       */
928   ID(or); DR(A); SM2(HL, C, 0); Fz;
930 /** 0110 1100                   or      %0, #%1                         */
931   ID(or); DR(A); SC(IMMU(1)); Fz;
933 /** 0110 0001 0110 1rba         or      %0, %1                          */
934   ID(or); DR(A); SRB(rba); Fz;
936 /** 0110 0001 0110 0reg         or      %0, %1                          */
937   ID(or); DRB(reg); SR(A); Fz;
939 /** 0110 1011                   or      %0, %1                          */
940   ID(or); DR(A); SM(None, SADDR); Fz;
942 /** 0110 1010                   or      %0, #%1                         */
943   ID(or); DM(None, SADDR); SC(IMMU(1)); Fz;
945 /*----------------------------------------------------------------------*/
947 /** 0111 0001 1bit 0110         or1     cy, %e1%1                       */
948   ID(or); DCY(); SM(HL, 0); SB(bit);
950 /** 0111 0001 1bit 1110         or1     cy, %1                          */
951   ID(or); DCY(); SR(A); SB(bit);
953 /** 0111 0001 0bit 1110         or1     cy, %s1                         */
954   ID(or); DCY(); SM(None, SFR); SB(bit);
956 /** 0111 0001 0bit 0110         or1     cy, %s1                         */
957   ID(or); DCY(); SM(None, SADDR); SB(bit);
959 /*----------------------------------------------------------------------*/
961 /** 1100 0rg0                   pop     %0                              */
962   ID(mov); W(); DRW(rg); SPOP();
964 /** 0110 0001 1100 1101         pop     %s0                             */
965   ID(mov); W(); DR(PSW); SPOP();
967 /*----------------------------------------------------------------------*/
969 /** 1100 0rg1                   push    %1                              */
970   ID(mov); W(); DPUSH(); SRW(rg);
972 /** 0110 0001 1101 1101         push    %s1                             */
973   ID(mov); W(); DPUSH(); SR(PSW);
975 /*----------------------------------------------------------------------*/
977 /** 1101 0111                   ret                                     */
978   ID(ret);
980 /** 0110 0001 1111 1100         reti                                    */
981   ID(reti);
983 /** 0110 0001 1110 1100         retb                                    */
984   ID(reti);
986 /*----------------------------------------------------------------------*/
988 /** 0110 0001 1110 1011         rol     %0, %1                          */
989   ID(rol); DR(A); SC(1);
991 /** 0110 0001 1101 1100         rolc    %0, %1                          */
992   ID(rolc); DR(A); SC(1);
994 /** 0110 0001 111r 1110         rolwc   %0, %1                          */
995   ID(rolc); W(); DRW(r); SC(1);
997 /** 0110 0001 1101 1011         ror     %0, %1                          */
998   ID(ror); DR(A); SC(1);
1000 /** 0110 0001 1111 1011         rorc    %0, %1                          */
1001   ID(rorc); DR(A); SC(1);
1003 /*----------------------------------------------------------------------*/
1005 /* Note that the branch insns need to be listed before the shift
1006    ones, as "shift count of zero" means "branch insn" */
1008 /** 0011 0001 0cnt 1011         sar     %0, %1                          */
1009   ID(sar); DR(A); SC(cnt);
1011 /** 0011 0001 wcnt 1111         sarw    %0, %1                          */
1012   ID(sar); W(); DR(AX); SC(wcnt);
1014 /*----------------------------------------------------------------------*/
1016 /** 0110 0001 11rb 1111         sel     rb%1                            */
1017   ID(sel); SC(rb);
1019 /*----------------------------------------------------------------------*/
1021 /** 0111 0001 0bit 0000         set1    %e0%!0                          */
1022   ID(mov); DM(None, IMMU(2)); DB(bit); SC(1);
1024 /** 0111 0001 1bit 0010         set1    %e0%0                           */
1025   ID(mov); DM(HL, 0); DB(bit); SC(1);
1027 /** 0111 0001 1bit 1010         set1    %0                              */
1028   ID(mov); DR(A); DB(bit); SC(1);
1030 /** 0111 0001 1000 0000         set1    cy                              */
1031   ID(mov); DCY(); SC(1);
1033 /** 0111 0001 0bit 1010         set1    %s0                             */
1034   op0 = SFR;
1035   ID(mov); DM(None, op0); DB(bit); SC(1);
1036   if (op0 == RL78_SFR_PSW && bit == 7)
1037     rl78->syntax = "ei";
1039 /** 0111 0001 0bit 0010         set1    %0                              */
1040   ID(mov); DM(None, SADDR); DB(bit); SC(1);
1042 /*----------------------------------------------------------------------*/
1044 /** 0011 0001 0cnt 1001         shl     %0, %1                          */
1045   ID(shl); DR(A); SC(cnt);
1047 /** 0011 0001 0cnt 1000         shl     %0, %1                          */
1048   ID(shl); DR(B); SC(cnt);
1050 /** 0011 0001 0cnt 0111         shl     %0, %1                          */
1051   ID(shl); DR(C); SC(cnt);
1053 /** 0011 0001 wcnt 1101         shlw    %0, %1                          */
1054   ID(shl); W(); DR(AX); SC(wcnt);
1056 /** 0011 0001 wcnt 1100         shlw    %0, %1                          */
1057   ID(shl); W(); DR(BC); SC(wcnt);
1059 /*----------------------------------------------------------------------*/
1061 /** 0011 0001 0cnt 1010         shr     %0, %1                          */
1062   ID(shr); DR(A); SC(cnt);
1064 /** 0011 0001 wcnt 1110         shrw    %0, %1                          */
1065   ID(shr); W(); DR(AX); SC(wcnt);
1067 /*----------------------------------------------------------------------*/
1069 /** 0110 0001 1100 1000         sk%c1                                   */
1070   ID(skip); COND(C);
1072 /** 0110 0001 1110 0011         sk%c1                                   */
1073   ID(skip); COND(H);
1075 /** 0110 0001 1101 1000         sk%c1                                   */
1076   ID(skip); COND(NC);
1078 /** 0110 0001 1111 0011         sk%c1                                   */
1079   ID(skip); COND(NH);
1081 /** 0110 0001 1111 1000         sk%c1                                   */
1082   ID(skip); COND(NZ);
1084 /** 0110 0001 1110 1000         sk%c1                                   */
1085   ID(skip); COND(Z);
1087 /*----------------------------------------------------------------------*/
1089 /** 0110 0001 1111 1101 stop                                    */
1090   ID(stop);
1092 /*----------------------------------------------------------------------*/
1094 /** 0010 1111                   sub     %0, %e1%!1                      */
1095   ID(sub); DR(A); SM(None, IMMU(2)); Fzac;
1097 /** 0010 1101                   sub     %0, %e1%1                       */
1098   ID(sub); DR(A); SM(HL, 0); Fzac;
1100 /** 0110 0001 1010 000          sub     %0, %e1%1                       */
1101   ID(sub); DR(A); SM2(HL, B, 0); Fzac;
1103 /** 0010 1110                   sub     %0, %e1%1                       */
1104   ID(sub); DR(A); SM(HL, IMMU(1)); Fzac;
1106 /** 0110 0001 1010 0010         sub     %0, %e1%1                       */
1107   ID(sub); DR(A); SM2(HL, C, 0); Fzac;
1109 /** 0010 1100                   sub     %0, #%1                         */
1110   ID(sub); DR(A); SC(IMMU(1)); Fzac;
1112 /** 0110 0001 0010 1rba         sub     %0, %1                          */
1113   ID(sub); DR(A); SRB(rba); Fzac;
1115 /** 0010 1011                   sub     %0, %1                          */
1116   ID(sub); DR(A); SM(None, SADDR); Fzac;
1118 /** 0110 0001 0010 0reg         sub     %0, %1                          */
1119   ID(sub); DRB(reg); SR(A); Fzac;
1121 /** 0010 1010                   sub     %0, #%1                         */
1122   ID(sub); DM(None, SADDR); SC(IMMU(1)); Fzac;
1124 /*----------------------------------------------------------------------*/
1126 /** 0011 1111                   subc    %0, %e1%!1                      */
1127   ID(subc); DR(A); SM(None, IMMU(2)); Fzac;
1129 /** 0011 1101                   subc    %0, %e1%1                       */
1130   ID(subc); DR(A); SM(HL, 0); Fzac;
1132 /** 0110 0001 1011 0000         subc    %0, %e1%1                       */
1133   ID(subc); DR(A); SM2(HL, B, 0); Fzac;
1135 /** 0110 0001 1011 0010         subc    %0, %e1%1                       */
1136   ID(subc); DR(A); SM2(HL, C, 0); Fzac;
1138 /** 0011 1110                   subc    %0, %e1%1                       */
1139   ID(subc); DR(A); SM(HL, IMMU(1)); Fzac;
1141 /** 0011 1100                   subc    %0, #%1                         */
1142   ID(subc); DR(A); SC(IMMU(1)); Fzac;
1144 /** 0110 0001 0011 1rba         subc    %0, %1                          */
1145   ID(subc); DR(A); SRB(rba); Fzac;
1147 /** 0110 0001 0011 0reg         subc    %0, %1                          */
1148   ID(subc); DRB(reg); SR(A); Fzac;
1150 /** 0011 1011                   subc    %0, %1                          */
1151   ID(subc); DR(A); SM(None, SADDR); Fzac;
1153 /** 0011 1010                   subc    %0, #%1                         */
1154   ID(subc); DM(None, SADDR); SC(IMMU(1)); Fzac;
1156 /*----------------------------------------------------------------------*/
1158 /** 0010 0010                   subw    %0, %e1%!1                      */
1159   ID(sub); W(); DR(AX); SM(None, IMMU(2)); Fzac;
1161 /** 0110 0001 0010 1001         subw    %0, %e1%1                       */
1162   ID(sub); W(); DR(AX); SM(HL, IMMU(1)); Fzac;
1164 /** 0010 0100                   subw    %0, #%1                         */
1165   ID(sub); W(); DR(AX); SC(IMMU(2)); Fzac;
1167 /** 0010 0rw1                   subw    %0, %1                          */
1168   ID(sub); W(); DR(AX); SRW(rw); Fzac;
1170 /** 0010 0110                   subw    %0, %1                          */
1171   ID(sub); W(); DR(AX); SM(None, SADDR); Fzac;
1173 /** 0010 0000                   subw    %0, #%1                         */
1174   ID(sub); W(); DR(SP); SC(IMMU(1)); Fzac;
1176 /*----------------------------------------------------------------------*/
1178 /** 0110 0001 1010 1010         xch     %0, %e1%!1                      */
1179   ID(xch); DR(A); SM(None, IMMU(2));
1181 /** 0110 0001 1010 1110         xch     %0, %e1%1                       */
1182   ID(xch); DR(A); SM(DE, 0);
1184 /** 0110 0001 1010 1111         xch     %0, %e1%1                       */
1185   ID(xch); DR(A); SM(DE, IMMU(1));
1187 /** 0110 0001 1010 1100         xch     %0, %e1%1                       */
1188   ID(xch); DR(A); SM(HL, 0);
1190 /** 0110 0001 1011 1001         xch     %0, %e1%1                       */
1191   ID(xch); DR(A); SM2(HL, B, 0);
1193 /** 0110 0001 1010 1101         xch     %0, %e1%1                       */
1194   ID(xch); DR(A); SM(HL, IMMU(1));
1196 /** 0110 0001 1010 1001         xch     %0, %e1%1                       */
1197   ID(xch); DR(A); SM2(HL, C, 0);
1199 /** 0110 0001 1000 1reg         xch     %0, %1                          */
1200   /* Note: DECW uses reg == X, so this must follow DECW */
1201   ID(xch); DR(A); SRB(reg);
1203 /** 0110 0001 1010 1000         xch     %0, %1                          */
1204   ID(xch); DR(A); SM(None, SADDR);
1206 /** 0110 0001 1010 1011         xch     %0, %1                          */
1207   ID(xch); DR(A); SM(None, SFR);
1209 /** 0000 1000                   xch     a, x                            */
1210   ID(xch); DR(A); SR(X);
1212 /*----------------------------------------------------------------------*/
1214 /** 0011 0ra1                   xchw    %0, %1                          */
1215   ID(xch); W(); DR(AX); SRW(ra);
1217 /*----------------------------------------------------------------------*/
1219 /** 0111 1111                   xor     %0, %e1%!1                      */
1220   ID(xor); DR(A); SM(None, IMMU(2)); Fz;
1222 /** 0111 1101                   xor     %0, %e1%1                       */
1223   ID(xor); DR(A); SM(HL, 0); Fz;
1225 /** 0110 0001 1111 0000         xor     %0, %e1%1                       */
1226   ID(xor); DR(A); SM2(HL, B, 0); Fz;
1228 /** 0111 1110                   xor     %0, %e1%1                       */
1229   ID(xor); DR(A); SM(HL, IMMU(1)); Fz;
1231 /** 0110 0001 1111 0010         xor     %0, %e1%1                       */
1232   ID(xor); DR(A); SM2(HL, C, 0); Fz;
1234 /** 0111 1100                   xor     %0, #%1                         */
1235   ID(xor); DR(A); SC(IMMU(1)); Fz;
1237 /** 0110 0001 0111 1rba         xor     %0, %1                          */
1238   ID(xor); DR(A); SRB(rba); Fz;
1240 /** 0110 0001 0111 0reg         xor     %0, %1                          */
1241   ID(xor); DRB(reg); SR(A); Fz;
1243 /** 0111 1011                   xor     %0, %1                          */
1244   ID(xor); DR(A); SM(None, SADDR); Fz;
1246 /** 0111 1010                   xor     %0, #%1                         */
1247   ID(xor); DM(None, SADDR); SC(IMMU(1)); Fz;
1249 /*----------------------------------------------------------------------*/
1251 /** 0111 0001 1bit 0111         xor1    cy, %e1%1                       */
1252   ID(xor); DCY(); SM(HL, 0); SB(bit);
1254 /** 0111 0001 1bit 1111         xor1    cy, %1                          */
1255   ID(xor); DCY(); SR(A); SB(bit);
1257 /** 0111 0001 0bit 1111         xor1    cy, %s1                         */
1258   ID(xor); DCY(); SM(None, SFR); SB(bit);
1260 /** 0111 0001 0bit 0111         xor1    cy, %s1                         */
1261   ID(xor); DCY(); SM(None, SADDR); SB(bit);
1263 /*----------------------------------------------------------------------*/
1265 /** */
1267   return rl78->n_bytes;