-
Notifications
You must be signed in to change notification settings - Fork 30
/
f9dasm.c
5669 lines (5320 loc) · 217 KB
/
f9dasm.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
/***************************************************************************
* f9dasm -- Portable M6800..6809/H6309 Binary/OS9/FLEX disassembler *
* HEAVILY modified by H.Seib to adapt it to his needs. *
* *
* Line Disassembler Engine Copyright (C) 2000 Arto Salmi *
* Various additions Copyright (c) 2001-2020 Hermann Seib *
* Various additions Copyright (c) 2013 by Colin Bourassa *
* Various additions Copyright (c) 2014 by Rainer Buchty *
* *
* This program 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 2 of the License, or *
* (at your option) any later version. *
* *
* This program 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., 675 Mass Ave, Cambridge, MA 02139, USA. *
***************************************************************************/
/*
* There's a variant "1.61-RB" available at
* https://github.com/gordonjcp/f9dasm
* (based on my V1.60) which contains some interesting changes by Rainer Buchty.
* Unfortunately, I only saw that by chance in summer 2015, 6 versions later.
* Rainer customized it to his own taste, so I didn't directly add his changes
* to my code, which defaults to TSC Assembler compatible output;
* you can, however, create a "Rainer Buchty compatible variant" by either
* 1) setting the -DRB_VARIANT compiler flag or
* 2) setting the following definition to anything other than 0.
*/
#ifndef RB_VARIANT
#define RB_VARIANT 0
#endif
/* History, as far as I could retrace it:
v0.1 2000-02-06 Arto Salmi's original dasm09 6809/6309
V1.01 2001-??-?? Start of my changes; dates and changes for this and the
next 54 versions are lost in the mists of time ...
it grew in parallel to my reverse-engineering of the
PPG Wave synthesizers, the PPG PRK Keyboard and the
PPG Waveterm A operating system
V1.56 2006-02-05 First appearance in my versioning system
(can't believe I lived without one for over 20 years!)
V1.57 2008-11-18 Added "FILE filename [offset]" directive
V1.58 2009-02-07 6800 mode added
V1.59 2009-02-23 Made gcc-compatible (so yes, it DOES work on Linux)
Command line option -help added to get normal plus
info file usage
V1.60 2009-03-13 Duplicate Flex labels changed
Error in PCR handling corrected
V1.61 2010-05-05 Cured a little bug in binary file loading
(detected by J. Sigle)
V1.62 2010-05-06 Little bug in 6800 indexed addressing cured
Documentation expanded
V1.63 2013-06-11 Added Colin Bourassa's 6801/6803 support
V1.64 2013-06-12 nofcc option added
Added fcc option
Added proper [no]asm and [no]fcc documentation
V1.65 2013-06-13 Added omitzero / showzero options
V1.66 2015-06-18 Added VS2008 project files, corrected VS6 mot2bin project
mot2bin still displayed hex2bin messages (it only took about
10 years until I noticed that...)
Added -6802/-6803/-6808/-6809 command line options
Added changes from Rainer Buchty's version at
https://github.com/gordonjcp/f9dasm
Added -[no]forced command line option
Added -ldchar command line option
Updated documentation
V1.67 2015-06-19 Made setdp address-aware
Correctly default to DP 0 on 6809 / 6309
Added enumeration for info-file keywords to make code
more readable
V1.68 2015-06-22 setdp addr dp now sets dp for all addresses starting
at addr up to the end of input
Updated documentation
V1.69 2015-07-02 (RB) CPU-dependent system vector parsing
automatically inserts
* system vectors as word-data labels
* entry points as code labels
V1.70 2015-07-03 phase addr[-addr] phase command added
V1.71 2015-07-03 (RB) CVEC/DVEC directives and noLabelLoad option added
* CVEC/DVEC declare code/data vector fields
if not declared already, they will be auto-inserted into label list
* noLabelLoad option suppresses adding of load-address label
V1.72 2015-07-08 Intel and Motorola Hex file parsing improved
V1.73 2015-07-09 (RB) 6301 option added
* like 6801/03 but with some 6809-specific commands (AIM/EIM/OIM/TIM) and addressing modes (BE/BI)
* additional opcodes SLP and XGDX
V1.74 2015-07-09 phase addr[-addr] {+|-}rel command added
V1.75 2015-07-26 Only install system vector labels if they aren't defined in an info file
INSERT, COMMENT, PREPCOMM without address range can be used to prepend text to the output, too
PREPEND without address now works like normal PREPEND - it adds BEFORE the first line
V1.76 2015-08-12 USED[LABEL] is treated like LABEL now - i.e., a label name can be passed, too
V1.77 2017-09-30 forward references to near addresses are prefixed with a direct addressing marker
V1.78 2019-06-03 PC-relative indirect addressing (like "LDA [XXXX,PCR]") was not correctly disassembled
thanks to GitHub user "ep00ch" for pointing that out!
V1.79 2020-08-10 switch to ';' as the default comment delimiter, as it's more universal than '*'
Rainer Buchty knew it all along :-)
And, as Ray Bellis reported, there were some overlapping strcpy() calls in the code
which clang misinterpreted badly. See
https://github.com/Arakula/f9dasm/issues/13
for details.
V1.80 2020-10-20 RMB value was output as binary; thanks to GitHub user "ep00ch" for pointing that out!
See
https://github.com/Arakula/f9dasm/issues/16
for details.
V1.81 2022-10-07 option begin and option end didn't work correctly.
V1.82 2022-10-08 file directive without base address didn't work correctly.
begin and end options also should work better.
Thanks to Github user "Twilight-Logic" for reporting the issue.
See
https://github.com/Arakula/f9dasm/issues/22
for details on V1.81 and V1.82.
V1.83 2023-07-04 operations like LDA [-1,X] could lead to code that would
be assembled to a different instruction.
Thanks to Github user "mjwurtz" for reporting the issue.
See
https://github.com/Arakula/f9dasm/issues/24
for details.
*/
#define ID "1.83"
#if RB_VARIANT
#define VERSION ID "-RB"
#else
#define VERSION ID
#endif
/* NOTE! os9 call table is not tested. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#define MEMORY(address) (memory[(address)&0xffff])
#define OPCODE(address) MEMORY(address)
#define ARGBYTE(address) MEMORY(address)
#define ARGWORD(address) (word)((MEMORY(address)<<8)|MEMORY((address)+1))
#define ATTRBYTE(address) (label[(address) & 0xffff])
#define DATATYPE_BYTE 0x0000
#define DATATYPE_WORD 0x0008
#define DATATYPE_DEC 0x0000
#define DATATYPE_BINARY 0x0010
#define DATATYPE_HEX 0x0020
#define DATATYPE_CHAR (DATATYPE_BINARY | DATATYPE_HEX)
/* RB: new vector datatypes */
#define DATATYPE_DVEC 0x0100
#define DATATYPE_CVEC 0x0200
#define DATATYPE_RMB 0x0400
#define AREATYPE_CLABEL 0x0001
#define AREATYPE_LABEL 0x0002
#define AREATYPE_ULABEL 0x0004
#define AREATYPE_DATA 0x0040
#define AREATYPE_CODE 0x0080
#define AREATYPE_WORD (AREATYPE_DATA | DATATYPE_WORD)
#define AREATYPE_RMB (AREATYPE_DATA | DATATYPE_RMB)
#define AREATYPE_BINARY (AREATYPE_DATA | DATATYPE_BINARY)
#define AREATYPE_DEC (AREATYPE_DATA | DATATYPE_DEC)
#define AREATYPE_HEX (AREATYPE_DATA | DATATYPE_HEX)
#define AREATYPE_CHAR (AREATYPE_DATA | DATATYPE_CHAR)
#define AREATYPE_CONST (AREATYPE_CODE | AREATYPE_DATA)
/* RB: new vector areatypes */
#define AREATYPE_DVEC (AREATYPE_WORD | DATATYPE_DVEC)
#define AREATYPE_CVEC (AREATYPE_WORD | DATATYPE_CVEC)
#define IS_CODE(address) ((ATTRBYTE(address)&AREATYPE_CONST)==AREATYPE_CODE)
#define IS_DATA(address) ((ATTRBYTE(address)&AREATYPE_CONST)==AREATYPE_DATA)
#define IS_CONST(address) ((ATTRBYTE(address)&AREATYPE_CONST)==AREATYPE_CONST)
#define SET_USED(address) used[(address) / 8] |= (1 << ((address) % 8))
#define SET_UNUSED(address) used[(address) / 8] &= ~(1 << ((address) % 8))
#define IS_USED(address) (!!(used[(address) / 8] & (1 << ((address) % 8))))
#define IS_LABEL(address) (!!(ATTRBYTE(address) & AREATYPE_LABEL))
#define IS_CLABEL(address) ((ATTRBYTE(address) & (AREATYPE_CLABEL | AREATYPE_LABEL)) == (AREATYPE_CLABEL | AREATYPE_LABEL))
#define IS_DLABEL(address) ((ATTRBYTE(address) & (AREATYPE_CLABEL | AREATYPE_LABEL)) == AREATYPE_LABEL)
#define IS_ULABEL(address) ((ATTRBYTE(address) & (AREATYPE_ULABEL | AREATYPE_LABEL)) == (AREATYPE_ULABEL | AREATYPE_LABEL))
#define IS_BREAK(address) ((ATTRBYTE(address) & (AREATYPE_ULABEL | AREATYPE_LABEL)) == AREATYPE_ULABEL)
#define IS_WORD(address) (!!(ATTRBYTE(address) & DATATYPE_WORD))
#define IS_BINARY(address) (!!(ATTRBYTE(address) & DATATYPE_BINARY))
#define IS_HEX(address) (!!(ATTRBYTE(address) & DATATYPE_HEX))
#define IS_CHAR(address) (!IS_WORD(address) && IS_HEX(address) && IS_BINARY(address))
#define IS_RMB(address) ((ATTRBYTE(address) & DATATYPE_RMB) == DATATYPE_RMB)
/* RB: new vector checks */
#define IS_VEC(address) (ATTRBYTE(address) & (DATATYPE_DVEC | DATATYPE_CVEC))
#define IS_DVEC(address) (ATTRBYTE(address) & DATATYPE_DVEC)
#define IS_CVEC(address) (ATTRBYTE(address) & DATATYPE_CVEC)
#ifndef TYPES
#define TYPES
typedef unsigned char byte;
typedef unsigned short word;
#endif
#ifndef NULL
#define NULL 0
#endif
#ifndef FALSE
#define TRUE (1==1)
#define FALSE (!TRUE)
#endif
#ifdef _MSC_VER
#define FNCASESENS 0
#else
#define FNCASESENS 1
#endif
#define MAXPHASES 16384 /* should be overkill, but who knows */
typedef struct _phasedef /* data for a phase */
{
unsigned short from;
unsigned short to;
unsigned short phase;
unsigned short rel;
} phasedef;
typedef unsigned short labeltype;
/*****************************************************************************/
/* Global Data */
/*****************************************************************************/
byte *memory = NULL;
labeltype *label = NULL; /* RB: space for more flags */
byte *used = NULL;
char **lblnames = NULL;
char **commentlines = NULL;
char **lcomments = NULL;
unsigned short *rels = NULL;
short *dps = NULL;
phasedef *phases = NULL;
int numphases = 0;
int *remaps = NULL;
int dirpage = 0; /* direct page used (default 0) */
char * szPrepend = NULL; /* text to be printed before all */
int showhex = TRUE;
int showaddr = TRUE;
char cCommChar = ';'; /* comment delimiter character */
#if RB_VARIANT
int showasc = FALSE;
int useFlex = FALSE;
int useConvenience = FALSE;
char *forcedirectaddr = "";
char *forceextendedaddr = "";
char cLblDelim = ':';
#else
int showasc = TRUE;
int useFlex = TRUE;
int useConvenience = TRUE;
char *forcedirectaddr = "<";
char *forceextendedaddr = ">";
char cLblDelim = ' ';
#endif
int emitComments = TRUE;
byte defaultDataType = DATATYPE_HEX;
int usefcc = TRUE;
int showIndexedModeZeroOperand = FALSE;
char *fname = NULL, *outname = NULL, *infoname = NULL;
unsigned begin = 0x10000, end = 0x10000, offset = 0, lastload = (unsigned)-1;
int load = -1;
static char *loaded[200] = {0};
char *sLoadType = "";
/* RB: get a divider after BRA/JMP/SWIx/RTS/RTI/PULx PC */
int optdelimbar = FALSE;
/* RB: vector address */
int vaddr;
/* RB: option -- suppress auto-insertion of load-address label */
int noLoadLabel = FALSE;
/* RB: system vectors */
char *vec_6801[] = {"IRQ_SCI","IRQ_T0F","IRQ_OCF","IRQ_ICF","IRQ_EXT","SWI","NMI","RST"};
char *vec_6809[] = {"DIV0","SWI3","SWI2","FIRQ","IRQ","SWI","NMI","RST"};
enum /* available options */
{
OPTION_BEGIN,
OPTION_END,
OPTION_OFFSET,
OPTION_OUT,
OPTION_ADDR,
OPTION_NOADDR,
OPTION_HEX,
OPTION_NOHEX,
OPTION_6309,
OPTION_OS9,
OPTION_INFO,
OPTION_CCHAR,
OPTION_ASC,
OPTION_NOASC,
OPTION_FLEX,
OPTION_NOFLEX,
OPTION_CONV,
OPTION_NOCONV,
OPTION_DEC,
OPTION_NODEC,
OPTION_COMMENT,
OPTION_NOCOMMENT,
OPTION_6800,
OPTION_HELP,
OPTION_6801,
OPTION_FCC,
OPTION_NOFCC,
OPTION_OMITZERO,
OPTION_SHOWZERO,
OPTION_FORCED,
OPTION_NOFORCED,
OPTION_6809,
OPTION_LDCHAR,
OPTION_NOLOADLABEL,
OPTION_6301,
};
static struct
{
char *name;
int value;
} Options[] =
{
{ "begin", OPTION_BEGIN },
{ "end", OPTION_END },
{ "offset", OPTION_OFFSET },
{ "out", OPTION_OUT },
{ "addr", OPTION_ADDR },
{ "noaddr", OPTION_NOADDR },
{ "hex", OPTION_HEX },
{ "nohex", OPTION_NOHEX },
{ "x", OPTION_6309 },
{ "os9", OPTION_OS9 },
{ "info", OPTION_INFO },
{ "cchar", OPTION_CCHAR },
{ "asc", OPTION_ASC },
{ "noasc", OPTION_NOASC },
{ "flex", OPTION_FLEX },
{ "noflex", OPTION_NOFLEX },
{ "conv", OPTION_CONV },
{ "noconv", OPTION_NOCONV },
{ "dec", OPTION_DEC },
{ "nodec", OPTION_NODEC },
{ "comment", OPTION_COMMENT },
{ "nocomment", OPTION_NOCOMMENT },
{ "6301", OPTION_6301 },
{ "6303", OPTION_6301 },
{ "6309", OPTION_6309 },
{ "6800", OPTION_6800 },
{ "6801", OPTION_6801 },
{ "6802", OPTION_6800 },
{ "6803", OPTION_6801 },
{ "6808", OPTION_6800 },
{ "6809", OPTION_6809 },
{ "help", OPTION_HELP },
{ "fcc", OPTION_FCC },
{ "nofcc", OPTION_NOFCC },
{ "omitzero", OPTION_OMITZERO },
{ "showzero", OPTION_SHOWZERO },
{ "forced", OPTION_FORCED },
{ "noforced", OPTION_NOFORCED },
{ "ldchar", OPTION_LDCHAR },
{ "noll", OPTION_NOLOADLABEL },
{ NULL, 0 }
};
enum addr_mode
{
_nom, /* no mode */
_imp, /* inherent/implied */
_imb, /* immediate byte */
_imw, /* immediate word */
_dir, /* direct */
_ext, /* extended */
_ix8, /* indexed for 6800 (unsigned)*/
_ind, /* indexed */
_reb, /* relative byte */
_rew, /* relative word */
_r1 , /* tfr/exg mode */
_r2 , /* pul/psh system */
_r3 , /* pul/psh user */
_bd , /* Bit Manipulation direct */
_bi , /* Bit Manipulation index */
_be , /* Bit Manipulation extended */
_bt , /* Bit Transfers direct */
_t1 , /* Block Transfer r0+,r1+ */
_t2 , /* Block Transfer r0-,r1- */
_t3 , /* Block Transfer r0+,r1 */
_t4 , /* Block Transfer r0,r1+ */
_iml, /* immediate 32-bit */
};
enum opcodes
{
_ill=0,
_aba, _abx, _adca, _adcb, _adda, _addb, _addd, _anda, _andb,
_andcc,_asla, _aslb, _asl, _asra, _asrb, _asr, _bcc, _lbcc,
_bcs, _lbcs, _beq, _lbeq, _bge, _lbge, _bgt, _lbgt, _bhi,
_lbhi, _bita, _bitb, _ble, _lble, _bls, _lbls, _blt, _lblt,
_bmi, _lbmi, _bne, _lbne, _bpl, _lbpl, _bra, _lbra, _brn,
_lbrn, _bsr, _lbsr, _bvc, _lbvc, _bvs, _lbvs,
_cba, _cli, _clra, _clrb, _clr, _clc, _clv,
_cmpa, _cmpb, _cmpd, _cmps, _cmpu, _cmpx, _cmpy, _coma,
_comb, _com, _cwai, _daa, _deca, _decb, _dec, _des, _dex,
_eora, _eorb,
_exg, _inca, _incb, _inc, _ins, _inx,
_jmp, _jsr, _lda, _ldb, _ldd,
_lds, _ldu, _ldx, _ldy, _leas, _leau, _leax, _leay, _lsra,
_lsrb, _lsr, _mul, _nega, _negb, _neg, _nop, _ora, _orb,
_orcc, _psha, _pshb, _pshs, _pshu,
_pula, _pulb, _puls, _pulu, _rola, _rolb, _rol, _rora,
_rorb, _ror, _rti, _rts, _sba, _sbca, _sbcb,
_sec, _sei, _sev, _sex, _sez, _sta,
_stb, _std, _sts, _stu, _stx, _sty, _suba, _subb, _subd,
_swi, _swi2, _swi3, _sync, _tab, _tap, _tba,
_tfr, _tpa, _tsta, _tstb,
_tst, _tsx, _txs,
_wai, _reset,
/* 6800 extra opcodes */
_cpx,
/* 6801/6803 extra opcodes */
_pulx, _pshx,
/* 6301/03 extra opcodes */
_slp, _xgdx,
/* 630x extra opcodes */
_aim, _eim, _oim, _tim,
/* 6309 extra opcodes */
_band, _biand,_bor, _bior, _beor,
_bieor,_ldbt, _stbt, _tfm, _adcd, _adcr, _adde, _addf, _addw,
_addr, _andd, _andr, _asld, _asrd, _bitd, _bitmd,_clrd, _clre,
_clrf, _clrw, _cmpe, _cmpf, _cmpw, _cmpr, _comd, _come, _comf,
_comw, _decd, _dece, _decf, _decw, _divd, _divq, _eord, _eorr,
_incd, _ince, _incf, _incw, _lde, _ldf, _ldq, _ldw, _ldmd,
_lsrd, _lsrw, _muld, _negd, _ord, _orr, _pshsw,_pshuw,_pulsw,
_puluw,_rold, _rolw, _rord, _rorw, _sbcd, _sbcr, _sexw, _ste,
_stf, _stq, _stw, _sube, _subf, _subw, _subr, _tstd, _tste,
_tstf, _tstw,
};
struct
{
char *mne;
byte bCodeJump;
} mnemo[] =
{
{ "???", 0 }, /* _ill */
{ "ABA", 0 }, /* _aba */
{ "ABX", 0 }, /* _abx */
{ "ADCA", 0 }, /* _adca */
{ "ADCB", 0 }, /* _adcb */
{ "ADDA", 0 }, /* _adda */
{ "ADDB", 0 }, /* _addb */
{ "ADDD", 0 }, /* _addd */
{ "ANDA", 0 }, /* _anda */
{ "ANDB", 0 }, /* _andb */
{ "ANDCC", 0 }, /* _andcc */
{ "ASLA", 0 }, /* _asla */
{ "ASLB", 0 }, /* _aslb */
{ "ASL", 0 }, /* _asl */
{ "ASRA", 0 }, /* _asra */
{ "ASRB", 0 }, /* _asrb */
{ "ASR", 0 }, /* _asr */
{ "BCC", 1 }, /* _bcc */
{ "LBCC", 1 }, /* _lbcc */
{ "BCS", 1 }, /* _bcs */
{ "LBCS", 1 }, /* _lbcs */
{ "BEQ", 1 }, /* _beq */
{ "LBEQ", 1 }, /* _lbeq */
{ "BGE", 1 }, /* _bge */
{ "LBGE", 1 }, /* _lbge */
{ "BGT", 1 }, /* _bgt */
{ "LBGT", 1 }, /* _lbgt */
{ "BHI", 1 }, /* _bhi */
{ "LBHI", 1 }, /* _lbhi */
{ "BITA", 0 }, /* _bita */
{ "BITB", 0 }, /* _bitb */
{ "BLE", 1 }, /* _ble */
{ "LBLE", 1 }, /* _lble */
{ "BLS", 1 }, /* _bls */
{ "LBLS", 1 }, /* _lbls */
{ "BLT", 1 }, /* _blt */
{ "LBLT", 1 }, /* _lblt */
{ "BMI", 1 }, /* _bmi */
{ "LBMI", 1 }, /* _lbmi */
{ "BNE", 1 }, /* _bne */
{ "LBNE", 1 }, /* _lbne */
{ "BPL", 1 }, /* _bpl */
{ "LBPL", 1 }, /* _lbpl */
{ "BRA", 1 }, /* _bra */
{ "LBRA", 1 }, /* _lbra */
{ "BRN", 1 }, /* _brn */
{ "LBRN", 1 }, /* _lbrn */
{ "BSR", 1 }, /* _bsr */
{ "LBSR", 1 }, /* _lbsr */
{ "BVC", 1 }, /* _bvc */
{ "LBVC", 1 }, /* _lbvc */
{ "BVS", 1 }, /* _bvs */
{ "LBVS", 1 }, /* _lbvs */
{ "CBA", 0 }, /* _cba */
{ "CLI", 0 }, /* _cli */
{ "CLRA", 0 }, /* _clra */
{ "CLRB", 0 }, /* _clrb */
{ "CLR", 0 }, /* _clr */
{ "CLC", 0 }, /* _clc */
{ "CLV", 0 }, /* _clv */
{ "CMPA", 0 }, /* _cmpa */
{ "CMPB", 0 }, /* _cmpb */
{ "CMPD", 0 }, /* _cmpd */
{ "CMPS", 0 }, /* _cmps */
{ "CMPU", 0 }, /* _cmpu */
{ "CMPX", 0 }, /* _cmpx */
{ "CMPY", 0 }, /* _cmpy */
{ "COMA", 0 }, /* _coma */
{ "COMB", 0 }, /* _comb */
{ "COM", 0 }, /* _com */
{ "CWAI", 0 }, /* _cwai */
{ "DAA", 0 }, /* _daa */
{ "DECA", 0 }, /* _deca */
{ "DECB", 0 }, /* _decb */
{ "DEC", 0 }, /* _dec */
{ "DES", 0 }, /* _des */
{ "DEX", 0 }, /* _dex */
{ "EORA", 0 }, /* _eora */
{ "EORB", 0 }, /* _eorb */
{ "EXG", 0 }, /* _exg */
{ "INCA", 0 }, /* _inca */
{ "INCB", 0 }, /* _incb */
{ "INC", 0 }, /* _inc */
{ "INS", 0 }, /* _ins */
{ "INX", 0 }, /* _inx */
{ "JMP", 1 }, /* _jmp */
{ "JSR", 1 }, /* _jsr */
{ "LDA", 0 }, /* _lda */
{ "LDB", 0 }, /* _ldb */
{ "LDD", 0 }, /* _ldd */
{ "LDS", 0 }, /* _lds */
{ "LDU", 0 }, /* _ldu */
{ "LDX", 0 }, /* _ldx */
{ "LDY", 0 }, /* _ldy */
{ "LEAS", 0 }, /* _leas */
{ "LEAU", 0 }, /* _leau */
{ "LEAX", 0 }, /* _leax */
{ "LEAY", 0 }, /* _leay */
{ "LSRA", 0 }, /* _lsra */
{ "LSRB", 0 }, /* _lsrb */
{ "LSR", 0 }, /* _lsr */
{ "MUL", 0 }, /* _mul */
{ "NEGA", 0 }, /* _nega */
{ "NEGB", 0 }, /* _negb */
{ "NEG", 0 }, /* _neg */
{ "NOP", 0 }, /* _nop */
{ "ORA", 0 }, /* _ora */
{ "ORB", 0 }, /* _orb */
{ "ORCC", 0 }, /* _orcc */
{ "PSHA", 0 }, /* _psha */
{ "PSHB", 0 }, /* _pshb */
{ "PSHS", 0 }, /* _pshs */
{ "PSHU", 0 }, /* _pshu */
{ "PULA", 0 }, /* _pula */
{ "PULB", 0 }, /* _pulb */
{ "PULS", 0 }, /* _puls */
{ "PULU", 0 }, /* _pulu */
{ "ROLA", 0 }, /* _rola */
{ "ROLB", 0 }, /* _rolb */
{ "ROL", 0 }, /* _rol */
{ "RORA", 0 }, /* _rora */
{ "RORB", 0 }, /* _rorb */
{ "ROR", 0 }, /* _ror */
{ "RTI", 0 }, /* _rti */
{ "RTS", 0 }, /* _rts */
{ "SBA", 0 }, /* _sba */
{ "SBCA", 0 }, /* _sbca */
{ "SBCB", 0 }, /* _sbcb */
{ "SEC", 0 }, /* _sec */
{ "SEI", 0 }, /* _sei */
{ "SEV", 0 }, /* _sev */
{ "SEX", 0 }, /* _sex */
{ "SEZ", 0 }, /* _sez */
{ "STA", 0 }, /* _sta */
{ "STB", 0 }, /* _stb */
{ "STD", 0 }, /* _std */
{ "STS", 0 }, /* _sts */
{ "STU", 0 }, /* _stu */
{ "STX", 0 }, /* _stx */
{ "STY", 0 }, /* _sty */
{ "SUBA", 0 }, /* _suba */
{ "SUBB", 0 }, /* _subb */
{ "SUBD", 0 }, /* _subd */
{ "SWI", 0 }, /* _swi */
{ "SWI2", 0 }, /* _swi2 */
{ "SWI3", 0 }, /* _swi3 */
{ "SYNC", 0 }, /* _sync */
{ "TAB", 0 }, /* _tab */
{ "TAP", 0 }, /* _tap */
{ "TBA", 0 }, /* _tba */
{ "TFR", 0 }, /* _tfr */
{ "TPA", 0 }, /* _tpa */
{ "TSTA", 0 }, /* _tsta */
{ "TSTB", 0 }, /* _tstb */
{ "TST", 0 }, /* _tst */
{ "TSX", 0 }, /* _tsx */
{ "TXS", 0 }, /* _txs */
{ "WAI", 0 }, /* _wai */
{ "RESET", 0 }, /* _reset */
/* 6800 EXTRA OPCODES */
{ "CPX", 0 }, /* _cpx */
/* 6801/6803 EXTRA OPCODES */
{ "PULX", 0 }, /* _pulx */
{ "PSHX", 0 }, /* _pshx */
/* 6301/03 EXTRA OPCODES */
{ "SLP", 0 }, /* _slp */
{ "XGDX", 0 }, /* _xgdx */
/* 630x EXTRA OPCODES */
{ "AIM", 0 }, /* _aim */
{ "EIM", 0 }, /* _eim */
{ "OIM", 0 }, /* _oim */
{ "TIM", 0 }, /* _tim */
/* 6309 EXTRA OPCODES */
{ "BAND", 0 }, /* _band */
{ "BIAND", 0 }, /* _biand */
{ "BOR", 0 }, /* _bor */
{ "BIOR", 0 }, /* _bior */
{ "BEOR", 0 }, /* _beor */
{ "BIEOR", 0 }, /* _bieor */
{ "LDBT", 0 }, /* _ldbt */
{ "STBT", 0 }, /* _stbt */
{ "TFM", 0 }, /* _tfm */
{ "ADCD", 0 }, /* _adcd */
{ "ADCR", 0 }, /* _adcr */
{ "ADDE", 0 }, /* _adde */
{ "ADDF", 0 }, /* _addf */
{ "ADDW", 0 }, /* _addw */
{ "ADDR", 0 }, /* _addr */
{ "ANDD", 0 }, /* _andd */
{ "ANDR", 0 }, /* _andr */
{ "ASLD", 0 }, /* _asld */
{ "ASRD", 0 }, /* _asrd */
{ "BITD", 0 }, /* _bitd */
{ "BITMD", 0 }, /* _bitmd */
{ "CLRD", 0 }, /* _clrd */
{ "CLRE", 0 }, /* _clre */
{ "CLRF", 0 }, /* _clrf */
{ "CLRW", 0 }, /* _clrw */
{ "CMPE", 0 }, /* _cmpe */
{ "CMPF", 0 }, /* _cmpf */
{ "CMPW", 0 }, /* _cmpw */
{ "CMPR", 0 }, /* _cmpr */
{ "COMD", 0 }, /* _comd */
{ "COME", 0 }, /* _come */
{ "COMF", 0 }, /* _comf */
{ "COMW", 0 }, /* _comw */
{ "DECD", 0 }, /* _dedc */
{ "DECE", 0 }, /* _dece */
{ "DECF", 0 }, /* _decf */
{ "DECW", 0 }, /* _decw */
{ "DIVD", 0 }, /* _divd */
{ "DIVQ", 0 }, /* _divq */
{ "EORD", 0 }, /* _eord */
{ "EORR", 0 }, /* _eorr */
{ "INCD", 0 }, /* _incd */
{ "INCE", 0 }, /* _ince */
{ "INCF", 0 }, /* _incf */
{ "INCW", 0 }, /* _incw */
{ "LDE", 0 }, /* _lde */
{ "LDF", 0 }, /* _ldf */
{ "LDQ", 0 }, /* _ldq */
{ "LDW", 0 }, /* _ldw */
{ "LDMD", 0 }, /* _ldmd */
{ "LSRD", 0 }, /* _lsrd */
{ "LSRW", 0 }, /* _lsrw */
{ "MULD", 0 }, /* _muld */
{ "NEGD", 0 }, /* _negd */
{ "ORD", 0 }, /* _ord */
{ "ORR", 0 }, /* _orr */
{ "PSHSW", 0 }, /* _pshsw */
{ "PSHUW", 0 }, /* _pshuw */
{ "PULSW", 0 }, /* _pulsw */
{ "PULUW", 0 }, /* _puluw */
{ "ROLD", 0 }, /* _rold */
{ "ROLW", 0 }, /* _rolw */
{ "RORD", 0 }, /* _rord */
{ "RORW", 0 }, /* _rorw */
{ "SBCD", 0 }, /* _sbcd */
{ "SBCR", 0 }, /* _sbcr */
{ "SEXW", 0 }, /* _sexw */
{ "STE", 0 }, /* _ste */
{ "STF", 0 }, /* _stf */
{ "STQ", 0 }, /* _stq */
{ "STW", 0 }, /* _stw */
{ "SUBE", 0 }, /* _sube */
{ "SUBF", 0 }, /* _subf */
{ "SUBW", 0 }, /* _subw */
{ "SUBR", 0 }, /* _subr */
{ "TSTD", 0 }, /* _tstd */
{ "TSTE", 0 }, /* _tste */
{ "TSTF", 0 }, /* _tstf */
{ "TSTW", 0 }, /* _tstw */
};
char *os9_codes[0x100] =
{
"F$Link", "F$Load", "F$UnLink", "F$Fork", /* 00..03 */
"F$Wait", "F$Chain", "F$Exit", "F$Mem", /* 04..07 */
"F$Send", "F$Icpt", "F$Sleep", "F$SSpd", /* 08..0B */
"F$ID", "F$SPrior", "F$SSWI", "F$Perr", /* 0C..0F */
"F$PrsNam", "F$CmpNam", "F$SchBit", "F$AllBit", /* 10..13 */
"F$DelBit", "F$Time", "F$STime", "F$CRC", /* 14..17 */
"F$GPrDsc", "F$GBlkMp", "F$GModDr", "F$CpyMem", /* 18..1B */
"F$SUser", "F$UnLoad", "F$Alarm", "F$", /* 1C..1F */
"F$", "F$NMLink", "F$NMLoad", "F$Ctime", /* 20..23 */
"F$Cstime", "F$CTswi2", "F$", "F$VIRQ", /* 24..27 */
"F$SRqMem", "F$SRtMem", "F$IRQ", "F$IOQu", /* 28..2B */
"F$AProc", "F$NProc", "F$VModul", "F$Find64", /* 2C..2F */
"F$All64", "F$Ret64", "F$SSvc", "F$IODel", /* 30..33 */
"F$SLink", "F$Boot", "F$BtMem", "F$GProcP", /* 34..37 */
"F$Move", "F$AllRAM", "F$AllImg", "F$DelImg", /* 38..3B */
"F$SetImg", "F$FreeLB", "F$FreeHB", "F$AllTsk", /* 3C..3F */
"F$DelTsk", "F$SetTsk", "F$ResTsk", "F$RelTsk", /* 40..43 */
"F$DATLog", "F$DATTmp", "F$LDAXY", "F$LDAXYP", /* 44..47 */
"F$LDDDXY", "F$LDABX", "F$STABX", "F$AllPrc", /* 48..4B */
"F$DelPrc", "F$ELink", "F$FModul", "F$MapBlk", /* 4C..4F */
"F$ClrBlk", "F$DelRAM", "F$GCMDir", "F$AlHRam", /* 50..53 */
"F$", "F$", "F$", "F$", /* 54..57 */
"F$", "F$", "F$", "F$", /* 58..5B */
"F$", "F$", "F$", "F$", /* 5C..5F */
"F$", "F$", "F$", "F$", /* 60..63 */
"F$", "F$", "F$", "F$", /* 64..67 */
"F$", "F$", "F$", "F$", /* 68..6B */
"F$", "F$", "F$", "F$", /* 6C..6F */
"F$", "F$", "F$", "F$", /* 70..73 */
"F$", "F$", "F$", "F$", /* 74..77 */
"F$", "F$", "F$", "F$", /* 78..7B */
"F$", "F$", "F$", "F$", /* 7C..7F */
"I$Attach", "I$Detach", "I$Dup", "I$Create", /* 80..83 */
"I$Open", "I$MakDir", "I$Chgdir", "I$Delete", /* 84..87 */
"I$Seek", "I$Read", "I$Write", "I$ReadLn", /* 88..8B */
"I$WritLn", "I$GetStt", "I$SetStt", "I$Close", /* 8C..8F */
"I$DeletX", "F$", "F$", "F$", /* 90..93 */
"F$", "F$", "F$", "F$", /* 94..97 */
"F$", "F$", "F$", "F$", /* 98..9B */
"F$", "F$", "F$", "F$", /* 9C..9F */
"F$", "F$", "F$", "F$", /* A0..A3 */
"F$", "F$", "F$", "F$", /* A4..A7 */
"F$", "F$", "F$", "F$", /* A8..AB */
"F$", "F$", "F$", "F$", /* AC..AF */
"F$", "F$", "F$", "F$", /* B0..B3 */
"F$", "F$", "F$", "F$", /* B4..B7 */
"F$", "F$", "F$", "F$", /* B8..BB */
"F$", "F$", "F$", "F$", /* BC..BF */
"F$", "F$", "F$", "F$", /* C0..C3 */
"F$", "F$", "F$", "F$", /* C4..C7 */
"F$", "F$", "F$", "F$", /* C8..CB */
"F$", "F$", "F$", "F$", /* CC..CF */
"F$", "F$", "F$", "F$", /* D0..D3 */
"F$", "F$", "F$", "F$", /* D4..D7 */
"F$", "F$", "F$", "F$", /* D8..DB */
"F$", "F$", "F$", "F$", /* DC..DF */
"F$", "F$", "F$", "F$", /* E0..E3 */
"F$", "F$", "F$", "F$", /* E4..E7 */
"F$", "F$", "F$", "F$", /* E8..EB */
"F$", "F$", "F$", "F$", /* EC..EF */
"F$", "F$", "F$", "F$", /* F0..F3 */
"F$", "F$", "F$", "F$", /* F4..F7 */
"F$", "F$", "F$", "F$", /* F8..FB */
"F$", "F$", "F$", "F$" /* FC..FF */
};
byte m6800_codes[512] =
{
_ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 00..03 */
_ill ,_nom, _ill ,_nom, _tap ,_imp, _tpa ,_imp, /* 04..07 */
_inx ,_imp, _dex ,_imp, _clv ,_imp, _sev ,_imp, /* 08..0B */
_clc ,_imp, _sec ,_imp, _cli ,_imp, _sei ,_imp, /* 0C..0F */
_sba ,_imp, _cba ,_imp, _ill ,_nom, _ill ,_nom, /* 10..13 */
_ill ,_nom, _ill ,_nom, _tab ,_imp, _tba ,_imp, /* 14..17 */
_ill ,_nom, _daa ,_imp, _ill ,_nom, _aba ,_imp, /* 18..1B */
_ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 1C..1F */
_bra ,_reb, _ill ,_nom, _bhi ,_reb, _bls ,_reb, /* 20..23 */
_bcc ,_reb, _bcs ,_reb, _bne ,_reb, _beq ,_reb, /* 24..27 */
_bvc ,_reb, _bvs ,_reb, _bpl ,_reb, _bmi ,_reb, /* 28..2B */
_bge ,_reb, _blt ,_reb, _bgt ,_reb, _ble ,_reb, /* 2C..2F */
_tsx ,_imp, _ins ,_imp, _pula ,_imp, _pulb ,_imp, /* 30..33 */
_des ,_imp, _txs ,_imp, _psha ,_imp, _pshb ,_imp, /* 34..37 */
_ill ,_nom, _rts ,_imp, _ill ,_nom, _rti ,_imp, /* 38..3B */
_ill ,_nom, _ill ,_nom, _wai ,_imp, _swi ,_imp, /* 3C..3F */
_nega ,_imp, _ill ,_nom, _ill ,_nom, _coma ,_imp, /* 40..43 */
_lsra ,_imp, _ill ,_nom, _rora ,_imp, _asra ,_imp, /* 44..47 */
_asla ,_imp, _rola ,_imp, _deca ,_imp, _ill ,_nom, /* 48..4B */
_inca ,_imp, _tsta ,_imp, _ill ,_nom, _clra ,_imp, /* 4C..4F */
_negb ,_imp, _ill ,_nom, _ill ,_nom, _comb ,_imp, /* 50..53 */
_lsrb ,_imp, _ill ,_nom, _rorb ,_imp, _asrb ,_imp, /* 54..57 */
_aslb ,_imp, _rolb ,_imp, _decb ,_imp, _ill ,_nom, /* 58..5B */
_incb ,_imp, _tstb ,_imp, _ill ,_nom, _clrb ,_imp, /* 5C..5F */
_neg ,_ix8, _ill ,_nom, _ill ,_nom, _com ,_ix8, /* 60..63 */
_lsr ,_ix8, _ill ,_nom, _ror ,_ix8, _asr ,_ix8, /* 64..67 */
_asl ,_ix8, _rol ,_ix8, _dec ,_ix8, _ill ,_nom, /* 68..6B */
_inc ,_ix8, _tst ,_ix8, _jmp ,_ix8, _clr ,_ix8, /* 6C..6F */
_neg ,_ext, _ill ,_nom, _ill ,_nom, _com ,_ext, /* 70..73 */
_lsr ,_ext, _ill ,_nom, _ror ,_ext, _asr ,_ext, /* 74..77 */
_asl ,_ext, _rol ,_ext, _dec ,_ext, _ill ,_nom, /* 78..7B */
_inc ,_ext, _tst ,_ext, _jmp ,_ext, _clr ,_ext, /* 7C..7F */
_suba ,_imb, _cmpa ,_imb, _sbca ,_imb, _ill ,_nom, /* 80..83 */
_anda ,_imb, _bita ,_imb, _lda ,_imb, _ill ,_nom, /* 84..87 */
_eora ,_imb, _adca ,_imb, _ora ,_imb, _adda ,_imb, /* 88..8B */
_cpx ,_imw, _bsr ,_reb, _lds ,_imw, _ill ,_nom, /* 8C..8F */
_suba ,_dir, _cmpa ,_dir, _sbca ,_dir, _ill ,_nom, /* 90..93 */
_anda ,_dir, _bita ,_dir, _lda ,_dir, _sta ,_dir, /* 94..97 */
_eora ,_dir, _adca ,_dir, _ora ,_dir, _adda ,_dir, /* 98..9B */
_cpx ,_dir, _ill ,_nom, _lds ,_dir, _sts ,_dir, /* 9C..9F */
_suba ,_ix8, _cmpa ,_ix8, _sbca ,_ix8, _ill ,_nom, /* A0..A3 */
_anda ,_ix8, _bita ,_ix8, _lda ,_ix8, _sta ,_ix8, /* A4..A7 */
_eora ,_ix8, _adca ,_ix8, _ora ,_ix8, _adda ,_ix8, /* A8..AB */
_cpx ,_ix8, _jsr ,_ix8, _lds ,_ix8, _sts ,_ix8, /* AC..AF */
_suba ,_ext, _cmpa ,_ext, _sbca ,_ext, _ill ,_nom, /* B0..B3 */
_anda ,_ext, _bita ,_ext, _lda ,_ext, _sta ,_ext, /* B4..B7 */
_eora ,_ext, _adca ,_ext, _ora ,_ext, _adda ,_ext, /* B8..BB */
_cpx ,_ext, _jsr ,_ext, _lds ,_ext, _sts ,_ext, /* BC..BF */
_subb ,_imb, _cmpb ,_imb, _sbcb ,_imb, _ill ,_nom, /* C0..C3 */
_andb ,_imb, _bitb ,_imb, _ldb ,_imb, _ill ,_nom, /* C4..C7 */
_eorb ,_imb, _adcb ,_imb, _orb ,_imb, _addb ,_imb, /* C8..CB */
_ill ,_nom, _ill ,_nom, _ldx ,_imw, _ill ,_nom, /* CC..CF */
_subb ,_dir, _cmpb ,_dir, _sbcb ,_dir, _ill ,_nom, /* D0..D3 */
_andb ,_dir, _bitb ,_dir, _ldb ,_dir, _stb ,_dir, /* D4..D7 */
_eorb ,_dir, _adcb ,_dir, _orb ,_dir, _addb ,_dir, /* D8..DB */
_ill ,_nom, _ill ,_nom, _ldx ,_dir, _stx ,_dir, /* DC..DF */
_subb ,_ix8, _cmpb ,_ix8, _sbcb ,_ix8, _ill ,_nom, /* E0..E3 */
_andb ,_ix8, _bitb ,_ix8, _ldb ,_ix8, _stb ,_ix8, /* E4..E7 */
_eorb ,_ix8, _adcb ,_ix8, _orb ,_ix8, _addb ,_ix8, /* E8..EB */
_ill ,_nom, _ill ,_nom, _ldx ,_ix8, _stx ,_ix8, /* EC..EF */
_subb ,_ext, _cmpb ,_ext, _sbcb ,_ext, _ill ,_nom, /* F0..F3 */
_andb ,_ext, _bitb ,_ext, _ldb ,_ext, _stb ,_ext, /* F4..F7 */
_eorb ,_ext, _adcb ,_ext, _orb ,_ext, _addb ,_ext, /* F8..FB */
_ill ,_nom, _ill ,_nom, _ldx ,_ext, _stx ,_ext, /* FC..FF */
};
byte m6801_codes[512] =
{
_ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 00..03 */
_lsrd ,_imp, _asld ,_imp, _tap ,_imp, _tpa ,_imp, /* 04..07 */
_inx ,_imp, _dex ,_imp, _clv ,_imp, _sev ,_imp, /* 08..0B */
_clc ,_imp, _sec ,_imp, _cli ,_imp, _sei ,_imp, /* 0C..0F */
_sba ,_imp, _cba ,_imp, _ill ,_nom, _ill ,_nom, /* 10..13 */
_ill ,_nom, _ill ,_nom, _tab ,_imp, _tba ,_imp, /* 14..17 */
_ill ,_nom, _daa ,_imp, _ill ,_nom, _aba ,_imp, /* 18..1B */
_ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 1C..1F */
_bra ,_reb, _brn ,_reb, _bhi ,_reb, _bls ,_reb, /* 20..23 */
_bcc ,_reb, _bcs ,_reb, _bne ,_reb, _beq ,_reb, /* 24..27 */
_bvc ,_reb, _bvs ,_reb, _bpl ,_reb, _bmi ,_reb, /* 28..2B */
_bge ,_reb, _blt ,_reb, _bgt ,_reb, _ble ,_reb, /* 2C..2F */
_tsx ,_imp, _ins ,_imp, _pula ,_imp, _pulb ,_imp, /* 30..33 */
_des ,_imp, _txs ,_imp, _psha ,_imp, _pshb ,_imp, /* 34..37 */
_pulx ,_imp, _rts ,_imp, _abx ,_imp, _rti ,_imp, /* 38..3B */
_pshx ,_imp, _mul ,_imp, _wai ,_imp, _swi ,_imp, /* 3C..3F */
_nega ,_imp, _ill ,_nom, _ill ,_nom, _coma ,_imp, /* 40..43 */
_lsra ,_imp, _ill ,_nom, _rora ,_imp, _asra ,_imp, /* 44..47 */
_asla ,_imp, _rola ,_imp, _deca ,_imp, _ill ,_nom, /* 48..4B */
_inca ,_imp, _tsta ,_imp, _ill ,_nom, _clra ,_imp, /* 4C..4F */
_negb ,_imp, _ill ,_nom, _ill ,_nom, _comb ,_imp, /* 50..53 */
_lsrb ,_imp, _ill ,_nom, _rorb ,_imp, _asrb ,_imp, /* 54..57 */
_aslb ,_imp, _rolb ,_imp, _decb ,_imp, _ill ,_nom, /* 58..5B */
_incb ,_imp, _tstb ,_imp, _ill ,_nom, _clrb ,_imp, /* 5C..5F */
_neg ,_ix8, _ill ,_nom, _ill ,_nom, _com ,_ix8, /* 60..63 */
_lsr ,_ix8, _ill ,_nom, _ror ,_ix8, _asr ,_ix8, /* 64..67 */
_asl ,_ix8, _rol ,_ix8, _dec ,_ix8, _ill ,_nom, /* 68..6B */
_inc ,_ix8, _tst ,_ix8, _jmp ,_ix8, _clr ,_ix8, /* 6C..6F */
_neg ,_ext, _ill ,_nom, _ill ,_nom, _com ,_ext, /* 70..73 */
_lsr ,_ext, _ill ,_nom, _ror ,_ext, _asr ,_ext, /* 74..77 */
_asl ,_ext, _rol ,_ext, _dec ,_ext, _ill ,_nom, /* 78..7B */
_inc ,_ext, _tst ,_ext, _jmp ,_ext, _clr ,_ext, /* 7C..7F */
_suba ,_imb, _cmpa ,_imb, _sbca ,_imb, _subd ,_imw, /* 80..83 */
_anda ,_imb, _bita ,_imb, _lda ,_imb, _ill ,_nom, /* 84..87 */
_eora ,_imb, _adca ,_imb, _ora ,_imb, _adda ,_imb, /* 88..8B */
_cpx ,_imw, _bsr ,_reb, _lds ,_imw, _ill ,_nom, /* 8C..8F */
_suba ,_dir, _cmpa ,_dir, _sbca ,_dir, _subd ,_dir, /* 90..93 */
_anda ,_dir, _bita ,_dir, _lda ,_dir, _sta ,_dir, /* 94..97 */
_eora ,_dir, _adca ,_dir, _ora ,_dir, _adda ,_dir, /* 98..9B */
_cpx ,_dir, _jsr ,_dir, _lds ,_dir, _sts ,_dir, /* 9C..9F */
_suba ,_ix8, _cmpa ,_ix8, _sbca ,_ix8, _subd ,_ix8, /* A0..A3 */
_anda ,_ix8, _bita ,_ix8, _lda ,_ix8, _sta ,_ix8, /* A4..A7 */
_eora ,_ix8, _adca ,_ix8, _ora ,_ix8, _adda ,_ix8, /* A8..AB */
_cpx ,_ix8, _jsr ,_ix8, _lds ,_ix8, _sts ,_ix8, /* AC..AF */
_suba ,_ext, _cmpa ,_ext, _sbca ,_ext, _subd ,_ext, /* B0..B3 */
_anda ,_ext, _bita ,_ext, _lda ,_ext, _sta ,_ext, /* B4..B7 */
_eora ,_ext, _adca ,_ext, _ora ,_ext, _adda ,_ext, /* B8..BB */
_cpx ,_ext, _jsr ,_ext, _lds ,_ext, _sts ,_ext, /* BC..BF */
_subb ,_imb, _cmpb ,_imb, _sbcb ,_imb, _addd ,_imw, /* C0..C3 */
_andb ,_imb, _bitb ,_imb, _ldb ,_imb, _ill ,_nom, /* C4..C7 */
_eorb ,_imb, _adcb ,_imb, _orb ,_imb, _addb ,_imb, /* C8..CB */
_ldd ,_imw, _ill ,_nom, _ldx ,_imw, _ill ,_nom, /* CC..CF */
_subb ,_dir, _cmpb ,_dir, _sbcb ,_dir, _addd ,_dir, /* D0..D3 */
_andb ,_dir, _bitb ,_dir, _ldb ,_dir, _stb ,_dir, /* D4..D7 */
_eorb ,_dir, _adcb ,_dir, _orb ,_dir, _addb ,_dir, /* D8..DB */
_ldd ,_dir, _std ,_dir, _ldx ,_dir, _stx ,_dir, /* DC..DF */
_subb ,_ix8, _cmpb ,_ix8, _sbcb ,_ix8, _addd ,_ix8, /* E0..E3 */
_andb ,_ix8, _bitb ,_ix8, _ldb ,_ix8, _stb ,_ix8, /* E4..E7 */
_eorb ,_ix8, _adcb ,_ix8, _orb ,_ix8, _addb ,_ix8, /* E8..EB */
_ldd ,_ix8, _std ,_ix8, _ldx ,_ix8, _stx ,_ix8, /* EC..EF */
_subb ,_ext, _cmpb ,_ext, _sbcb ,_ext, _addd ,_ext, /* F0..F3 */
_andb ,_ext, _bitb ,_ext, _ldb ,_ext, _stb ,_ext, /* F4..F7 */
_eorb ,_ext, _adcb ,_ext, _orb ,_ext, _addb ,_ext, /* F8..FB */
_ldd ,_ext, _std ,_ext, _ldx ,_ext, _stx ,_ext, /* FC..FF */
};
byte m6301_codes[512] =
{
_ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 00..03 */
_lsrd ,_imp, _asld ,_imp, _tap ,_imp, _tpa ,_imp, /* 04..07 */
_inx ,_imp, _dex ,_imp, _clv ,_imp, _sev ,_imp, /* 08..0B */
_clc ,_imp, _sec ,_imp, _cli ,_imp, _sei ,_imp, /* 0C..0F */
_sba ,_imp, _cba ,_imp, _ill ,_nom, _ill ,_nom, /* 10..13 */
_ill ,_nom, _ill ,_nom, _tab ,_imp, _tba ,_imp, /* 14..17 */
_xgdx ,_imp, _daa ,_imp, _slp ,_imp, _aba ,_imp, /* 18..1B: extra 0x18/xgdx, 0x1a/slp */
_ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 1C..1F */
_bra ,_reb, _brn ,_reb, _bhi ,_reb, _bls ,_reb, /* 20..23 */
_bcc ,_reb, _bcs ,_reb, _bne ,_reb, _beq ,_reb, /* 24..27 */
_bvc ,_reb, _bvs ,_reb, _bpl ,_reb, _bmi ,_reb, /* 28..2B */
_bge ,_reb, _blt ,_reb, _bgt ,_reb, _ble ,_reb, /* 2C..2F */
_tsx ,_imp, _ins ,_imp, _pula ,_imp, _pulb ,_imp, /* 30..33 */
_des ,_imp, _txs ,_imp, _psha ,_imp, _pshb ,_imp, /* 34..37 */
_pulx ,_imp, _rts ,_imp, _abx ,_imp, _rti ,_imp, /* 38..3B */
_pshx ,_imp, _mul ,_imp, _wai ,_imp, _swi ,_imp, /* 3C..3F */
_nega ,_imp, _ill ,_nom, _ill ,_nom, _coma ,_imp, /* 40..43 */
_lsra ,_imp, _ill ,_nom, _rora ,_imp, _asra ,_imp, /* 44..47 */
_asla ,_imp, _rola ,_imp, _deca ,_imp, _ill ,_nom, /* 48..4B */
_inca ,_imp, _tsta ,_imp, _ill ,_nom, _clra ,_imp, /* 4C..4F */
_negb ,_imp, _ill ,_nom, _ill ,_nom, _comb ,_imp, /* 50..53 */
_lsrb ,_imp, _ill ,_nom, _rorb ,_imp, _asrb ,_imp, /* 54..57 */
_aslb ,_imp, _rolb ,_imp, _decb ,_imp, _ill ,_nom, /* 58..5B */
_incb ,_imp, _tstb ,_imp, _ill ,_nom, _clrb ,_imp, /* 5C..5F */
_neg ,_ix8, _aim ,_bi, _oim ,_bi, _com ,_ix8, /* 60..63: extra 0x61/aim, 0x62/oim */
_lsr ,_ix8, _eim ,_bi, _ror ,_ix8, _asr ,_ix8, /* 64..67: extra 0x65/eim */
_asl ,_ix8, _rol ,_ix8, _dec ,_ix8, _tim ,_bi, /* 68..6B: extra 0x6b/tim */
_inc ,_ix8, _tst ,_ix8, _jmp ,_ix8, _clr ,_ix8, /* 6C..6F */
_neg ,_ext, _aim ,_bd, _oim ,_bd, _com ,_ext, /* 70..73: extra 0x71/aim, 0x72/oim */
_lsr ,_ext, _eim ,_bd, _ror ,_ext, _asr ,_ext, /* 74..77: extra 0x75/eim */
_asl ,_ext, _rol ,_ext, _dec ,_ext, _tim ,_bd, /* 78..7B: extra 0x7b/tim */
_inc ,_ext, _tst ,_ext, _jmp ,_ext, _clr ,_ext, /* 7C..7F */
_suba ,_imb, _cmpa ,_imb, _sbca ,_imb, _subd ,_imw, /* 80..83 */
_anda ,_imb, _bita ,_imb, _lda ,_imb, _ill ,_nom, /* 84..87 */
_eora ,_imb, _adca ,_imb, _ora ,_imb, _adda ,_imb, /* 88..8B */
_cpx ,_imw, _bsr ,_reb, _lds ,_imw, _ill ,_nom, /* 8C..8F */
_suba ,_dir, _cmpa ,_dir, _sbca ,_dir, _subd ,_dir, /* 90..93 */
_anda ,_dir, _bita ,_dir, _lda ,_dir, _sta ,_dir, /* 94..97 */
_eora ,_dir, _adca ,_dir, _ora ,_dir, _adda ,_dir, /* 98..9B */
_cpx ,_dir, _jsr ,_dir, _lds ,_dir, _sts ,_dir, /* 9C..9F */
_suba ,_ix8, _cmpa ,_ix8, _sbca ,_ix8, _subd ,_ix8, /* A0..A3 */
_anda ,_ix8, _bita ,_ix8, _lda ,_ix8, _sta ,_ix8, /* A4..A7 */
_eora ,_ix8, _adca ,_ix8, _ora ,_ix8, _adda ,_ix8, /* A8..AB */
_cpx ,_ix8, _jsr ,_ix8, _lds ,_ix8, _sts ,_ix8, /* AC..AF */
_suba ,_ext, _cmpa ,_ext, _sbca ,_ext, _subd ,_ext, /* B0..B3 */
_anda ,_ext, _bita ,_ext, _lda ,_ext, _sta ,_ext, /* B4..B7 */
_eora ,_ext, _adca ,_ext, _ora ,_ext, _adda ,_ext, /* B8..BB */
_cpx ,_ext, _jsr ,_ext, _lds ,_ext, _sts ,_ext, /* BC..BF */
_subb ,_imb, _cmpb ,_imb, _sbcb ,_imb, _addd ,_imw, /* C0..C3 */
_andb ,_imb, _bitb ,_imb, _ldb ,_imb, _ill ,_nom, /* C4..C7 */
_eorb ,_imb, _adcb ,_imb, _orb ,_imb, _addb ,_imb, /* C8..CB */
_ldd ,_imw, _ill ,_nom, _ldx ,_imw, _ill ,_nom, /* CC..CF */
_subb ,_dir, _cmpb ,_dir, _sbcb ,_dir, _addd ,_dir, /* D0..D3 */
_andb ,_dir, _bitb ,_dir, _ldb ,_dir, _stb ,_dir, /* D4..D7 */
_eorb ,_dir, _adcb ,_dir, _orb ,_dir, _addb ,_dir, /* D8..DB */
_ldd ,_dir, _std ,_dir, _ldx ,_dir, _stx ,_dir, /* DC..DF */
_subb ,_ix8, _cmpb ,_ix8, _sbcb ,_ix8, _addd ,_ix8, /* E0..E3 */
_andb ,_ix8, _bitb ,_ix8, _ldb ,_ix8, _stb ,_ix8, /* E4..E7 */
_eorb ,_ix8, _adcb ,_ix8, _orb ,_ix8, _addb ,_ix8, /* E8..EB */
_ldd ,_ix8, _std ,_ix8, _ldx ,_ix8, _stx ,_ix8, /* EC..EF */
_subb ,_ext, _cmpb ,_ext, _sbcb ,_ext, _addd ,_ext, /* F0..F3 */
_andb ,_ext, _bitb ,_ext, _ldb ,_ext, _stb ,_ext, /* F4..F7 */
_eorb ,_ext, _adcb ,_ext, _orb ,_ext, _addb ,_ext, /* F8..FB */
_ldd ,_ext, _std ,_ext, _ldx ,_ext, _stx ,_ext, /* FC..FF */
};
byte h6309_codes[512] =
{
_neg ,_dir, _oim ,_bd , _aim ,_bd , _com ,_dir, /* 00..03 */
_lsr ,_dir, _eim ,_bd , _ror ,_dir, _asr ,_dir, /* 04..07 */
_asl ,_dir, _rol ,_dir, _dec ,_dir, _tim ,_bd , /* 08..0B */
_inc ,_dir, _tst ,_dir, _jmp ,_dir, _clr ,_dir, /* 0C..0F */