-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmsp430-decode.c
4345 lines (4261 loc) · 98.8 KB
/
msp430-decode.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#line 1 "msp430-decode.opc"
/* -*- c -*- */
/* Copyright (C) 2013-2016 Free Software Foundation, Inc.
Contributed by Red Hat.
Written by DJ Delorie.
This file is part of the GNU opcodes library.
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
It is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "sysdep.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ansidecl.h"
#include "opcode/msp430-decode.h"
static int trace = 0;
typedef struct
{
MSP430_Opcode_Decoded *msp430;
int (*getbyte)(void *);
void *ptr;
unsigned char *op;
int op_ptr;
int pc;
} LocalData;
#define AU ATTRIBUTE_UNUSED
#define GETBYTE() getbyte_swapped (ld)
#define B ((unsigned long) GETBYTE ())
static int
getbyte_swapped (LocalData *ld)
{
int b;
if (ld->op_ptr == ld->msp430->n_bytes)
{
do
{
b = ld->getbyte (ld->ptr);
ld->op [(ld->msp430->n_bytes++)^1] = b;
}
while (ld->msp430->n_bytes & 1);
}
return ld->op[ld->op_ptr++];
}
#define ID(x) msp430->id = x
#define OP(n, t, r, a) (msp430->op[n].type = t, \
msp430->op[n].reg = r, \
msp430->op[n].addend = a)
#define OPX(n, t, r1, r2, a) \
(msp430->op[n].type = t, \
msp430->op[n].reg = r1, \
msp430->op[n].reg2 = r2, \
msp430->op[n].addend = a)
#define SYNTAX(x) msp430->syntax = x
#define UNSUPPORTED() msp430->syntax = "*unknown*"
#define DC(c) OP (0, MSP430_Operand_Immediate, 0, c)
#define DR(r) OP (0, MSP430_Operand_Register, r, 0)
#define DM(r, a) OP (0, MSP430_Operand_Indirect, r, a)
#define DA(a) OP (0, MSP430_Operand_Indirect, MSR_None, a)
#define AD(r, ad) encode_ad (r, ad, ld, 0)
#define ADX(r, ad, x) encode_ad (r, ad, ld, x)
#define SC(c) OP (1, MSP430_Operand_Immediate, 0, c)
#define SR(r) OP (1, MSP430_Operand_Register, r, 0)
#define SM(r, a) OP (1, MSP430_Operand_Indirect, r, a)
#define SA(a) OP (1, MSP430_Operand_Indirect, MSR_None, a)
#define SI(r) OP (1, MSP430_Operand_Indirect_Postinc, r, 0)
#define AS(r, as) encode_as (r, as, ld, 0)
#define ASX(r, as, x) encode_as (r, as, ld, x)
#define BW(x) msp430->size = (x ? 8 : 16)
/* The last 20 is for SWPBX.Z and SXTX.A. */
#define ABW(a,x) msp430->size = (a ? ((x ? 8 : 16)) : (x ? 20 : 20))
#define IMMU(bytes) immediate (bytes, 0, ld)
#define IMMS(bytes) immediate (bytes, 1, ld)
/* Helper macros for known status bits settings. */
#define F_____ msp430->flags_1 = msp430->flags_0 = 0; msp430->flags_set = 0
#define F_VNZC msp430->flags_1 = msp430->flags_0 = 0; msp430->flags_set = 0x87
#define F_0NZC msp430->flags_1 = 0; msp430->flags_0 = 0x80; msp430->flags_set = 0x07
/* The chip is little-endian, but GETBYTE byte-swaps words because the
decoder is based on 16-bit "words" so *this* logic is big-endian. */
static int
immediate (int bytes, int sign_extend, LocalData *ld)
{
unsigned long i = 0;
switch (bytes)
{
case 1:
i |= B;
if (sign_extend && (i & 0x80))
i -= 0x100;
break;
case 2:
i |= B << 8;
i |= B;
if (sign_extend && (i & 0x8000))
i -= 0x10000;
break;
case 3:
i |= B << 16;
i |= B << 8;
i |= B;
if (sign_extend && (i & 0x800000))
i -= 0x1000000;
break;
case 4:
i |= B << 24;
i |= B << 16;
i |= B << 8;
i |= B;
if (sign_extend && (i & 0x80000000ULL))
i -= 0x100000000ULL;
break;
default:
fprintf (stderr,
"Programmer error: immediate() called with invalid byte count %d\n",
bytes);
abort ();
}
return i;
}
/*
PC SP SR CG
As
00 Rn - - R2 #0
01 X(Rn) Sym - X(abs) #1
10 (Rn) - - #4 #2
11 (Rn++) #imm - #8 #-1
Ad
0 Rn - - - -
1 X(Rn) Sym - X(abs) - */
static void
encode_ad (int reg, int ad, LocalData *ld, int ext)
{
MSP430_Opcode_Decoded *msp430 = ld->msp430;
if (ad)
{
int x = IMMU(2) | (ext << 16);
switch (reg)
{
case 0: /* (PC) -> Symbolic. */
DA (x + ld->pc + ld->op_ptr - 2);
break;
case 2: /* (SR) -> Absolute. */
DA (x);
break;
default:
DM (reg, x);
break;
}
}
else
{
DR (reg);
}
}
static void
encode_as (int reg, int as, LocalData *ld, int ext)
{
MSP430_Opcode_Decoded *msp430 = ld->msp430;
int x;
switch (as)
{
case 0:
switch (reg)
{
case 3:
SC (0);
break;
default:
SR (reg);
break;
}
break;
case 1:
switch (reg)
{
case 0: /* PC -> Symbolic. */
x = IMMU(2) | (ext << 16);
SA (x + ld->pc + ld->op_ptr - 2);
break;
case 2: /* SR -> Absolute. */
x = IMMU(2) | (ext << 16);
SA (x);
break;
case 3:
SC (1);
break;
default:
x = IMMU(2) | (ext << 16);
SM (reg, x);
break;
}
break;
case 2:
switch (reg)
{
case 2:
SC (4);
break;
case 3:
SC (2);
break;
case MSR_None:
SA (0);
default:
SM (reg, 0);
break;
}
break;
case 3:
switch (reg)
{
case 0:
{
/* This fetch *is* the *PC++ that the opcode encodes :-) */
x = IMMU(2) | (ext << 16);
SC (x);
}
break;
case 2:
SC (8);
break;
case 3:
SC (-1);
break;
default:
SI (reg);
break;
}
break;
}
}
static void
encode_rep_zc (int srxt, int dsxt, LocalData *ld)
{
MSP430_Opcode_Decoded *msp430 = ld->msp430;
msp430->repeat_reg = srxt & 1;
msp430->repeats = dsxt;
msp430->zc = (srxt & 2) ? 1 : 0;
}
#define REPZC(s,d) encode_rep_zc (s, d, ld)
static int
dopc_to_id (int dopc)
{
switch (dopc)
{
case 4: return MSO_mov;
case 5: return MSO_add;
case 6: return MSO_addc;
case 7: return MSO_subc;
case 8: return MSO_sub;
case 9: return MSO_cmp;
case 10: return MSO_dadd;
case 11: return MSO_bit;
case 12: return MSO_bic;
case 13: return MSO_bis;
case 14: return MSO_xor;
case 15: return MSO_and;
default: return MSO_unknown;
}
}
static int
sopc_to_id (int sop, int c)
{
switch (sop * 2 + c)
{
case 0: return MSO_rrc;
case 1: return MSO_swpb;
case 2: return MSO_rra;
case 3: return MSO_sxt;
case 4: return MSO_push;
case 5: return MSO_call;
case 6: return MSO_reti;
default: return MSO_unknown;
}
}
int
msp430_decode_opcode (unsigned long pc,
MSP430_Opcode_Decoded *msp430,
int (*getbyte)(void *),
void *ptr)
{
LocalData lds, *ld = &lds;
unsigned char op_buf[20] = {0};
unsigned char *op = op_buf;
int raddr;
int al_bit;
int srxt_bits, dsxt_bits;
lds.msp430 = msp430;
lds.getbyte = getbyte;
lds.ptr = ptr;
lds.op = op;
lds.op_ptr = 0;
lds.pc = pc;
memset (msp430, 0, sizeof (*msp430));
/* These are overridden by an extension word. */
al_bit = 1;
srxt_bits = 0;
dsxt_bits = 0;
post_extension_word:
;
/* 430X extention word. */
GETBYTE ();
switch (op[0] & 0xff)
{
case 0x00:
GETBYTE ();
switch (op[1] & 0xf0)
{
case 0x00:
op_semantics_1:
{
/** 0000 srcr 0000 dstr MOVA @%1, %0 */
#line 438 "msp430-decode.opc"
int srcr AU = op[0] & 0x0f;
#line 438 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 srcr 0000 dstr MOVA @%1, %0 */",
op[0], op[1]);
printf (" srcr = 0x%x,", srcr);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("MOVA @%1, %0");
#line 438 "msp430-decode.opc"
ID (MSO_mov); SM (srcr, 0); DR (dstr);
msp430->size = 20;
msp430->ofs_430x = 1;
}
break;
case 0x10:
op_semantics_2:
{
/** 0000 srcr 0001 dstr MOVA @%1+, %0 */
#line 443 "msp430-decode.opc"
int srcr AU = op[0] & 0x0f;
#line 443 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 srcr 0001 dstr MOVA @%1+, %0 */",
op[0], op[1]);
printf (" srcr = 0x%x,", srcr);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("MOVA @%1+, %0");
#line 443 "msp430-decode.opc"
ID (MSO_mov); SI (srcr); DR (dstr);
msp430->size = 20;
msp430->ofs_430x = 1;
}
break;
case 0x20:
op_semantics_3:
{
/** 0000 srcr 0010 dstr MOVA &%1, %0 */
#line 448 "msp430-decode.opc"
int srcr AU = op[0] & 0x0f;
#line 448 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 srcr 0010 dstr MOVA &%1, %0 */",
op[0], op[1]);
printf (" srcr = 0x%x,", srcr);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("MOVA &%1, %0");
#line 448 "msp430-decode.opc"
ID (MSO_mov); SA ((srcr << 16) + IMMU(2)); DR (dstr);
msp430->size = 20;
msp430->ofs_430x = 1;
}
break;
case 0x30:
op_semantics_4:
{
/** 0000 srcr 0011 dstr MOVA %1, %0 */
#line 453 "msp430-decode.opc"
int srcr AU = op[0] & 0x0f;
#line 453 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 srcr 0011 dstr MOVA %1, %0 */",
op[0], op[1]);
printf (" srcr = 0x%x,", srcr);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("MOVA %1, %0");
#line 453 "msp430-decode.opc"
ID (MSO_mov); SM (srcr, IMMS(2)); DR (dstr);
msp430->size = 20;
msp430->ofs_430x = 1;
}
break;
case 0x40:
case 0x50:
op_semantics_5:
{
/** 0000 bt00 010w dstr RRCM.A %c, %0 */
#line 520 "msp430-decode.opc"
int bt AU = (op[0] >> 2) & 0x03;
#line 520 "msp430-decode.opc"
int w AU = (op[1] >> 4) & 0x01;
#line 520 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 bt00 010w dstr RRCM.A %c, %0 */",
op[0], op[1]);
printf (" bt = 0x%x,", bt);
printf (" w = 0x%x,", w);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("RRCM.A %c, %0");
#line 520 "msp430-decode.opc"
ID (MSO_rrc); DR (dstr); SR (dstr);
msp430->repeats = bt;
msp430->size = w ? 16 : 20;
msp430->ofs_430x = 1;
F_0NZC;
}
break;
case 0x60:
op_semantics_6:
{
/** 0000 srcr 0110 dstr MOVA %1, &%0 */
#line 458 "msp430-decode.opc"
int srcr AU = op[0] & 0x0f;
#line 458 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 srcr 0110 dstr MOVA %1, &%0 */",
op[0], op[1]);
printf (" srcr = 0x%x,", srcr);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("MOVA %1, &%0");
#line 458 "msp430-decode.opc"
ID (MSO_mov); SR (srcr); DA ((dstr << 16) + IMMU(2));
msp430->size = 20;
msp430->ofs_430x = 1;
}
break;
case 0x70:
op_semantics_7:
{
/** 0000 srcr 0111 dstr MOVA %1, &%0 */
#line 463 "msp430-decode.opc"
int srcr AU = op[0] & 0x0f;
#line 463 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 srcr 0111 dstr MOVA %1, &%0 */",
op[0], op[1]);
printf (" srcr = 0x%x,", srcr);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("MOVA %1, &%0");
#line 463 "msp430-decode.opc"
ID (MSO_mov); SR (srcr); DM (dstr, IMMS(2));
msp430->size = 20;
msp430->ofs_430x = 1;
}
break;
case 0x80:
op_semantics_8:
{
/** 0000 srcr 1000 dstr MOVA %1, %0 */
#line 468 "msp430-decode.opc"
int srcr AU = op[0] & 0x0f;
#line 468 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 srcr 1000 dstr MOVA %1, %0 */",
op[0], op[1]);
printf (" srcr = 0x%x,", srcr);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("MOVA %1, %0");
#line 468 "msp430-decode.opc"
ID (MSO_mov); SC ((srcr << 16) + IMMU(2)); DR (dstr);
msp430->size = 20;
msp430->ofs_430x = 1;
}
break;
case 0x90:
op_semantics_9:
{
/** 0000 srcr 1001 dstr CMPA %1, %0 */
#line 473 "msp430-decode.opc"
int srcr AU = op[0] & 0x0f;
#line 473 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 srcr 1001 dstr CMPA %1, %0 */",
op[0], op[1]);
printf (" srcr = 0x%x,", srcr);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("CMPA %1, %0");
#line 473 "msp430-decode.opc"
ID (MSO_cmp); SC ((srcr << 16) + IMMU(2)); DR (dstr);
msp430->size = 20;
msp430->ofs_430x = 1;
F_VNZC;
}
break;
case 0xa0:
op_semantics_10:
{
/** 0000 srcr 1010 dstr ADDA %1, %0 */
#line 479 "msp430-decode.opc"
int srcr AU = op[0] & 0x0f;
#line 479 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 srcr 1010 dstr ADDA %1, %0 */",
op[0], op[1]);
printf (" srcr = 0x%x,", srcr);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("ADDA %1, %0");
#line 479 "msp430-decode.opc"
ID (MSO_add); SC ((srcr << 16) + IMMU(2)); DR (dstr);
msp430->size = 20;
msp430->ofs_430x = 1;
F_VNZC;
}
break;
case 0xb0:
op_semantics_11:
{
/** 0000 srcr 1011 dstr SUBA %1, %0 */
#line 485 "msp430-decode.opc"
int srcr AU = op[0] & 0x0f;
#line 485 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 srcr 1011 dstr SUBA %1, %0 */",
op[0], op[1]);
printf (" srcr = 0x%x,", srcr);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("SUBA %1, %0");
#line 485 "msp430-decode.opc"
ID (MSO_sub); SC ((srcr << 16) + IMMU(2)); DR (dstr);
msp430->size = 20;
msp430->ofs_430x = 1;
F_VNZC;
}
break;
case 0xc0:
op_semantics_12:
{
/** 0000 srcr 1100 dstr MOVA %1, %0 */
#line 497 "msp430-decode.opc"
int srcr AU = op[0] & 0x0f;
#line 497 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 srcr 1100 dstr MOVA %1, %0 */",
op[0], op[1]);
printf (" srcr = 0x%x,", srcr);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("MOVA %1, %0");
#line 497 "msp430-decode.opc"
ID (MSO_mov); SR (srcr); DR (dstr);
msp430->size = 20;
msp430->ofs_430x = 1;
}
break;
case 0xd0:
op_semantics_13:
{
/** 0000 srcr 1101 dstr CMPA %1, %0 */
#line 502 "msp430-decode.opc"
int srcr AU = op[0] & 0x0f;
#line 502 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 srcr 1101 dstr CMPA %1, %0 */",
op[0], op[1]);
printf (" srcr = 0x%x,", srcr);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("CMPA %1, %0");
#line 502 "msp430-decode.opc"
ID (MSO_cmp); SR (srcr); DR (dstr);
msp430->size = 20;
msp430->ofs_430x = 1;
F_VNZC;
}
break;
case 0xe0:
op_semantics_14:
{
/** 0000 srcr 1110 dstr ADDA %1, %0 */
#line 508 "msp430-decode.opc"
int srcr AU = op[0] & 0x0f;
#line 508 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 srcr 1110 dstr ADDA %1, %0 */",
op[0], op[1]);
printf (" srcr = 0x%x,", srcr);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("ADDA %1, %0");
#line 508 "msp430-decode.opc"
ID (MSO_add); SR (srcr); DR (dstr);
msp430->size = 20;
msp430->ofs_430x = 1;
F_VNZC;
}
break;
case 0xf0:
op_semantics_15:
{
/** 0000 srcr 1111 dstr SUBA %1, %0 */
#line 514 "msp430-decode.opc"
int srcr AU = op[0] & 0x0f;
#line 514 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 srcr 1111 dstr SUBA %1, %0 */",
op[0], op[1]);
printf (" srcr = 0x%x,", srcr);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("SUBA %1, %0");
#line 514 "msp430-decode.opc"
ID (MSO_sub); SR (srcr); DR (dstr);
msp430->size = 20;
msp430->ofs_430x = 1;
F_VNZC;
}
break;
}
break;
case 0x01:
GETBYTE ();
switch (op[1] & 0xf0)
{
case 0x00:
goto op_semantics_1;
break;
case 0x10:
goto op_semantics_2;
break;
case 0x20:
goto op_semantics_3;
break;
case 0x30:
goto op_semantics_4;
break;
case 0x40:
case 0x50:
op_semantics_16:
{
/** 0000 bt01 010w dstr RRAM.A %c, %0 */
#line 527 "msp430-decode.opc"
int bt AU = (op[0] >> 2) & 0x03;
#line 527 "msp430-decode.opc"
int w AU = (op[1] >> 4) & 0x01;
#line 527 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 bt01 010w dstr RRAM.A %c, %0 */",
op[0], op[1]);
printf (" bt = 0x%x,", bt);
printf (" w = 0x%x,", w);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("RRAM.A %c, %0");
#line 527 "msp430-decode.opc"
ID (MSO_rra); DR (dstr); SR (dstr);
msp430->repeats = bt;
msp430->size = w ? 16 : 20;
msp430->ofs_430x = 1;
F_0NZC;
}
break;
case 0x60:
goto op_semantics_6;
break;
case 0x70:
goto op_semantics_7;
break;
case 0x80:
goto op_semantics_8;
break;
case 0x90:
goto op_semantics_9;
break;
case 0xa0:
goto op_semantics_10;
break;
case 0xb0:
goto op_semantics_11;
break;
case 0xc0:
goto op_semantics_12;
break;
case 0xd0:
goto op_semantics_13;
break;
case 0xe0:
goto op_semantics_14;
break;
case 0xf0:
goto op_semantics_15;
break;
}
break;
case 0x02:
GETBYTE ();
switch (op[1] & 0xf0)
{
case 0x00:
goto op_semantics_1;
break;
case 0x10:
goto op_semantics_2;
break;
case 0x20:
goto op_semantics_3;
break;
case 0x30:
goto op_semantics_4;
break;
case 0x40:
case 0x50:
op_semantics_17:
{
/** 0000 bt10 010w dstr RLAM.A %c, %0 */
#line 534 "msp430-decode.opc"
int bt AU = (op[0] >> 2) & 0x03;
#line 534 "msp430-decode.opc"
int w AU = (op[1] >> 4) & 0x01;
#line 534 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 bt10 010w dstr RLAM.A %c, %0 */",
op[0], op[1]);
printf (" bt = 0x%x,", bt);
printf (" w = 0x%x,", w);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("RLAM.A %c, %0");
#line 534 "msp430-decode.opc"
ID (MSO_add); DR (dstr); SR (dstr);
msp430->repeats = bt;
msp430->size = w ? 16 : 20;
msp430->ofs_430x = 1;
F_0NZC;
}
break;
case 0x60:
goto op_semantics_6;
break;
case 0x70:
goto op_semantics_7;
break;
case 0x80:
goto op_semantics_8;
break;
case 0x90:
goto op_semantics_9;
break;
case 0xa0:
goto op_semantics_10;
break;
case 0xb0:
goto op_semantics_11;
break;
case 0xc0:
goto op_semantics_12;
break;
case 0xd0:
goto op_semantics_13;
break;
case 0xe0:
goto op_semantics_14;
break;
case 0xf0:
goto op_semantics_15;
break;
}
break;
case 0x03:
GETBYTE ();
switch (op[1] & 0xf0)
{
case 0x00:
goto op_semantics_1;
break;
case 0x10:
goto op_semantics_2;
break;
case 0x20:
goto op_semantics_3;
break;
case 0x30:
goto op_semantics_4;
break;
case 0x40:
case 0x50:
op_semantics_18:
{
/** 0000 bt11 010w dstr RRUM.A %c, %0 */
#line 541 "msp430-decode.opc"
int bt AU = (op[0] >> 2) & 0x03;
#line 541 "msp430-decode.opc"
int w AU = (op[1] >> 4) & 0x01;
#line 541 "msp430-decode.opc"
int dstr AU = op[1] & 0x0f;
if (trace)
{
printf ("\033[33m%s\033[0m %02x %02x\n",
"/** 0000 bt11 010w dstr RRUM.A %c, %0 */",
op[0], op[1]);
printf (" bt = 0x%x,", bt);
printf (" w = 0x%x,", w);
printf (" dstr = 0x%x\n", dstr);
}
SYNTAX("RRUM.A %c, %0");
#line 541 "msp430-decode.opc"
ID (MSO_rru); DR (dstr); SR (dstr);
msp430->repeats = bt;
msp430->size = w ? 16 : 20;
msp430->ofs_430x = 1;
F_0NZC;
}
break;
case 0x60:
goto op_semantics_6;
break;
case 0x70:
goto op_semantics_7;
break;
case 0x80:
goto op_semantics_8;
break;
case 0x90:
goto op_semantics_9;
break;
case 0xa0:
goto op_semantics_10;
break;
case 0xb0:
goto op_semantics_11;
break;
case 0xc0:
goto op_semantics_12;
break;
case 0xd0:
goto op_semantics_13;
break;
case 0xe0:
goto op_semantics_14;
break;
case 0xf0:
goto op_semantics_15;
break;
}
break;
case 0x04:
GETBYTE ();
switch (op[1] & 0xf0)
{
case 0x00:
goto op_semantics_1;
break;
case 0x10:
goto op_semantics_2;
break;
case 0x20:
goto op_semantics_3;
break;
case 0x30:
goto op_semantics_4;
break;
case 0x40:
case 0x50:
goto op_semantics_5;
break;
case 0x60:
goto op_semantics_6;
break;
case 0x70:
goto op_semantics_7;
break;
case 0x80:
goto op_semantics_8;
break;
case 0x90:
goto op_semantics_9;
break;
case 0xa0:
goto op_semantics_10;
break;
case 0xb0: