2 :option:::insn-bit-size:8
3 :option:::insn-specifying-widths:true
5 :model:::mn10300:mn10300:
8 // What do we do with an illegal instruction?
12 program_interrupt(SD, CPU, cia, SIM_SIGILL);
15 // 1000 DnDn imm8....; mov imm8,Dn (imm8 is sign extended)
16 4.0x8,2.DM1,2.DN0=DM1+8.IMM8:S0i:::mov
22 signed32 immed = EXTEND8 (IMM8);
23 State.regs[REG_D0+DN0] = immed;
27 // 1000 DmDn; mov Dm,Dn (Dm != Dn, see above when Dm == Dn)
28 4.0x8,2.DM1,2.DN0!DM1:S0:::mov
35 State.regs[REG_D0+DN0] = State.regs[REG_D0+DM1];
39 // 1111 0001 1110 DmAn; mov Dm,An
40 8.0xf1+1110,2.DM1,2.AN0:D0:::mov
47 State.regs[REG_A0 + AN0] = State.regs[REG_D0 + DM1];
51 // 1111 0001 1101 AmDn; mov Am,Dn
52 8.0xf1+1101,2.AM1,2.DN0:D0a:::mov
59 State.regs[REG_D0 + DN0] = State.regs[REG_A0 + AM1];
63 // 1001 AnAn imm8....; mov imm8,An (imm8 is zero-extended)
64 4.0x9,2.AM1,2.AN0=AM1+8.IMM8:S0ai:::mov
71 State.regs[REG_A0+AN0] = IMM8;
75 // 1001 AmAn; mov Am,An (Am != An, save above when Am == An)
76 4.0x9,2.AM1,2.AN0!AM1:S0a:::mov
83 State.regs[REG_A0+AN0] = State.regs[REG_A0+AM1];
87 // 0011 11An; mov SP,An
88 4.0x3,11,2.AN0:S0b:::mov
95 State.regs[REG_A0 + AN0] = State.regs[REG_SP];
99 // 1111 0010 1111 Am00; mov Am,SP
100 8.0xf2+4.0xf,2.AM1,00:D0b:::mov
107 State.regs[REG_SP] = State.regs[REG_A0 + AM1];
111 // 1111 0010 1110 01Dn; mov PSW,Dn
112 8.0xf2+4.0xe,01,2.DN0:D0c:::mov
119 State.regs[REG_D0 + DN0] = PSW;
123 // 1111 0010 1111 Dm11; mov Dm,PSW
124 8.0xf2+4.0xf,2.DM1,11:D0d:::mov
131 PSW = State.regs[REG_D0 + DM1];
135 // 1111 0010 1110 00Dn; mov MDR,Dn
136 8.0xf2+4.0xe,00,2.DN0:D0e:::mov
143 State.regs[REG_D0 + DN0] = State.regs[REG_MDR];
147 // 1111 0010 1111 Dm10; mov Dm,MDR
148 8.0xf2+4.0xf,2.DM1,10:D0f:::mov
155 State.regs[REG_MDR] = State.regs[REG_D0 + DM1];
159 // 0111 DnAm; mov (Am),Dn
160 4.0x7,2.DN1,2.AM0:S0c:::mov
167 State.regs[REG_D0 + DN1] = load_word (State.regs[REG_A0 + AM0]);
171 // 1111 1000 0000 DnAm d8......; mov (d8,Am),Dn (d8 is sign-extended)
172 8.0xf8+4.0x0,2.DN1,2.AM0+8.D8:D1:::mov
179 State.regs[REG_D0 + DN1]
180 = load_word ((State.regs[REG_A0 + AM0] + EXTEND8 (D8)));
184 // 1111 1010 0000 DnAm d16.....; mov (d16,Am),Dn (d16 is sign-extended.)
185 8.0xfa+4.0x0,2.DN1,2.AM0+8.D16A+8.D16B:D2:::mov
190 /* OP_FA000000 (); */
192 State.regs[REG_D0 + DN1]
193 = load_word ((State.regs[REG_A0 + AM0] + EXTEND16 (FETCH16(D16A, D16B))));
197 // 1111 1100 0000 DnAm d32.....; mov (d32,Am),Dn
198 8.0xfc+4.0x0,2.DN1,2.AM0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4:::mov
203 /* OP_FC000000 (); */
205 State.regs[REG_D0 + DN1]
206 = load_word ((State.regs[REG_A0 + AM0]
207 + FETCH32(IMM32A, IMM32B, IMM32C, IMM32D)));
211 // 0101 10Dn d8......; mov (d8,SP),Dn (d8 is zero-extended)
212 4.0x5,10,2.DN0+8.D8:S1:::mov
219 State.regs[REG_D0 + DN0] = load_word (State.regs[REG_SP] + D8);
223 // 1111 1010 1011 01Dn d16.....; mov (d16,SP),Dn (d16 is zero-extended.)
224 8.0xfa+4.0xb,01,2.DN0+8.IMM16A+8.IMM16B:D2a:::mov
229 /* OP_FAB40000 (); */
231 State.regs[REG_D0 + DN0]
232 = load_word (State.regs[REG_SP] + FETCH16(IMM16A, IMM16B));
236 // 1111 1010 1011 01Dn d32.....; mov (d32,SP),Dn
237 8.0xfc+4.0xb,01,2.DN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4a:::mov
242 /* OP_FCB40000 (); */
244 State.regs[REG_D0 + DN0]
245 = load_word (State.regs[REG_SP] + FETCH32(IMM32A, IMM32B, IMM32C, IMM32D));
249 // 1111 0011 00Dn DiAm; mov (Di,Am),Dn
250 8.0xf3+00,2.DN2,2.DI,2.AM0:D0g:::mov
257 State.regs[REG_D0 + DN2]
258 = load_word ((State.regs[REG_A0 + AM0] + State.regs[REG_D0 + DI]));
262 // 0011 00Dn abs16...; mov (abs16),Dn (abs16 is zero-extended)
263 4.0x3,00,2.DN0+8.IMM16A+8.IMM16B:S2:::mov
270 State.regs[REG_D0 + DN0] = load_word (FETCH16(IMM16A, IMM16B));
273 // 1111 1100 1010 01Dn abs32...; mov (abs32),Dn
274 8.0xfc+4.0xa,01,2.DN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4b:::mov
279 /* OP_FCA40000 (); */
281 State.regs[REG_D0 + DN0] = load_word (FETCH32(IMM32A, IMM32B, IMM32C, IMM32D));
285 // 1111 0000 0000 AnAm; mov (Am),An
286 8.0xf0+4.0x0,2.AN1,2.AM0:D0h:::mov
293 State.regs[REG_A0 + AN1] = load_word (State.regs[REG_A0 + AM0]);
297 // 1111 1000 0010 AnAm d8......; mov (d8,Am),An (d8 is sign-extended)
298 8.0xf8+4.0x2,2.AN1,2.AM0+8.D8:D1a:::mov
305 State.regs[REG_A0 + AN1]
306 = load_word ((State.regs[REG_A0 + AM0] + EXTEND8 (D8)));
310 // 1111 1010 0010 AnAm d16.....; mov (d16,Am),An (d16 is sign-extended.)
311 8.0xfa+4.0x2,2.AN1,2.AM0+8.D16A+8.D16B:D2b:::mov
316 /* OP_FA200000 (); */
318 State.regs[REG_A0 + AN1]
319 = load_word ((State.regs[REG_A0 + AM0]
320 + EXTEND16 (FETCH16(D16A, D16B))));
324 // 1111 1100 0010 AnAm d32.....; mov (d32,Am),An
325 8.0xfc+4.0x2,2.AN1,2.AM0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4c:::mov
330 /* OP_FC200000 (); */
332 State.regs[REG_A0 + AN1]
333 = load_word ((State.regs[REG_A0 + AM0]
334 + FETCH32(IMM32A, IMM32B, IMM32C, IMM32D)));
338 // 0101 11An d8......; mov (d8,SP),An (d8 is zero-extended)
339 4.0x5,11,2.AN0+8.D8:S1a:::mov
346 State.regs[REG_A0 + AN0]
347 = load_word (State.regs[REG_SP] + D8);
351 // 1111 1010 1011 00An d16.....; mov (d16,SP),An (d16 is zero-extended.)
352 8.0xfa+4.0xb,00,2.AN0+8.IMM16A+8.IMM16B:D2c:::mov
357 /* OP_FAB00000 (); */
359 State.regs[REG_A0 + AN0]
360 = load_word (State.regs[REG_SP] + FETCH16(IMM16A, IMM16B));
364 // 1111 1100 1011 00An d32.....; mov (d32,SP),An
365 8.0xfc+4.0xb,00,2.AN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4d:::mov
370 /* OP_FCB00000 (); */
372 State.regs[REG_A0 + AN0]
373 = load_word (State.regs[REG_SP]
374 + FETCH32(IMM32A, IMM32B, IMM32C, IMM32D));
378 // 1111 0011 10An DiAm; mov (Di,Am),An
379 8.0xf3+10,2.AN2,2.DI,2.AM0:D0i:::mov
386 State.regs[REG_A0 + AN2]
387 = load_word ((State.regs[REG_A0 + AM0]
388 + State.regs[REG_D0 + DI]));
392 // 1111 1010 1010 00An abs16...; mov (abs16),An (abs16 is zero-extended)
393 8.0xfa+4.0xa,00,2.AN0+8.IMM16A+8.IMM16B:D2d:::mov
398 /* OP_FAA00000 (); */
400 State.regs[REG_A0 + AN0] = load_word (FETCH16(IMM16A, IMM16B));
404 // 1111 1100 1010 00An abs32...; mov (abs32),An
405 8.0xfc+4.0xa,00,2.AN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4e:::mov
410 /* OP_FCA00000 (); */
412 State.regs[REG_A0 + AN0]
413 = load_word (FETCH32(IMM32A, IMM32B, IMM32C, IMM32D));
417 // 1111 1000 1111 00Am d8......; mov (d8,Am),SP (d8 is sign-extended)
418 8.0xf8+4.0xf,00,2.AM0+8.D8:D1b:::mov
426 = load_word ((State.regs[REG_A0 + AM0] + EXTEND8 (D8)));
430 // 0110 DmAn; mov Dm,(An)
431 4.0x6,2.DM1,2.AN0:S0d:::mov
438 store_word (State.regs[REG_A0 + AN0], State.regs[REG_D0 + DM1]);
442 // 1111 1000 0001 DmAn d8......; mov Dm,(d8,An) (d8 is sign-extended)
443 8.0xf8+4.0x1,2.DM1,2.AN0+8.D8:D1c:::mov
450 store_word ((State.regs[REG_A0 + AN0] + EXTEND8 (D8)),
451 State.regs[REG_D0 + DM1]);
455 // 1111 1010 0001 DmAn d16.....; mov Dm,(d16,An) (d16 is sign-extended.)
456 8.0xfa+4.0x1,2.DM1,2.AN0+8.D16A+8.D16B:D2e:::mov
461 /* OP_FA100000 (); */
463 store_word ((State.regs[REG_A0 + AN0] + EXTEND16 (FETCH16(D16A, D16B))),
464 State.regs[REG_D0 + DM1]);
468 // 1111 1100 0001 DmAn d32.....; mov Dm,(d32,An)
469 8.0xfc+4.0x1,2.DM1,2.AN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4f:::mov
474 /* OP_FC100000 (); */
476 store_word ((State.regs[REG_A0 + AN0]
477 + FETCH32(IMM32A, IMM32B, IMM32C, IMM32D)),
478 State.regs[REG_D0 + DM1]);
482 // 0100 Dm10 d8......; mov Dm,(d8,SP) (d8 is zero-extended)
483 4.0x4,2.DM1,10+8.D8:S1b:::mov
490 store_word (State.regs[REG_SP] + D8, State.regs[REG_D0 + DM1]);
494 // 1111 1010 1001 Dm01 d16.....; mov Dm,(d16,SP) (d16 is zero-extended.)
495 8.0xfa+4.0x9,2.DM1,01+8.IMM16A+8.IMM16B:D2f:::mov
500 /* OP_FA910000 (); */
502 store_word (State.regs[REG_SP] + FETCH16(IMM16A, IMM16B),
503 State.regs[REG_D0 + DM1]);
507 // 1111 1100 1001 Dm01 d32.....; mov Dm,(d32,SP)
508 8.0xfc+4.0x9,2.DM1,01+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4g:::mov
513 /* OP_FC910000 (); */
515 store_word (State.regs[REG_SP] + FETCH32(IMM32A, IMM32B, IMM32C, IMM32D),
516 State.regs[REG_D0 + DM1]);
520 // 1111 0011 01Dm DiAn; mov Dm,(Di,An)
521 8.0xf3+01,2.DM2,2.DI,2.AN0:D0j:::mov
528 store_word ((State.regs[REG_A0 + AN0] + State.regs[REG_D0 + DI]),
529 State.regs[REG_D0 + DM2]);
533 // 0000 Dm01 abs16..., mov Dm,(abs16) (abs16 is zero-extended).
534 4.0x0,2.DM1,01+8.IMM16A+8.IMM16B:S2a:::mov
541 store_word (FETCH16(IMM16A, IMM16B), State.regs[REG_D0 + DM1]);
545 // 1111 1100 1000 Dm01 abs32...; mov Dm,(abs32)
546 8.0xfc+4.0x8,2.DM1,01+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4h:::mov
551 /* OP_FC810000 (); */
553 store_word (FETCH32(IMM32A, IMM32B, IMM32C, IMM32D),
554 State.regs[REG_D0 + DM1]);
558 // 1111 0000 0001 AmAn; mov Am,(An)
559 8.0xf0+4.0x1,2.AM1,2.AN0:D0k:::mov
566 store_word (State.regs[REG_A0 + AN0], State.regs[REG_A0 + AM1]);
570 // 1111 1000 0011 AmAn d8......; mov Am,(d8,An) (d8 is sign-extended)
571 8.0xf8+4.0x3,2.AM1,2.AN0+8.D8:D1d:::mov
578 store_word ((State.regs[REG_A0 + AN0] + EXTEND8 (D8)),
579 State.regs[REG_A0 + AM1]);
583 // 1111 1010 0011 AmAn d16.....; mov Am,(d16,An) (d16 is sign-extended.)
584 8.0xfa+4.0x3,2.AM1,2.AN0+8.D16A+8.D16B:D2g:::mov
589 /* OP_FA300000 (); */
591 store_word ((State.regs[REG_A0 + AN0] + EXTEND16 (FETCH16(D16A, D16B))),
592 State.regs[REG_A0 + AM1]);
596 // 1111 1100 0011 AmAn d32.....; mov Am,(d32,An)
597 8.0xfc+4.0x3,2.AM1,2.AN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4i:::mov
602 /* OP_FC300000 (); */
604 store_word ((State.regs[REG_A0 + AN0]
605 + FETCH32(IMM32A, IMM32B, IMM32C, IMM32D)),
606 State.regs[REG_A0 + AM1]);
610 // 0100 Am11 d8......; mov Am,(d8,SP) (d8 is zero-extended)
611 4.0x4,2.AM1,11+8.D8:S1c:::mov
620 store_word (State.regs[REG_SP] + (D8), State.regs[REG_A0 + (AM1)]);
624 // 1111 1010 1001 Am00 d16.....; mov Am,(d16,SP) (d16 is zero-extended.)
625 8.0xfa+4.0x9,2.AM1,00+8.IMM16A+8.IMM16B:D2h:::mov
632 /* OP_FA900000 (); */
634 store_word (State.regs[REG_SP] + FETCH16(IMM16A, IMM16B),
635 State.regs[REG_A0 + AM1]);
639 // 1111 1100 1001 Am00 d32.....; mov Am,(d32,SP)
640 8.0xfc+4.0x9,2.AM1,00+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4j:::mov
647 /* OP_FC900000 (); */
649 store_word (State.regs[REG_SP] + FETCH32(IMM32A, IMM32B, IMM32C, IMM32D),
650 State.regs[REG_A0 + AM1]);
654 // 1111 0011 11Am DiAn; mov Am,(Di,An)
655 8.0xf3+11,2.AM2,2.DI,2.AN0:D0l:::mov
664 store_word ((State.regs[REG_A0 + AN0] + State.regs[REG_D0 + DI]),
665 State.regs[REG_A0 + AM2]);
669 // 1111 1010 1000 Am00 abs16...; mov Am,(abs16) (abs16 is zero-extended)
670 8.0xfa+4.0x8,2.AM1,00+8.IMM16A+8.IMM16B:D2i:::mov
677 /* OP_FA800000 (); */
679 store_word (FETCH16(IMM16A, IMM16B),
680 State.regs[REG_A0 + AM1]);
684 // 1111 1100 1000 Am00 abs32...; mov Am,(abs32)
685 8.0xfc+4.0x8,2.AM1,00+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4k:::mov
692 /* OP_FC800000 (); */
694 store_word (FETCH32(IMM32A, IMM32B, IMM32C, IMM32D),
695 State.regs[REG_A0 + AM1]);
699 // 1111 1000 1111 01An d8......; mov SP,(d8,An) (d8 is sign-extended)
700 8.0xf8+4.0xf,01,2.AN0+8.D8:D1e:::mov
709 store_word (State.regs[REG_A0 + AN0] + EXTEND8 (D8),
714 // 0010 11Dn imm16...; mov imm16,Dn (imm16 is sign-extended)
715 4.0x2,11,2.DN0+8.IMM16A+8.IMM16B:S2b:::mov
726 value = EXTEND16 (FETCH16(IMM16A, IMM16B));
727 State.regs[REG_D0 + DN0] = value;
731 // 1111 1100 1100 11Dn imm32...; mov imm32,Dn
732 8.0xfc+4.0xc,11,2.DN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4l:::mov
739 /* OP_FCCC0000 (); */
743 value = FETCH32(IMM32A, IMM32B, IMM32C, IMM32D);
744 State.regs[REG_D0 + DN0] = value;
748 // 0010 01An imm16...; mov imm16,An (imm16 is zero-extended)
749 4.0x2,01,2.AN0+8.IMM16A+8.IMM16B:S2c:::mov
760 value = FETCH16(IMM16A, IMM16B);
761 State.regs[REG_A0 + AN0] = value;
765 // 1111 1100 1101 11An imm32...; mov imm32,An
766 8.0xfc+4.0xd,11,2.AN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4m:::mov
773 /* OP_FCDC0000 (); */
775 State.regs[REG_A0 + AN0] = FETCH32(IMM32A, IMM32B, IMM32C, IMM32D);
779 // 1111 0000 0100 DnAm; movbu (Am),Dn
780 8.0xf0+4.0x4,2.DN1,2.AM0:D0:::movbu
789 State.regs[REG_D0 + DN1]
790 = load_byte (State.regs[REG_A0 + AM0]);
794 // 1111 1000 0100 DnAm d8......; movbu (d8,Am),Dn (d8 is sign-extended)
795 8.0xf8+4.0x4,2.DN1,2.AM0+8.D8:D1f:::movbu
804 State.regs[REG_D0 + DN1]
805 = load_byte ((State.regs[REG_A0 + AM0] + EXTEND8 (D8)));
809 // 1111 1010 0100 DnAm d16.....; movbu (d16,Am),Dn (d16 is sign-extended.)
810 8.0xfa+4.0x4,2.DN1,2.AM0+8.D16A+8.D16B:D2:::movbu
817 /* OP_FA400000 (); */
819 State.regs[REG_D0 + DN1]
820 = load_byte ((State.regs[REG_A0 + AM0]
821 + EXTEND16 (FETCH16(D16A, D16B))));
825 // 1111 1100 0100 DnAm d32.....; movbu (d32,Am),Dn
826 8.0xfc+4.0x4,2.DN1,2.AM0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4:::movbu
833 /* OP_FC400000 (); */
835 State.regs[REG_D0 + DN1]
836 = load_byte ((State.regs[REG_A0 + AM0]
837 + FETCH32(IMM32A, IMM32B, IMM32C, IMM32D)));
841 // 1111 1000 1011 10Dn d8......; movbu (d8,SP),Dn (d8 is zero-extended)
842 8.0xf8+4.0xb,10,2.DN0+8.D8:D1a:::movbu
851 State.regs[REG_D0 + DN0]
852 = load_byte ((State.regs[REG_SP] + (D8)));
856 // 1111 1010 1011 10Dn d16.....; movbu (d16,SP),Dn (d16 is zero-extended.)
857 8.0xfa+4.0xb,10,2.DN0+8.IMM16A+8.IMM16B:D2a:::movbu
864 /* OP_FAB80000 (); */
866 State.regs[REG_D0 + DN0]
867 = load_byte ((State.regs[REG_SP]
868 + FETCH16(IMM16A, IMM16B)));
872 // 1111 1100 1011 10Dn d32.....; movbu (d32,SP),Dn
873 8.0xfc+4.0xb,10,2.DN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4a:::movbu
880 /* OP_FCB80000 (); */
882 State.regs[REG_D0 + DN0]
883 = load_byte (State.regs[REG_SP]
884 + FETCH32(IMM32A, IMM32B, IMM32C, IMM32D));
888 // 1111 0100 00Dn DiAm; movbu (Di,Am),Dn
889 8.0xf4+00,2.DN2,2.DI,2.AM0:D0a:::movbu
898 State.regs[REG_D0 + DN2]
899 = load_byte ((State.regs[REG_A0 + AM0]
900 + State.regs[REG_D0 + DI]));
904 // 0011 01Dn abs16...; movbu (abs16),Dn (abs16 is zero-extended)
905 4.0x3,01,2.DN0+8.IMM16A+8.IMM16B:S2:::movbu
914 State.regs[REG_D0 + DN0] = load_byte (FETCH16(IMM16A, IMM16B));
918 // 1111 1100 1010 10Dn abs32...; movbu (abs32),Dn
919 8.0xfc+4.0xa,10,2.DN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4b:::movbu
926 /* OP_FCA80000 (); */
928 State.regs[REG_D0 + DN0]
929 = load_byte (FETCH32(IMM32A, IMM32B, IMM32C, IMM32D));
933 // 1111 0000 0101 DmAn; movbu Dm,(An)
934 8.0xf0+4.0x5,2.DM1,2.AN0:D0b:::movbu
943 store_byte (State.regs[REG_A0 + AN0], State.regs[REG_D0 + DM1]);
947 // 1111 1000 0101 DmAn d8......; movbu Dm,(d8,An) (d8 is sign-extended)
948 8.0xf8+4.0x5,2.DM1,2.AN0+8.D8:D1b:::movbu
957 store_byte ((State.regs[REG_A0 + AN0] + EXTEND8 (D8)),
958 State.regs[REG_D0 + DM1]);
962 // 1111 1010 0101 DmAn d16.....; movbu Dm,(d16,An) (d16 is sign-extended.)
963 8.0xfa+4.0x5,2.DM1,2.AN0+8.D16A+8.D16B:D2b:::movbu
970 /* OP_FA500000 (); */
972 store_byte ((State.regs[REG_A0 + AN0] + EXTEND16 (FETCH16(D16A, D16B))),
973 State.regs[REG_D0 + DM1]);
977 // 1111 1100 0101 DmAn d32.....; movbu Dm,(d32,An)
978 8.0xfc+4.0x5,2.DM1,2.AN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4c:::movbu
985 /* OP_FC500000 (); */
987 store_byte ((State.regs[REG_A0 + AN0]
988 + FETCH32(IMM32A, IMM32B, IMM32C, IMM32D)),
989 State.regs[REG_D0 + DM1]);
993 // 1111 1000 1001 Dm10 d8......; movbu Dm,(d8,SP) (d8 is zero-extended)
994 8.0xf8+4.0x9,2.DM1,10+8.D8:D1c:::movbu
1003 store_byte (State.regs[REG_SP] + (D8), State.regs[REG_D0 + DM1]);
1007 // 1111 1010 1001 Dm10 d16.....; movbu Dm,(d16,SP) (d16 is zero-extended.)
1008 8.0xfa+4.0x9,2.DM1,10+8.IMM16A+8.IMM16B:D2c:::movbu
1015 /* OP_FA920000 (); */
1017 store_byte (State.regs[REG_SP] + FETCH16(IMM16A, IMM16B),
1018 State.regs[REG_D0 + DM1]);
1022 // 1111 1100 1001 Dm10 d32.....; movbu Dm,(d32,SP)
1023 8.0xfc+4.0x9,2.DM1,10+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4d:::movbu
1030 /* OP_FC920000 (); */
1032 store_byte (State.regs[REG_SP] + FETCH32(IMM32A, IMM32B, IMM32C, IMM32D),
1033 State.regs[REG_D0 + DM1]);
1037 // 1111 0100 01Dm DiAn; movbu Dm,(Di,An)
1038 8.0xf4+01,2.DM2,2.DI,2.AN0:D0c:::movbu
1047 store_byte ((State.regs[REG_A0 + AN0] + State.regs[REG_D0 + DI]),
1048 State.regs[REG_D0 + DM2]);
1052 // 0000 Dm10 abs16...; movbu Dm,(abs16) (abs16 is zero-extended)
1053 4.0x0,2.DM1,10+8.IMM16A+8.IMM16B:S2a:::movbu
1062 store_byte (FETCH16(IMM16A, IMM16B),
1063 State.regs[REG_D0 + DM1]);
1067 // 1111 1100 1000 Dm10 abs32...; movbu Dm,(abs32)
1068 8.0xfc+4.0x8,2.DM1,10+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4e:::movbu
1075 /* OP_FC820000 (); */
1077 store_byte (FETCH32(IMM32A, IMM32B, IMM32C, IMM32D),
1078 State.regs[REG_D0 + DM1]);
1082 // 1111 0000 0110 DnAm; movhu (Am),Dn
1083 8.0xf0+4.0x6,2.DN1,2.AM0:D0:::movhu
1092 State.regs[REG_D0 + DN1]
1093 = load_half (State.regs[REG_A0 + AM0]);
1097 // 1111 1000 0110 DnAm d8......; movhu (d8,Am),Dn (d8 is sign-extended)
1098 8.0xf8+4.0x6,2.DN1,2.AM0+8.D8:D1d:::movhu
1107 State.regs[REG_D0 + DN1]
1108 = load_half ((State.regs[REG_A0 + AM0] + EXTEND8 (D8)));
1112 // 1111 1010 0110 DnAm d16.....; movhu (d16,Am),Dn (d16 is sign-extended.)
1113 8.0xfa+4.0x6,2.DN1,2.AM0+8.D16A+8.D16B:D2:::movhu
1120 /* OP_FA600000 (); */
1122 State.regs[REG_D0 + DN1]
1123 = load_half ((State.regs[REG_A0 + AM0]
1124 + EXTEND16 (FETCH16(D16A, D16B))));
1128 // 1111 1100 0110 DnAm d32.....; movhu (d32,Am),Dn
1129 8.0xfc+4.0x6,2.DN1,2.AM0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4:::movhu
1136 /* OP_FC600000 (); */
1138 State.regs[REG_D0 + DN1]
1139 = load_half ((State.regs[REG_A0 + AM0]
1140 + FETCH32(IMM32A, IMM32B, IMM32C, IMM32D)));
1144 // 1111 1000 1011 11Dn d8.....; movhu (d8,SP),Dn (d8 is zero-extended)
1145 8.0xf8+4.0xb,11,2.DN0+8.D8:D1a:::movhu
1154 State.regs[REG_D0 + DN0]
1155 = load_half ((State.regs[REG_SP] + (D8)));
1159 // 1111 1010 1011 11Dn d16.....; movhu (d16,SP),Dn (d16 is zero-extended.)
1160 8.0xfa+4.0xb,11,2.DN0+8.IMM16A+8.IMM16B:D2a:::movhu
1167 /* OP_FABC0000 (); */
1169 State.regs[REG_D0 + DN0]
1170 = load_half ((State.regs[REG_SP] + FETCH16(IMM16A, IMM16B)));
1174 // 1111 1100 1011 11Dn d32.....; movhu (d32,SP),Dn
1175 8.0xfc+4.0xb,11,2.DN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4a:::movhu
1182 /* OP_FCBC0000 (); */
1184 State.regs[REG_D0 + DN0]
1185 = load_half (State.regs[REG_SP] + FETCH32(IMM32A, IMM32B, IMM32C, IMM32D));
1189 // 1111 0100 10Dn DiAm; movhu (Di,Am),Dn
1190 8.0xf4+10,2.DN2,2.DI,2.AM0:D0a:::movhu
1199 State.regs[REG_D0 + DN2]
1200 = load_half ((State.regs[REG_A0 + AM0] + State.regs[REG_D0 + DI]));
1204 // 0011 10Dn abs16...; movhu (abs16),Dn (abs16 is zero-extended)
1205 4.0x3,10,2.DN0+8.IMM16A+8.IMM16B:S2:::movhu
1214 State.regs[REG_D0 + DN0] = load_half (FETCH16(IMM16A, IMM16B));
1218 // 1111 1100 1010 11Dn abs32...; movhu (abs32),Dn
1219 8.0xfc+4.0xa,11,2.DN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4b:::movhu
1226 /* OP_FCAC0000 (); */
1228 State.regs[REG_D0 + DN0]
1229 = load_half (FETCH32(IMM32A, IMM32B, IMM32C, IMM32D));
1233 // 1111 0000 0111 DmAn; movhu Dm,(An)
1234 8.0xf0+4.0x7,2.DM1,2.AN0:D0b:::movhu
1243 store_half (State.regs[REG_A0 + AN0],
1244 State.regs[REG_D0 + DM1]);
1248 // 1111 1000 0111 DmAn d8......; movhu Dm,(d8,An) (d8 is sign-extended)
1249 8.0xf8+4.0x7,2.DM1,2.AN0+8.D8:D1b:::movhu
1258 store_half ((State.regs[REG_A0 + AN0] + EXTEND8 (D8)),
1259 State.regs[REG_D0 + DM1]);
1263 // 1111 1010 0111 DnAm d16.....; movhu Dm,(d16,An) (d16 is sign-extended.)
1264 8.0xfa+4.0x7,2.DM1,2.AN0+8.D16A+8.D16B:D2b:::movhu
1271 /* OP_FA700000 (); */
1273 store_half ((State.regs[REG_A0 + AN0] + EXTEND16 (FETCH16(D16A, D16B))),
1274 State.regs[REG_D0 + DM1]);
1278 // 1111 1100 0111 DmAn d32.....; movhu Dm,(d32,An)
1279 8.0xfc+4.0x7,2.DM1,2.AN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4c:::movhu
1286 /* OP_FC700000 (); */
1288 store_half ((State.regs[REG_A0 + AN0]
1289 + FETCH32(IMM32A, IMM32B, IMM32C, IMM32D)),
1290 State.regs[REG_D0 + DM1]);
1294 // 1111 1000 1001 Dm11 d8....; movhu Dm,(d8,SP) (d8 is zero-extended)
1295 8.0xf8+4.0x9,2.DM1,11+8.D8:D1c:::movhu
1304 store_half (State.regs[REG_SP] + (D8),
1305 State.regs[REG_D0 + DM1]);
1309 // 1111 1010 1001 Dm11 d16.....; movhu Dm,(d16,SP) (d16 is zero-extended.)
1310 8.0xfa+4.0x9,2.DM1,11+8.IMM16A+8.IMM16B:D2c:::movhu
1317 /* OP_FA930000 (); */
1319 store_half (State.regs[REG_SP] + FETCH16(IMM16A, IMM16B),
1320 State.regs[REG_D0 + DM1]);
1324 // 1111 1100 1001 Dm11 d32.....; movhu Dm,(d32,SP)
1325 8.0xfc+4.0x9,2.DM1,11+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4d:::movhu
1332 /* OP_FC930000 (); */
1334 store_half (State.regs[REG_SP] + FETCH32(IMM32A, IMM32B, IMM32C, IMM32D),
1335 State.regs[REG_D0 + DM1]);
1339 // 1111 0100 11Dm DiAn; movhu Dm,(Di,An)
1340 8.0xf4+11,2.DM2,2.DI,2.AN0:D0c:::movhu
1349 store_half ((State.regs[REG_A0 + AN0] + State.regs[REG_D0 + DI]),
1350 State.regs[REG_D0 + DM2]);
1354 // 0000 Dm11 abs16...; movhu Dm,(abs16) (abs16 is zero-extended)
1355 4.0x0,2.DM1,11+8.IMM16A+8.IMM16B:S2a:::movhu
1364 store_half (FETCH16(IMM16A, IMM16B), State.regs[REG_D0 + DM1]);
1368 // 1111 1100 1000 Dm11 abs32...; movhu Dm,(abs32)
1369 8.0xfc+4.0x8,2.DM1,11+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4e:::movhu
1376 /* OP_FC830000 (); */
1378 store_half (FETCH32(IMM32A, IMM32B, IMM32C, IMM32D),
1379 State.regs[REG_D0 + DM1]);
1383 // 1111 0010 1101 00Dn; ext Dn
1384 8.0xf2+4.0xd,00,2.DN0:D0:::ext
1393 if (State.regs[REG_D0 + DN0] & 0x80000000)
1394 State.regs[REG_MDR] = -1;
1396 State.regs[REG_MDR] = 0;
1400 // 0001 00Dn; extb Dn
1401 4.0x1,00,2.DN0:S0:::extb
1410 State.regs[REG_D0 + DN0] = EXTEND8 (State.regs[REG_D0 + DN0]);
1414 // 0001 01Dn; extbu Dn
1415 4.0x1,01,2.DN0:S0:::extbu
1424 State.regs[REG_D0 + DN0] &= 0xff;
1428 // 0001 10Dn; exth Dn
1429 4.0x1,10,2.DN0:S0:::exth
1438 State.regs[REG_D0 + DN0] = EXTEND16 (State.regs[REG_D0 + DN0]);
1442 // 0001 11Dn; exthu Dn
1443 4.0x1,11,2.DN0:S0:::exthu
1452 State.regs[REG_D0 + DN0] &= 0xffff;
1456 // 0000 Dn00; clr Dn
1457 4.0x0,2.DN1,00:S0:::clr
1466 State.regs[REG_D0 + DN1] = 0;
1469 PSW &= ~(PSW_V | PSW_C | PSW_N);
1473 // 1110 DmDn; add Dm,Dn
1474 4.0xe,2.DM1,2.DN0:S0:::add
1483 genericAdd(State.regs[REG_D0 + DM1], REG_D0 + DN0);
1486 // 1111 0001 0110 DmAn; add Dm,An
1487 8.0xf1+4.0x6,2.DM1,2.AN0:D0:::add
1496 genericAdd(State.regs[REG_D0 + DM1], REG_A0 + AN0);
1500 // 1111 0001 0101 AmDn; add Am,Dn
1501 8.0xf1+4.0x5,2.AM1,2.DN0:D0a:::add
1510 genericAdd(State.regs[REG_A0 + AM1], REG_D0 + DN0);
1514 // 1111 0001 0111 AmAn; add Am,An
1515 8.0xf1+4.0x7,2.AM1,2.AN0:D0b:::add
1524 genericAdd(State.regs[REG_A0 + AM1], REG_A0 + AN0);
1528 // 0010 10Dn imm8....; add imm8,Dn (imm8 is sign-extended)
1529 4.0x2,10,2.DN0+8.IMM8:S1:::add
1538 genericAdd(EXTEND8(IMM8), REG_D0 + DN0);
1542 // 1111 1010 1100 00Dn imm16...; add imm16,Dn
1543 8.0xfa+4.0xc,00,2.DN0+8.IMM16A+8.IMM16B:D2:::add
1550 /* OP_FAC00000 (); */
1552 genericAdd(EXTEND16(FETCH16(IMM16A, IMM16B)), REG_D0 + DN0);
1556 // 1111 1100 1100 00Dn imm32...; add imm32,Dn
1557 8.0xfc+4.0xc,00,2.DN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4:::add
1564 /* OP_FCC00000 (); */
1566 genericAdd(FETCH32(IMM32A, IMM32B, IMM32C, IMM32D), REG_D0 + DN0);
1570 // 0010 00An imm8....; add imm8,An (imm8 is sign-extended)
1571 4.0x2,00,2.AN0+8.IMM8:S1a:::add
1580 genericAdd(EXTEND8(IMM8), REG_A0 + AN0);
1584 // 1111 1010 1101 00An imm16...; add imm16,An (imm16 is sign-extended.)
1585 8.0xfa+4.0xd,00,2.AN0+8.IMM16A+8.IMM16B:D2a:::add
1592 /* OP_FAD00000 (); */
1594 genericAdd(EXTEND16(FETCH16(IMM16A, IMM16B)), REG_A0 + AN0);
1598 // 1111 1100 1101 00An imm32...; add imm32,An
1599 8.0xfc+4.0xd,00,2.AN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4a:::add
1606 /* OP_FCD00000 (); */
1608 genericAdd(FETCH32(IMM32A, IMM32B, IMM32C, IMM32D), REG_A0 + AN0);
1612 // 1111 1000 1111 1110 imm8....; add imm8,SP (imm8 is sign-extended.)
1613 8.0xf8+8.0xfe+8.IMM8:D1:::add
1623 /* Note: no PSW changes. */
1625 imm = EXTEND8 (IMM8);
1626 State.regs[REG_SP] += imm;
1630 // 1111 1010 1111 1110 imm16...; add imm16,SP (imm16 is sign-extended.)
1631 8.0xfa+8.0xfe+8.IMM16A+8.IMM16B:D2b:::add
1638 /* OP_FAFE0000 (); */
1641 /* Note: no PSW changes. */
1643 imm = EXTEND16 (FETCH16(IMM16A, IMM16B));
1644 State.regs[REG_SP] += imm;
1648 // 1111 1100 1111 1110 imm32...; add imm32,SP
1649 8.0xfc+8.0xfe+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4b:::add
1656 /* OP_FCFE0000 (); */
1659 /* Note: no PSW changes. */
1661 imm = FETCH32(IMM32A, IMM32B, IMM32C, IMM32D);
1662 State.regs[REG_SP] += imm;
1666 // 1111 0001 0100 DmDn; addc Dm,Dn
1667 8.0xf1+4.0x4,2.DM1,2.DN0:D0:::addc
1676 unsigned32 reg1, reg2, sum;
1679 reg1 = State.regs[REG_D0 + DM1];
1680 reg2 = State.regs[REG_D0 + DN0];
1681 sum = reg1 + reg2 + ((PSW & PSW_C) != 0);
1682 State.regs[REG_D0 + DN0] = sum;
1684 z = ((PSW & PSW_Z) != 0) && (sum == 0);
1685 n = (sum & 0x80000000);
1686 c = (sum < reg1) || (sum < reg2);
1687 v = ((reg2 & 0x80000000) == (reg1 & 0x80000000)
1688 && (reg2 & 0x80000000) != (sum & 0x80000000));
1690 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
1691 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
1692 | (c ? PSW_C : 0) | (v ? PSW_V : 0));
1696 // 1111 0001 0000 DmDn; sub Dm,Dn
1697 8.0xf1+4.0x0,2.DM1,2.DN0:D0:::sub
1706 genericSub(State.regs[REG_D0 + DM1], REG_D0 + DN0);
1709 // 1111 0001 0010 DmAn; sub DmAn
1710 8.0xf1+4.0x2,2.DM1,2.AN0:D0a:::sub
1719 genericSub(State.regs[REG_D0 + DM1], REG_A0 + AN0);
1723 // 1111 0001 0001 AmDn; sub AmDn
1724 8.0xf1+4.0x1,2.AM1,2.DN0:D0b:::sub
1733 genericSub(State.regs[REG_A0 + AM1], REG_D0 + DN0);
1737 // 1111 0001 0011 AmAn; sub Am,An
1738 8.0xf1+4.0x3,2.AM1,2.AN0:D0c:::sub
1747 genericSub(State.regs[REG_A0 + AM1], REG_A0 + AN0);
1751 // 1111 1100 1100 01Dn imm32...; sub imm32,Dn
1752 8.0xfc+4.0xc,01,2.DN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4:::sub
1759 /* OP_FCC40000 (); */
1761 genericSub(FETCH32(IMM32A, IMM32B, IMM32C, IMM32D), REG_D0 + DN0);
1765 // 1111 1100 1101 01An imm32...; sub imm32,An
1766 8.0xfc+4.0xd,01,2.AN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4a:::sub
1773 /* OP_FCD40000 (); */
1775 genericSub(FETCH32(IMM32A, IMM32B, IMM32C, IMM32D), REG_A0 + AN0);
1779 // 1111 0001 1000 DmDn; subc Dm,Dn
1780 8.0xf1+4.0x8,2.DM1,2.DN0:D0:::subc
1789 unsigned32 reg1, reg2, difference;
1792 reg1 = State.regs[REG_D0 + DM1];
1793 reg2 = State.regs[REG_D0 + DN0];
1794 difference = reg2 - reg1 - ((PSW & PSW_C) != 0);
1795 State.regs[REG_D0 + DN0] = difference;
1797 z = ((PSW & PSW_Z) != 0) && (difference == 0);
1798 n = (difference & 0x80000000);
1800 v = ((reg2 & 0x80000000) != (reg1 & 0x80000000)
1801 && (reg2 & 0x80000000) != (difference & 0x80000000));
1803 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
1804 PSW |= ((z ? PSW_Z : 0) | ( n ? PSW_N : 0)
1805 | (c ? PSW_C : 0) | (v ? PSW_V : 0));
1809 // 1111 0010 0100 DmDn; mul Dm,Dn
1810 8.0xf2+4.0x4,2.DM1,2.DN0:D0:::mul
1822 temp = ((signed64)(signed32)State.regs[REG_D0 + DN0]
1823 * (signed64)(signed32)State.regs[REG_D0 + DM1]);
1824 State.regs[REG_D0 + DN0] = temp & 0xffffffff;
1825 State.regs[REG_MDR] = (temp & 0xffffffff00000000LL) >> 32;;
1826 z = (State.regs[REG_D0 + DN0] == 0);
1827 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
1828 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
1829 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
1833 // 1111 0010 0101 DmDn; mulu Dm,Dn
1834 8.0xf2+4.0x5,2.DM1,2.DN0:D0:::mulu
1846 temp = ((unsigned64)State.regs[REG_D0 + DN0]
1847 * (unsigned64)State.regs[REG_D0 + DM1]);
1848 State.regs[REG_D0 + DN0] = temp & 0xffffffff;
1849 State.regs[REG_MDR] = (temp & 0xffffffff00000000LL) >> 32;
1850 z = (State.regs[REG_D0 + DN0] == 0);
1851 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
1852 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
1853 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
1857 // 1111 0010 0110 DmDn; div Dm,Dn
1858 8.0xf2+4.0x6,2.DM1,2.DN0:D0:::div
1871 denom = (signed32)State.regs[REG_D0 + DM1];
1873 temp = State.regs[REG_MDR];
1875 temp |= State.regs[REG_D0 + DN0];
1876 if ( !(v = (0 == denom)) )
1878 State.regs[REG_MDR] = temp % (signed32)State.regs[REG_D0 + DM1];
1879 temp /= (signed32)State.regs[REG_D0 + DM1];
1880 State.regs[REG_D0 + DN0] = temp & 0xffffffff;
1884 State.regs[REG_MDR] = temp;
1885 State.regs[REG_D0 + DN0] = 0xff;
1887 z = (State.regs[REG_D0 + DN0] == 0);
1888 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
1889 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
1890 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (v ? PSW_V : 0));
1894 // 1111 0010 0111 DmDn; divu Dm,Dn
1895 8.0xf2+4.0x7,2.DM1,2.DN0:D0:::divu
1908 denom = (unsigned32)State.regs[REG_D0 + DM1];
1909 temp = State.regs[REG_MDR];
1911 temp |= State.regs[REG_D0 + DN0];
1912 if ( !(v = (0 == denom)) )
1914 State.regs[REG_MDR] = temp % State.regs[REG_D0 + DM1];
1915 temp /= State.regs[REG_D0 + DM1];
1916 State.regs[REG_D0 + DN0] = temp & 0xffffffff;
1920 State.regs[REG_MDR] = temp;
1921 State.regs[REG_D0 + DN0] = 0xff;
1923 z = (State.regs[REG_D0 + DN0] == 0);
1924 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
1925 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
1926 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (v ? PSW_V : 0));
1930 // 0100 Dn00; inc Dn
1931 4.0x4,2.DN1,00:S0:::inc
1943 genericAdd(imm, REG_D0 + DN1);
1948 4.0x4,2.AN1,01:S0a:::inc
1957 State.regs[REG_A0 + AN1] += 1;
1961 // 0101 00An; inc4 An
1962 4.0x5,00,2.AN0:S0:::inc4
1971 State.regs[REG_A0 + AN0] += 4;
1975 // 1010 DnDn imm8....; cmp imm8,Dn (imm8 is sign-extended.)
1976 4.0xa,2.DM1,2.DN0=DM1+IMM8:S0i:::cmp
1985 genericCmp(EXTEND8 (IMM8), State.regs[REG_D0 + DN0]);
1989 // 1010 DmDn; cmp Dm,Dn (Dm != Dn, see above when Dm == Dn)
1990 4.0xa,2.DM1,2.DN0!DM1:S0:::cmp
1999 genericCmp(State.regs[REG_D0 + DM1], State.regs[REG_D0 + DN0]);
2003 // 1111 0001 1010 DmAn; cmp Dm,An
2004 8.0xf1+4.0xa,2.DM1,2.AN0:D0:::cmp
2013 genericCmp(State.regs[REG_D0 + DM1], State.regs[REG_A0 + AN0]);
2017 // 1111 0001 1001 AmDn; cmp Am,Dn
2018 8.0xf1+4.0x9,2.AM1,2.DN0:D0a:::cmp
2027 genericCmp(State.regs[REG_A0 + AM1], State.regs[REG_D0 + DN0]);
2031 // 1011 AnAn imm8....; cmp imm8,An (imm8 is zero-extended.)
2032 4.0xb,2.AM1,2.AN0=AM1+IMM8:S0ai:::cmp
2042 State.regs[REG_A0 + AN0]);
2046 // 1011 AmAn; cmp Am,An (Dm != Dn, see above when Dm == Dn)
2047 4.0xb,2.AM1,2.AN0!AM1:S0a:::cmp
2056 genericCmp(State.regs[REG_A0 + AM1], State.regs[REG_A0 + AN0]);
2060 // 1111 1010 1100 10Dn imm16...; cmp imm16,Dn (imm16 is sign-extended.)
2061 8.0xfa+4.0xc,10,2.DN0+8.IMM16A+8.IMM16B:D2:::cmp
2068 /* OP_FAC80000 (); */
2070 genericCmp(EXTEND16(FETCH16(IMM16A, IMM16B)),
2071 State.regs[REG_D0 + DN0]);
2075 // 1111 1100 1100 10Dn imm32...; cmp imm32,Dn
2076 8.0xfc+4.0xc,10,2.DN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4:::cmp
2083 /* OP_FCC80000 (); */
2085 genericCmp(FETCH32(IMM32A, IMM32B, IMM32C, IMM32D),
2086 State.regs[REG_D0 + DN0]);
2090 // 1111 1010 1101 10An imm16...; cmp imm16,An (imm16 is zero-extended.)
2091 8.0xfa+4.0xd,10,2.AN0+8.IMM16A+8.IMM16B:D2a:::cmp
2098 /* OP_FAD80000 (); */
2100 genericCmp(FETCH16(IMM16A, IMM16B),
2101 State.regs[REG_A0 + AN0]);
2105 // 1111 1100 1101 10An imm32...; cmp imm32,An
2106 8.0xfc+4.0xd,10,2.AN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4a:::cmp
2113 /* OP_FCD80000 (); */
2115 genericCmp(FETCH32(IMM32A, IMM32B, IMM32C, IMM32D),
2116 State.regs[REG_A0 + AN0]);
2120 // 1111 0010 0000 DmDn; and Dm,Dn
2121 8.0xf2+4.0x0,2.DM1,2.DN0:D0:::and
2132 State.regs[REG_D0 + DN0] &= State.regs[REG_D0 + DM1];
2133 z = (State.regs[REG_D0 + DN0] == 0);
2134 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
2135 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2136 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
2140 // 1111 1000 1110 00Dn imm8....; and imm8,Dn (imm8 is zero-extended.)
2141 8.0xf8+4.0xe,00,2.DN0+8.IMM8:D1:::and
2152 State.regs[REG_D0 + DN0] &= IMM8;
2153 z = (State.regs[REG_D0 + DN0] == 0);
2154 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
2155 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2156 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
2160 // 1111 1010 1110 00Dn imm16...; and imm16,Dn (imm16 is zero-extended.)
2161 8.0xfa+4.0xe,00,2.DN0+8.IMM16A+8.IMM16B:D2:::and
2168 /* OP_FAE00000 (); */
2172 State.regs[REG_D0 + DN0] &= FETCH16(IMM16A, IMM16B);
2173 z = (State.regs[REG_D0 + DN0] == 0);
2174 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
2175 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2176 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
2180 // 1111 1100 1110 00Dn imm32...; and imm32,Dn
2181 8.0xfc+4.0xe,00,2.DN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4:::and
2188 /* OP_FCE00000 (); */
2192 State.regs[REG_D0 + DN0]
2193 &= FETCH32(IMM32A, IMM32B, IMM32C, IMM32D);
2194 z = (State.regs[REG_D0 + DN0] == 0);
2195 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
2196 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2197 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
2201 // 1111 1010 1111 1100 imm16...; and imm16,PSW (imm16 is zero-extended.)
2202 8.0xfa+8.0xfc+8.IMM16A+8.IMM16B:D2a:::and
2209 /* OP_FAFC0000 (); */
2211 PSW &= FETCH16(IMM16A, IMM16B);
2216 // 1111 0010 0001 DmDn; or DmDn
2217 8.0xf2+4.0x1,2.DM1,2.DN0:D0:::or
2226 genericOr(State.regs[REG_D0 + DM1], REG_D0 + DN0);
2230 // 1111 1000 1110 01Dn imm8....; or imm8,Dn (imm8 is zero-extended.)n
2231 8.0xf8+4.0xe,01,2.DN0+8.IMM8:D1:::or
2240 genericOr(IMM8, REG_D0 + DN0);
2244 // 1111 1010 1110 01Dn imm16...; or imm16,DN (imm16 is zero-extended.)
2245 8.0xfa+4.0xe,01,2.DN0+8.IMM16A+8.IMM16B:D2:::or
2252 /* OP_FAE40000 (); */
2254 genericOr(FETCH16(IMM16A, IMM16B), REG_D0 + DN0);
2258 // 1111 1100 1110 01Dn imm32...; or imm32,Dn
2259 8.0xfc+4.0xe,01,2.DN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4:::or
2266 /* OP_FCE40000 (); */
2268 genericOr(FETCH32(IMM32A, IMM32B, IMM32C, IMM32D), REG_D0 + DN0);
2272 // 1111 1010 1111 1101 imm16...; or imm16,PSW (imm16 is zero-extended.)
2273 8.0xfa+8.0xfd+8.IMM16A+8.IMM16B:D2a:::or
2280 /* OP_FAFD0000 (); */
2282 PSW |= FETCH16(IMM16A, IMM16B);
2286 // 1111 0010 0010 DmDn; xor Dm,Dn
2287 8.0xf2+4.0x2,2.DM1,2.DN0:D0:::xor
2296 genericXor(State.regs[REG_D0 + DM1], REG_D0 + DN0);
2300 // 1111 1010 1110 10Dn imm16...; xor imm16,Dn (imm16 is zero-extended.)
2301 8.0xfa+4.0xe,10,2.DN0+8.IMM16A+8.IMM16B:D2:::xor
2308 /* OP_FAE80000 (); */
2310 genericXor(FETCH16(IMM16A, IMM16B), REG_D0 + DN0);
2314 // 1111 1100 1110 10Dn imm32...; xor imm32,Dn
2315 8.0xfc+4.0xe,10,2.DN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4:::xor
2322 /* OP_FCE80000 (); */
2324 genericXor(FETCH32(IMM32A, IMM32B, IMM32C, IMM32D), REG_D0 + DN0);
2328 // 1111 0010 0011 00Dn; not Dn
2329 8.0xf2+4.0x3,00,2.DN0:D0:::not
2340 State.regs[REG_D0 + DN0] = ~State.regs[REG_D0 + DN0];
2341 z = (State.regs[REG_D0 + DN0] == 0);
2342 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
2343 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2344 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
2348 // 1111 1000 1110 11Dn imm8....; btst imm8,Dn (imm8 is zero-extended.)
2349 8.0xf8+4.0xe,11,2.DN0+8.IMM8:D1:::btst
2358 genericBtst(IMM8, State.regs[REG_D0 + DN0]);
2362 // 1111 1010 1110 11Dn imm16.....; btst imm16,Dn (imm16 is zero-extended.)
2363 8.0xfa+4.0xe,11,2.DN0+8.IMM16A+8.IMM16B:D2:::btst
2370 /* OP_FAEC0000 (); */
2372 genericBtst(FETCH16(IMM16A, IMM16B), State.regs[REG_D0 + DN0]);
2376 // 1111 1100 1110 11Dn imm32...; btst imm32,Dn
2377 8.0xfc+4.0xe,11,2.DN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4:::btst
2384 /* OP_FCEC0000 (); */
2386 genericBtst(FETCH32(IMM32A, IMM32B, IMM32C, IMM32D),
2387 State.regs[REG_D0 + DN0]);
2391 // 1111 1110 0000 0010 abs32... imm8....; btst imm8,(abs32) (imm8 is zero-extended., processing unit: byte)
2392 8.0xfe+8.0x02+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D+8.IMM8:D5:::btst
2399 /* OP_FE020000 (); */
2402 load_byte(FETCH32(IMM32A, IMM32B, IMM32C, IMM32D)));
2406 // 1111 1010 1111 10An d8...... imm8....;
2407 // btst imm8,(d8,An) (d8 is sign-extended,imm8 is zero-extended., processing unit: byte)
2408 8.0xfa+4.0xf,10,2.AN0+8.D8+8.IMM8:D2a:::btst
2415 /* OP_FAF80000 (); */
2418 load_byte(State.regs[REG_A0 + AN0] + EXTEND8(D8)));
2422 // 1111 0000 1000 DmAn; bset Dm,(An) (Processing unit byte)
2423 8.0xf0+4.8,2.DM1,2.AN0:D0:::bset
2435 temp = load_byte (State.regs[REG_A0 + AN0]);
2436 z = (temp & State.regs[REG_D0 + DM1]) == 0;
2437 temp |= State.regs[REG_D0 + DM1];
2438 store_byte (State.regs[REG_A0 + AN0], temp);
2439 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2440 PSW |= (z ? PSW_Z : 0);
2444 // 1111 1110 0000 0000 abs32... imm8....;
2445 // bset imm8,(abs32) (imm8 is zero-extended., processing unit: byte)
2446 8.0xfe+8.0x00+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D+8.IMM8:D5:::bset
2453 /* OP_FE000000 (); */
2458 temp = load_byte (FETCH32(IMM32A, IMM32B, IMM32C, IMM32D));
2459 z = (temp & IMM8) == 0;
2461 store_byte (FETCH32(IMM32A, IMM32B, IMM32C, IMM32D), temp);
2462 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2463 PSW |= (z ? PSW_Z : 0);
2467 // 1111 1010 1111 00AnAn d8...... imm8....;
2468 // bset imm8,(d8,An) (d8 is sign-extended, imm8 is zero-extended., processing unit: byte)
2469 8.0xfa+4.0xf,00,2.AN0+8.D8+8.IMM8:D2:::bset
2476 /* OP_FAF00000 (); */
2481 temp = load_byte ((State.regs[REG_A0 + AN0] + EXTEND8 (D8)));
2482 z = (temp & (IMM8)) == 0;
2484 store_byte ((State.regs[REG_A0 + AN0] + EXTEND8 (D8)), temp);
2485 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2486 PSW |= (z ? PSW_Z : 0);
2490 // 1111 0000 1001 DmAn; bclr Dm,(An) (Processing unit byte)
2491 8.0xf0+4.0x9,2.DM1,2.AN0:D0:::bclr
2503 temp = load_byte (State.regs[REG_A0 + AN0]);
2504 z = (temp & State.regs[REG_D0 + DM1]) == 0;
2505 temp = temp & ~State.regs[REG_D0 + DM1];
2506 store_byte (State.regs[REG_A0 + AN0], temp);
2507 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2508 PSW |= (z ? PSW_Z : 0);
2512 // 1111 1110 0000 0001 abs32... imm8....;
2513 // bclr imm8,(abs32) (imm8 is zero-extended., processing unit: byte)
2514 8.0xfe+8.0x01+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D+8.IMM8:D5:::bclr
2521 /* OP_FE010000 (); */
2526 temp = load_byte (FETCH32(IMM32A, IMM32B, IMM32C, IMM32D));
2527 z = (temp & IMM8) == 0;
2528 temp = temp & ~(IMM8);
2529 store_byte (FETCH32(IMM32A, IMM32B, IMM32C, IMM32D), temp);
2530 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2531 PSW |= (z ? PSW_Z : 0);
2535 // 1111 1010 1111 01An d8...... imm8....;
2536 // bclr imm8,(d8,An) (d8 is sign-extended, imm8 is zero-extended., processing unit: byte)
2537 8.0xfa+4.0xf,01,2.AN0+8.D8+8.IMM8:D2:::bclr
2544 /* OP_FAF40000 (); */
2549 temp = load_byte ((State.regs[REG_A0 + AN0] + EXTEND8 (D8)));
2550 z = (temp & (IMM8)) == 0;
2551 temp = temp & ~(IMM8);
2552 store_byte ((State.regs[REG_A0 + AN0] + EXTEND8 (D8)), temp);
2553 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2554 PSW |= (z ? PSW_Z : 0);
2558 // 1111 0010 1011 DmDn; asr Dm,Dn
2559 8.0xf2+4.0xb,2.DM1,2.DN0:D0:::asr
2571 temp = State.regs[REG_D0 + DN0];
2573 temp >>= State.regs[REG_D0 + DM1];
2574 State.regs[REG_D0 + DN0] = temp;
2575 z = (State.regs[REG_D0 + DN0] == 0);
2576 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
2577 PSW &= ~(PSW_Z | PSW_N | PSW_C);
2578 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
2582 // 1111 1000 1100 10Dn imm8...; asr imm8,Dn (imm8 is zero-extended.)
2583 8.0xf8+4.0xc,10,2.DN0+8.IMM8:D1:::asr
2595 temp = State.regs[REG_D0 + DN0];
2598 State.regs[REG_D0 + DN0] = temp;
2599 z = (State.regs[REG_D0 + DN0] == 0);
2600 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
2601 PSW &= ~(PSW_Z | PSW_N | PSW_C);
2602 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
2606 // 1111 0010 1010 DmDn; lsr Dm,Dn
2607 8.0xf2+4.0xa,2.DM1,2.DN0:D0:::lsr
2618 c = State.regs[REG_D0 + DN0] & 1;
2619 State.regs[REG_D0 + DN0]
2620 >>= State.regs[REG_D0 + DM1];
2621 z = (State.regs[REG_D0 + DN0] == 0);
2622 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
2623 PSW &= ~(PSW_Z | PSW_N | PSW_C);
2624 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
2628 // 1111 1000 1100 01Dn imm8...; lsr imm8,Dn (imm8 is zero-extended.)
2629 8.0xf8+4.0xc,01,2.DN0+8.IMM8:D1:::lsr
2640 c = State.regs[REG_D0 + DN0] & 1;
2641 State.regs[REG_D0 + DN0] >>= IMM8;
2642 z = (State.regs[REG_D0 + DN0] == 0);
2643 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
2644 PSW &= ~(PSW_Z | PSW_N | PSW_C);
2645 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
2649 // 1111 0010 1001 DmDn; asl Dm,Dn
2650 8.0xf2+4.0x9,2.DM1,2.DN0:D0:::asl
2661 State.regs[REG_D0 + DN0]
2662 <<= State.regs[REG_D0 + DM1];
2663 z = (State.regs[REG_D0 + DN0] == 0);
2664 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
2665 PSW &= ~(PSW_Z | PSW_N);
2666 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
2670 // 1111 1000 1100 00Dn imm8...; asl imm8,Dn (imm8 is zero-extended.)
2671 8.0xf8+4.0xc,00,2.DN0+8.IMM8:D1:::asl
2682 State.regs[REG_D0 + DN0] <<= IMM8;
2683 z = (State.regs[REG_D0 + DN0] == 0);
2684 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
2685 PSW &= ~(PSW_Z | PSW_N);
2686 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
2690 // 0101 01Dn; als2 Dn
2691 4.0x5,01,2.DN0:S0:::asl2
2702 State.regs[REG_D0 + DN0] <<= 2;
2703 z = (State.regs[REG_D0 + DN0] == 0);
2704 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
2705 PSW &= ~(PSW_Z | PSW_N);
2706 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
2710 // 1111 0010 1000 01Dn; ror Dn
2711 8.0xf2+4.0x8,01,2.DN0:D0:::ror
2723 value = State.regs[REG_D0 + DN0];
2727 value |= ((PSW & PSW_C) != 0) ? 0x80000000 : 0;
2728 State.regs[REG_D0 + DN0] = value;
2730 n = (value & 0x80000000) != 0;
2731 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2732 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
2736 // 1111 0010 1000 00Dn; rol Dn
2737 8.0xf2+4.0x8,00,2.DN0:D0:::rol
2749 value = State.regs[REG_D0 + DN0];
2750 c = (value & 0x80000000) ? 1 : 0;
2753 value |= ((PSW & PSW_C) != 0);
2754 State.regs[REG_D0 + DN0] = value;
2756 n = (value & 0x80000000) != 0;
2757 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
2758 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0) | (c ? PSW_C : 0));
2762 // 1100 1000 d8......; beq (d8,PC) (d8 is sign-extended)
2763 8.0xc8+8.D8:S1:::beq
2774 State.regs[REG_PC] += EXTEND8 (D8);
2780 // 1100 1001 d8......; bne (d8,PC) (d8 is sign-extended)
2781 8.0xc9+8.D8:S1:::bne
2792 State.regs[REG_PC] += EXTEND8 (D8);
2798 // 1100 0001 d8......; bgt (d8,PC) (d8 is sign-extended)
2799 8.0xc1+8.D8:S1:::bgt
2809 || (((PSW & PSW_N) != 0) ^ ((PSW & PSW_V) != 0))))
2811 State.regs[REG_PC] += EXTEND8 (D8);
2817 // 1100 0010 d8......; bge (d8,PC) (d8 is sign-extended)
2818 8.0xc2+8.D8:S1:::bge
2827 if (!(((PSW & PSW_N) != 0) ^ ((PSW & PSW_V) != 0)))
2829 State.regs[REG_PC] += EXTEND8 (D8);
2835 // 1100 0011 d8......; ble (d8,PC) (d8 is sign-extended)
2836 8.0xc3+8.D8:S1:::ble
2846 || (((PSW & PSW_N) != 0) ^ ((PSW & PSW_V) != 0)))
2848 State.regs[REG_PC] += EXTEND8 (D8);
2854 // 1100 0000 d8......; blt (d8,PC) (d8 is sign-extended)
2855 8.0xc0+8.D8:S1:::blt
2864 if (((PSW & PSW_N) != 0) ^ ((PSW & PSW_V) != 0))
2866 State.regs[REG_PC] += EXTEND8 (D8);
2872 // 1100 0101 d8......; bhi (d8,PC) (d8 is sign-extended)
2873 8.0xc5+8.D8:S1:::bhi
2882 if (!(((PSW & PSW_C) != 0) || (PSW & PSW_Z) != 0))
2884 State.regs[REG_PC] += EXTEND8 (D8);
2890 // 1100 0110 d8......; bcc (d8,PC) (d8 is sign-extended)
2891 8.0xc6+8.D8:S1:::bcc
2902 State.regs[REG_PC] += EXTEND8 (D8);
2908 // 1100 0101 d8......; bls (d8,PC) (d8 is sign-extended)
2909 8.0xc7+8.D8:S1:::bls
2918 if (((PSW & PSW_C) != 0) || (PSW & PSW_Z) != 0)
2920 State.regs[REG_PC] += EXTEND8 (D8);
2926 // 1100 0100 d8......; bcs (d8,PC) (d8 is sign-extended)
2927 8.0xc4+8.D8:S1:::bcs
2938 State.regs[REG_PC] += EXTEND8 (D8);
2944 // 1111 1000 1110 1000 d8......; bvc (d8,PC) (d8 is sign-extended)
2945 8.0xf8+8.0xe8+8.D8:D1:::bvc
2956 State.regs[REG_PC] += EXTEND8 (D8);
2962 // 1111 1000 1110 1001 d8......; bvs (d8,PC) (d8 is sign-extended)
2963 8.0xf8+8.0xe9+8.D8:D1:::bvs
2974 State.regs[REG_PC] += EXTEND8 (D8);
2980 // 1111 1000 1110 1010 d8......; bnc (d8,PC) (d8 is sign-extended)
2981 8.0xf8+8.0xea+8.D8:D1:::bnc
2992 State.regs[REG_PC] += EXTEND8 (D8);
2998 // 1111 1000 1110 1010 d8......; bns (d8,PC) (d8 is sign-extended)
2999 8.0xf8+8.0xeb+8.D8:D1:::bns
3010 State.regs[REG_PC] += EXTEND8 (D8);
3016 // 1100 1010 d8......; bra (d8,PC) (d8 is sign-extended)
3017 8.0xca+8.D8:S1:::bra
3026 State.regs[REG_PC] += EXTEND8 (D8);
3043 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
3061 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
3078 || (((PSW & PSW_N) != 0) ^ ((PSW & PSW_V) != 0))))
3080 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
3096 if (!(((PSW & PSW_N) != 0) ^ ((PSW & PSW_V) != 0)))
3098 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
3115 || (((PSW & PSW_N) != 0) ^ ((PSW & PSW_V) != 0)))
3117 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
3133 if (((PSW & PSW_N) != 0) ^ ((PSW & PSW_V) != 0))
3135 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
3151 if (!(((PSW & PSW_C) != 0) || (PSW & PSW_Z) != 0))
3153 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
3171 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
3187 if (((PSW & PSW_C) != 0) || (PSW & PSW_Z) != 0)
3189 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
3207 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
3223 State.regs[REG_PC] = State.regs[REG_LAR] - 4;
3238 State.regs[REG_LIR] = load_word (State.regs[REG_PC] + 1);
3239 State.regs[REG_LAR] = State.regs[REG_PC] + 5;
3243 // 1111 0000 1111 01An; jmp (An)
3244 8.0xf0+4.0xf,01,2.AN0:D0:::jmp
3252 PC = State.regs[REG_A0 + AN0];
3257 // 1100 1100 d16.....; jmp (d16,PC) (d16 is sign-extended.)
3258 8.0xcc+8.D16A+8.D16B:S2:::jmp
3266 PC = cia + EXTEND16(FETCH16(D16A, D16B));
3271 // 1101 1100 d32........; jmp (d32, PC)
3272 8.0xdc+8.D32A+8.D32B+8.D32C+8.D32D:S4:::jmp
3279 /* OP_DC000000 (); */
3280 PC = cia + FETCH32(D32A, D32B, D32C, D32D);
3285 // 1111 0000 1111 00An; calls (An)
3286 8.0xf0+4.0xf,00,2.AN0:D0:::calls
3294 unsigned32 next_pc, sp;
3297 sp = State.regs[REG_SP];
3298 next_pc = State.regs[REG_PC] + 2;
3299 store_word(sp, next_pc);
3300 State.regs[REG_MDR] = next_pc;
3301 State.regs[REG_PC] = State.regs[REG_A0 + AN0];
3306 // 1111 1010 1111 1111 d16.....; calls (d16,PC) (d16 is sign-extended.)
3307 8.0xfa+8.0xff+8.D16A+8.D16B:D2:::calls
3314 /* OP_FAFF0000 (); */
3315 unsigned32 next_pc, sp;
3318 sp = State.regs[REG_SP];
3319 next_pc = State.regs[REG_PC] + 4;
3320 store_word(sp, next_pc);
3321 State.regs[REG_MDR] = next_pc;
3322 State.regs[REG_PC] += EXTEND16 (FETCH16(D16A, D16B));
3327 // 1111 1100 1111 1111 d32.....; calls (d32,PC)
3328 8.0xfc+8.0xff+8.D32A+8.D32B+8.D32C+8.D32D:D4:::calls
3335 /* OP_FCFF0000 (); */
3336 unsigned32 next_pc, sp;
3339 sp = State.regs[REG_SP];
3340 next_pc = State.regs[REG_PC] + 6;
3341 store_word(sp, next_pc);
3342 State.regs[REG_MDR] = next_pc;
3343 State.regs[REG_PC] += FETCH32(D32A, D32B, D32C, D32D);
3348 // 1111 0000 1111 1100; rets
3349 8.0xf0+8.0xfc:D0:::rets
3359 sp = State.regs[REG_SP];
3360 State.regs[REG_PC] = load_word(sp);
3365 // 1111 0000 1111 1101; rti
3366 8.0xf0+8.0xfd:D0:::rti
3376 sp = State.regs[REG_SP];
3377 PSW = load_half(sp);
3378 State.regs[REG_PC] = load_word(sp+4);
3379 State.regs[REG_SP] +=8;
3384 // 1111 0000 1111 1110; trap
3385 8.0xf0+8.0xfe:D0:::trap
3393 unsigned32 sp, next_pc;
3396 sp = State.regs[REG_SP];
3397 next_pc = State.regs[REG_PC] + 2;
3398 store_word(sp, next_pc);
3403 // 1111 0000 1111 1111; rtm
3404 8.0xf0+8.0xff:D0:::rtm
3430 // 1111 0101 0000 DmDn; udf20 Dm,Dn
3431 8.0xf5+4.0x0,2.DM1,2.DN0:D0:::putx
3437 State.regs[REG_MDRQ] = State.regs[REG_D0 + DN0];
3441 // 1111 0110 1111 DmDn; udf15 Dm,Dn
3442 8.0xf6+4.0xf,2.DM1,2.DN0:D0:::getx
3453 z = (State.regs[REG_MDRQ] == 0);
3454 n = ((State.regs[REG_MDRQ] & 0x80000000) != 0);
3455 State.regs[REG_D0 + DN0] = State.regs[REG_MDRQ];
3457 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
3458 PSW |= (z ? PSW_Z : 0) | (n ? PSW_N : 0);
3462 // 1111 0110 0000 DmDn; udf00 Dm,Dn
3463 8.0xf6+4.0x0,2.DM1,2.DN0:D0:::mulq
3475 temp = ((signed64)(signed32)State.regs[REG_D0 + DN0]
3476 * (signed64)(signed32)State.regs[REG_D0 + DM1]);
3477 State.regs[REG_D0 + DN0] = temp & 0xffffffff;
3478 State.regs[REG_MDRQ] = (temp & 0xffffffff00000000LL) >> 32;;
3479 z = (State.regs[REG_D0 + DN0] == 0);
3480 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
3481 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
3482 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
3486 // 1111 1001 0000 00Dn imm8....; udf00 imm8,Dn (imm8 is sign-extended.)
3487 8.0xf9+4.0x,00,2.DN0+8.IMM8:D1:::mulq
3499 temp = ((signed64)(signed32)State.regs[REG_D0 + DN0]
3500 * (signed64)(signed32)EXTEND8 (IMM8));
3501 State.regs[REG_D0 + DN0] = temp & 0xffffffff;
3502 State.regs[REG_MDRQ] = (temp & 0xffffffff00000000LL) >> 32;;
3503 z = (State.regs[REG_D0 + DN0] == 0);
3504 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
3505 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
3506 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
3510 // 1111 1011 0000 00Dn imm16...; udf00 imm16,Dn (imm16 is sign-extended.)
3511 8.0xfb+4.0x0,00,2.DN0+8.IMM16A+8.IMM16B:D2:::mulq
3518 /* OP_FB000000 (); */
3523 temp = ((signed64)(signed32)State.regs[REG_D0 + DN0]
3524 * (signed64)(signed32)EXTEND16 (FETCH16(IMM16A, IMM16B)));
3525 State.regs[REG_D0 + DN0] = temp & 0xffffffff;
3526 State.regs[REG_MDRQ] = (temp & 0xffffffff00000000LL) >> 32;;
3527 z = (State.regs[REG_D0 + DN0] == 0);
3528 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
3529 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
3530 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
3534 // 1111 1101 0000 00Dn imm32...; udf00 imm32,Dn
3535 8.0xfd+4.0x0,00,2.DN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4:::mulq
3542 /* OP_FD000000 (); */
3547 temp = ((signed64)(signed32)State.regs[REG_D0 + DN0]
3548 * (signed64)(signed32)(FETCH32(IMM32A, IMM32B, IMM32C, IMM32D)));
3549 State.regs[REG_D0 + DN0] = temp & 0xffffffff;
3550 State.regs[REG_MDRQ] = (temp & 0xffffffff00000000LL) >> 32;;
3551 z = (State.regs[REG_D0 + DN0] == 0);
3552 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
3553 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
3554 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
3558 // 1111 0110 0001 DmDn; udf01 Dm,Dn
3559 8.0xf6+4.0x1,2.DM1,2.DN0:D0:::mulqu
3571 temp = ((unsigned64) State.regs[REG_D0 + DN0]
3572 * (unsigned64) State.regs[REG_D0 + DM1]);
3573 State.regs[REG_D0 + DN0] = temp & 0xffffffff;
3574 State.regs[REG_MDRQ] = (temp & 0xffffffff00000000LL) >> 32;;
3575 z = (State.regs[REG_D0 + DN0] == 0);
3576 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
3577 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
3578 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
3582 // 1111 1001 0001 01Dn imm8....; udfu01 imm8,Dn (imm8 is zero-extended.)
3583 8.0xf9+4.0x1,01,2.DN0+8.IMM8:D1:::mulqu
3595 temp = ((unsigned64)State.regs[REG_D0 + DN0]
3596 * (unsigned64)EXTEND8 (IMM8));
3597 State.regs[REG_D0 + DN0] = temp & 0xffffffff;
3598 State.regs[REG_MDRQ] = (temp & 0xffffffff00000000LL) >> 32;;
3599 z = (State.regs[REG_D0 + DN0] == 0);
3600 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
3601 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
3602 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
3606 // 1111 1011 0001 01Dn imm16...; udfu01 imm16,Dn (imm16 is zero-extended.)
3607 8.0xfb+4.0x1,01,2.DN0+8.IMM16A+8.IMM16B:D2:::mulqu
3614 /* OP_FB140000 (); */
3619 temp = ((unsigned64)State.regs[REG_D0 + DN0]
3620 * (unsigned64) EXTEND16 (FETCH16(IMM16A, IMM16B)));
3621 State.regs[REG_D0 + DN0] = temp & 0xffffffff;
3622 State.regs[REG_MDRQ] = (temp & 0xffffffff00000000LL) >> 32;;
3623 z = (State.regs[REG_D0 + DN0] == 0);
3624 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
3625 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
3626 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
3630 // 1111 1101 0001 01Dn imm32...; udfu01 imm32,Dn
3631 8.0xfd+4.0x1,01,2.DN0+8.IMM32A+8.IMM32B+8.IMM32C+8.IMM32D:D4:::mulqu
3638 /* OP_FD140000 (); */
3643 temp = ((unsigned64)State.regs[REG_D0 + DN0]
3644 * (unsigned64)(FETCH32(IMM32A, IMM32B, IMM32C, IMM32D)));
3645 State.regs[REG_D0 + DN0] = temp & 0xffffffff;
3646 State.regs[REG_MDRQ] = (temp & 0xffffffff00000000LL) >> 32;;
3647 z = (State.regs[REG_D0 + DN0] == 0);
3648 n = (State.regs[REG_D0 + DN0] & 0x80000000) != 0;
3649 PSW &= ~(PSW_Z | PSW_N | PSW_C | PSW_V);
3650 PSW |= ((z ? PSW_Z : 0) | (n ? PSW_N : 0));
3654 // 1111 0110 0100 DmDn; udf04 Dm,Dn
3655 8.0xf6+4.0x4,2.DM1,2.DN0:D0:::sat16
3666 temp = State.regs[REG_D0 + DM1];
3667 temp = (temp > 0x7fff ? 0x7fff : temp);
3668 temp = (temp < -0x8000 ? -0x8000 : temp);
3669 State.regs[REG_D0 + DN0] = temp;
3673 // 1111 0110 0101 DmDn; udf05 Dm,Dn
3674 8.0xf6+4.0x5,2.DM1,2.DN0:D0:::sat24
3685 temp = State.regs[REG_D0 + DM1];
3686 temp = (temp > 0x7fffff ? 0x7fffff : temp);
3687 temp = (temp < -0x800000 ? -0x800000 : temp);
3688 State.regs[REG_D0 + DN0] = temp;
3692 // 1111 0110 0111 DmDn; udf07 Dm,Dn
3693 8.0xf6+4.0x7,2.DM1,2.DN0:D0:::bsch
3704 temp = State.regs[REG_D0 + DM1];
3705 temp <<= (State.regs[REG_D0 + DN0] & 0x1f);
3706 c = (temp != 0 ? 1 : 0);
3708 PSW |= (c ? PSW_C : 0);
3712 // 1111 0000 1100 0000; syscall
3713 8.0xf0+8.0xc0:D0:::syscall
3736 program_interrupt(SD, CPU, cia, SIM_SIGTRAP);
3739 // 1100 1110 regs....; movm (SP),regs
3740 8.0xce+8.REGS:S1:::movm
3748 unsigned32 sp = State.regs[REG_SP];
3757 State.regs[REG_LAR] = load_word (sp);
3759 State.regs[REG_LIR] = load_word (sp);
3761 State.regs[REG_MDR] = load_word (sp);
3763 State.regs[REG_A0 + 1] = load_word (sp);
3765 State.regs[REG_A0] = load_word (sp);
3767 State.regs[REG_D0 + 1] = load_word (sp);
3769 State.regs[REG_D0] = load_word (sp);
3775 State.regs[REG_A0 + 3] = load_word (sp);
3781 State.regs[REG_A0 + 2] = load_word (sp);
3787 State.regs[REG_D0 + 3] = load_word (sp);
3793 State.regs[REG_D0 + 2] = load_word (sp);
3797 if (STATE_ARCHITECTURE (sd)->mach == bfd_mach_am33
3802 /* Need to restore MDQR, MCRH, MCRL, and MCVF */
3804 State.regs[REG_E0 + 1] = load_word (sp);
3806 State.regs[REG_E0 + 0] = load_word (sp);
3812 State.regs[REG_E0 + 7] = load_word (sp);
3814 State.regs[REG_E0 + 6] = load_word (sp);
3816 State.regs[REG_E0 + 5] = load_word (sp);
3818 State.regs[REG_E0 + 4] = load_word (sp);
3824 State.regs[REG_E0 + 3] = load_word (sp);
3826 State.regs[REG_E0 + 2] = load_word (sp);
3831 /* And make sure to update the stack pointer. */
3832 State.regs[REG_SP] = sp;
3836 // 1100 1111 regs....; movm regs,(SP)
3837 8.0xcf+8.REGS:S1a:::movm
3845 unsigned32 sp = State.regs[REG_SP];
3851 if (STATE_ARCHITECTURE (sd)->mach == bfd_mach_am33
3857 store_word (sp, State.regs[REG_E0 + 2]);
3859 store_word (sp, State.regs[REG_E0 + 3]);
3865 store_word (sp, State.regs[REG_E0 + 4]);
3867 store_word (sp, State.regs[REG_E0 + 5]);
3869 store_word (sp, State.regs[REG_E0 + 6]);
3871 store_word (sp, State.regs[REG_E0 + 7]);
3877 store_word (sp, State.regs[REG_E0 + 0]);
3879 store_word (sp, State.regs[REG_E0 + 1]);
3881 /* Need to save MDQR, MCRH, MCRL, and MCVF */
3888 store_word (sp, State.regs[REG_D0 + 2]);
3894 store_word (sp, State.regs[REG_D0 + 3]);
3900 store_word (sp, State.regs[REG_A0 + 2]);
3906 store_word (sp, State.regs[REG_A0 + 3]);
3912 store_word (sp, State.regs[REG_D0]);
3914 store_word (sp, State.regs[REG_D0 + 1]);
3916 store_word (sp, State.regs[REG_A0]);
3918 store_word (sp, State.regs[REG_A0 + 1]);
3920 store_word (sp, State.regs[REG_MDR]);
3922 store_word (sp, State.regs[REG_LIR]);
3924 store_word (sp, State.regs[REG_LAR]);
3928 /* And make sure to update the stack pointer. */
3929 State.regs[REG_SP] = sp;
3932 // 1100 1101 d16..... regs.... imm8....;
3933 // call (d16,PC),regs,imm8 (d16 is sign-extended., imm8 is zero-extended.)
3934 8.0xcd+8.D16A+8.D16B+8.REGS+8.IMM8:S4:::call
3941 /* OP_CD000000 (); */
3942 unsigned32 next_pc, sp;
3946 sp = State.regs[REG_SP];
3948 store_word(sp, next_pc);
3952 if (STATE_ARCHITECTURE (sd)->mach == bfd_mach_am33
3958 store_word (sp, State.regs[REG_E0 + 2]);
3960 store_word (sp, State.regs[REG_E0 + 3]);
3966 store_word (sp, State.regs[REG_E0 + 4]);
3968 store_word (sp, State.regs[REG_E0 + 5]);
3970 store_word (sp, State.regs[REG_E0 + 6]);
3972 store_word (sp, State.regs[REG_E0 + 7]);
3978 store_word (sp, State.regs[REG_E0 + 0]);
3980 store_word (sp, State.regs[REG_E0 + 1]);
3982 /* Need to save MDQR, MCRH, MCRL, and MCVF */
3989 store_word (sp, State.regs[REG_D0 + 2]);
3995 store_word (sp, State.regs[REG_D0 + 3]);
4001 store_word (sp, State.regs[REG_A0 + 2]);
4007 store_word (sp, State.regs[REG_A0 + 3]);
4013 store_word (sp, State.regs[REG_D0]);
4015 store_word (sp, State.regs[REG_D0 + 1]);
4017 store_word (sp, State.regs[REG_A0]);
4019 store_word (sp, State.regs[REG_A0 + 1]);
4021 store_word (sp, State.regs[REG_MDR]);
4023 store_word (sp, State.regs[REG_LIR]);
4025 store_word (sp, State.regs[REG_LAR]);
4029 /* Update the stack pointer, note that the register saves to do not
4030 modify SP. The SP adjustment is derived totally from the imm8
4032 State.regs[REG_SP] -= IMM8;
4033 State.regs[REG_MDR] = next_pc;
4034 State.regs[REG_PC] += EXTEND16 (FETCH16(D16A, D16B));
4039 // 1101 1101 d32..... regs.... imm8....;
4040 // call (d32,PC),regs,imm8 (imm8 is zero-extended.)
4041 8.0xdd+8.D32A+8.D32B+8.D32C+8.D32D+8.REGS+8.IMM8:S6:::call
4048 /* OP_DD000000 (); */
4049 unsigned32 next_pc, sp;
4053 sp = State.regs[REG_SP];
4054 next_pc = State.regs[REG_PC] + 7;
4055 /* could assert that nia == next_pc here */
4056 store_word(sp, next_pc);
4060 if (STATE_ARCHITECTURE (sd)->mach == bfd_mach_am33
4066 store_word (sp, State.regs[REG_E0 + 2]);
4068 store_word (sp, State.regs[REG_E0 + 3]);
4074 store_word (sp, State.regs[REG_E0 + 4]);
4076 store_word (sp, State.regs[REG_E0 + 5]);
4078 store_word (sp, State.regs[REG_E0 + 6]);
4080 store_word (sp, State.regs[REG_E0 + 7]);
4086 store_word (sp, State.regs[REG_E0 + 0]);
4088 store_word (sp, State.regs[REG_E0 + 1]);
4090 /* Need to save MDQR, MCRH, MCRL, and MCVF */
4097 store_word (sp, State.regs[REG_D0 + 2]);
4103 store_word (sp, State.regs[REG_D0 + 3]);
4109 store_word (sp, State.regs[REG_A0 + 2]);
4115 store_word (sp, State.regs[REG_A0 + 3]);
4121 store_word (sp, State.regs[REG_D0]);
4123 store_word (sp, State.regs[REG_D0 + 1]);
4125 store_word (sp, State.regs[REG_A0]);
4127 store_word (sp, State.regs[REG_A0 + 1]);
4129 store_word (sp, State.regs[REG_MDR]);
4131 store_word (sp, State.regs[REG_LIR]);
4133 store_word (sp, State.regs[REG_LAR]);
4137 /* Update the stack pointer, note that the register saves to do not
4138 modify SP. The SP adjustment is derived totally from the imm8
4140 State.regs[REG_SP] -= IMM8;
4141 State.regs[REG_MDR] = next_pc;
4142 State.regs[REG_PC] += FETCH32(D32A, D32B, D32C, D32D);
4147 // 1101 1111 regs.... imm8....; ret regs,imm8 (imm8 is zero-extended.)
4148 8.0xdf+8.REGS+8.IMM8:S2:::ret
4156 unsigned32 sp, offset;
4160 State.regs[REG_SP] += IMM8;
4161 sp = State.regs[REG_SP];
4166 if (STATE_ARCHITECTURE (sd)->mach == bfd_mach_am33
4172 State.regs[REG_E0 + 2] = load_word (sp + offset);
4174 State.regs[REG_E0 + 3] = load_word (sp + offset);
4180 State.regs[REG_E0 + 4] = load_word (sp + offset);
4182 State.regs[REG_E0 + 5] = load_word (sp + offset);
4184 State.regs[REG_E0 + 6] = load_word (sp + offset);
4186 State.regs[REG_E0 + 7] = load_word (sp + offset);
4192 /* Need to restore MDQR, MCRH, MCRL, and MCVF */
4194 State.regs[REG_E0 + 0] = load_word (sp + offset);
4196 State.regs[REG_E0 + 1] = load_word (sp + offset);
4204 State.regs[REG_D0 + 2] = load_word (sp + offset);
4210 State.regs[REG_D0 + 3] = load_word (sp + offset);
4216 State.regs[REG_A0 + 2] = load_word (sp + offset);
4222 State.regs[REG_A0 + 3] = load_word (sp + offset);
4228 State.regs[REG_D0] = load_word (sp + offset);
4230 State.regs[REG_D0 + 1] = load_word (sp + offset);
4232 State.regs[REG_A0] = load_word (sp + offset);
4234 State.regs[REG_A0 + 1] = load_word (sp + offset);
4236 State.regs[REG_MDR] = load_word (sp + offset);
4238 State.regs[REG_LIR] = load_word (sp + offset);
4240 State.regs[REG_LAR] = load_word (sp + offset);
4244 /* Restore the PC value. */
4245 State.regs[REG_PC] = load_word(sp);
4250 // 1101 1110 regs.... imm8....; retf regs,imm8 (imm8 is zero-extended.)
4251 8.0xde+8.REGS+8.IMM8:S2:::retf
4259 unsigned32 sp, offset;
4263 State.regs[REG_SP] += IMM8;
4264 sp = State.regs[REG_SP];
4265 State.regs[REG_PC] = State.regs[REG_MDR];
4270 if (STATE_ARCHITECTURE (sd)->mach == bfd_mach_am33
4276 State.regs[REG_E0 + 2] = load_word (sp + offset);
4278 State.regs[REG_E0 + 3] = load_word (sp + offset);
4284 State.regs[REG_E0 + 4] = load_word (sp + offset);
4286 State.regs[REG_E0 + 5] = load_word (sp + offset);
4288 State.regs[REG_E0 + 6] = load_word (sp + offset);
4290 State.regs[REG_E0 + 7] = load_word (sp + offset);
4296 /* Need to restore MDQR, MCRH, MCRL, and MCVF */
4298 State.regs[REG_E0 + 0] = load_word (sp + offset);
4300 State.regs[REG_E0 + 1] = load_word (sp + offset);
4308 State.regs[REG_D0 + 2] = load_word (sp + offset);
4314 State.regs[REG_D0 + 3] = load_word (sp + offset);
4320 State.regs[REG_A0 + 2] = load_word (sp + offset);
4326 State.regs[REG_A0 + 3] = load_word (sp + offset);
4332 State.regs[REG_D0] = load_word (sp + offset);
4334 State.regs[REG_D0 + 1] = load_word (sp + offset);
4336 State.regs[REG_A0] = load_word (sp + offset);
4338 State.regs[REG_A0 + 1] = load_word (sp + offset);
4340 State.regs[REG_MDR] = load_word (sp + offset);
4342 State.regs[REG_LIR] = load_word (sp + offset);
4344 State.regs[REG_LAR] = load_word (sp + offset);
4351 :include::am33:am33.igen