-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathgalang6805.cpp
More file actions
856 lines (779 loc) · 28.8 KB
/
galang6805.cpp
File metadata and controls
856 lines (779 loc) · 28.8 KB
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
#include "gamnemonic.h"
#include "galang6805.h"
//Just to keep things shorter.
#define mnem new GAMnemonic
GALang6805::GALang6805() {
endian=BIG;
name="6805";
maxbytes=3;
//Register names.
regnames.clear();
regnames<<"x"<<"y"<<"a";
//Sheet 1 from MC68HC05P9
insert(mnem("adc", 2, "\xa9\x00", "\xff\x00"))
->help("Add to A with Carry. (imm)")
->example("adc #0xff")
->imm("\x00\xff");
insert(mnem("adc", 2, "\xb9\x00", "\xff\x00"))
->help("Add to A with Carry. (dir)")
->example("adc @0xff")
->abs("\x00\xff");
insert(mnem("adc", 3, "\xc9\x00\x00", "\xff\x00\x00"))
->help("Add to A with Carry. (ext)")
->example("adc @0xffff")
->abs("\x00\xff\xff");
insert(mnem("adc", 3, "\xd9\x00\x00", "\xff\x00\x00"))
->help("Add to A with Carry. (ix2)")
->example("adc @0xffff, x")
->absx("\x00\xff\xff");
insert(mnem("adc", 2, "\xe9\x00", "\xff\x00"))
->help("Add to A with Carry. (ix1)")
->example("adc @0xff, x")
->absx("\x00\xff");
insert(mnem("adc", 1, "\xf9", "\xff"))
->help("Add to A with Carry. (ix)")
->example("adc @x")
->regnameind("x");
insert(mnem("add", 2, "\xab\x00", "\xff\x00"))
->help("Add to A. (imm)")
->example("add #0xff")
->imm("\x00\xff");
insert(mnem("add", 2, "\xbb\x00", "\xff\x00"))
->help("Add to A. (dir)")
->example("add @0xff")
->abs("\x00\xff");
insert(mnem("add", 3, "\xcb\x00\x00", "\xff\x00\x00"))
->help("Add to A. (ext)")
->example("add @0xffff")
->abs("\x00\xff\xff");
insert(mnem("add", 3, "\xdb\x00\x00", "\xff\x00\x00"))
->help("Add to A. (ix2)")
->example("add @0xffff, x")
->absx("\x00\xff\xff");
insert(mnem("add", 2, "\xeb\x00", "\xff\x00"))
->help("Add to A. (ix1)")
->example("add @0xff, x")
->absx("\x00\xff");
insert(mnem("add", 1, "\xfb", "\xff"))
->help("Add to A. (ix)")
->example("add @x")
->regnameind("x");
insert(mnem("and", 2, "\xa4\x00", "\xff\x00"))
->help("AND into A. (imm)")
->example("and #0xff")
->imm("\x00\xff");
insert(mnem("and", 2, "\xb4\x00", "\xff\x00"))
->help("AND into A. (dir)")
->example("and @0xff")
->abs("\x00\xff");
insert(mnem("and", 3, "\xc4\x00\x00", "\xff\x00\x00"))
->help("AND into A. (ext)")
->example("and @0xffff")
->abs("\x00\xff\xff");
insert(mnem("and", 3, "\xd4\x00\x00", "\xff\x00\x00"))
->help("AND into A. (ix2)")
->example("and @0xffff, x")
->absx("\x00\xff\xff");
insert(mnem("and", 2, "\xe4\x00", "\xff\x00"))
->help("AND into A. (ix1)")
->example("and @0xff, x")
->absx("\x00\xff");
insert(mnem("and", 1, "\xf4", "\xff"))
->help("AND into A. (ix)")
->example("and @x")
->regnameind("x");
insert(mnem("asl", 2, "\x38\x00", "\xff\x00"))
->help("Arithmetic Shift Left. (dir)")
->example("asl @0xff")
->abs("\x00\xff");
insert(mnem("asl", 1, "\x48", "\xff"))
->help("Arithmetic Shift Left. (inh)")
->example("asl a")
->regname("a");
insert(mnem("asl", 1, "\x58", "\xff"))
->help("Arithmetic Shift Left. (inh)")
->example("asl x")
->regname("x");
insert(mnem("asl", 2, "\x68\x00", "\xff\x00"))
->help("Arithmetic Shift Left. (ix1)")
->example("asl @0xff, x")
->absx("\x00\xff");
insert(mnem("asl", 1, "\x78", "\xff"))
->help("Arithmetic Shift Left. (ix)")
->example("asl @x")
->regnameind("x");
insert(mnem("asr", 2, "\x37\x00", "\xff\x00"))
->help("Arithmetic Shift Right. (dir)")
->example("asr @0xff")
->abs("\x00\xff");
insert(mnem("asr", 1, "\x47", "\xff"))
->help("Arithmetic Shift Right. (inh)")
->example("asr a")
->regname("a");
insert(mnem("asr", 1, "\x57", "\xff\x00"))
->help("Arithmetic Shift Right. (inh)")
->example("asr x")
->regname("x");
insert(mnem("asr", 2, "\x67\x00", "\xff\x00"))
->help("Arithmetic Shift Right. (ix1)")
->example("asr @0xff, x")
->absx("\x00\xff");
insert(mnem("asr", 1, "\x77", "\xff"))
->help("Arithmetic Shift Right. (ix)")
->example("asr @x")
->regnameind("x");
insert(mnem("bcc", 2, "\x24\x00", "\xff\x00"))
->help("Branch if Carry Clear. (rel)")
->example("here: bcc here")
->prioritize() //Dupe of BHS.
->rel("\x00\xff");
insert(mnem("bclr", 2, "\x11\x00", "\xf1\x00"))
->help("Clear bit. (dir)")
->example("bclr bit4, @0xff")
->bit3("\x0e\x00")
->abs("\x00\xff");
insert(mnem("bcs", 2, "\x25\x00", "\xff\x00"))
->help("Branch if Carry Set. (rel)")
->example("here: bcs here")
->prioritize() //Dupe of BLO.
->rel("\x00\xff");
insert(mnem("beq", 2, "\x27\x00", "\xff\x00"))
->help("Branch if Equal. (rel)")
->example("here: beq here")
->rel("\x00\xff");
insert(mnem("bhcc", 2, "\x28\x00", "\xff\x00"))
->help("Branch if Half Carry Clear. (rel)")
->example("here: bhcc here")
->rel("\x00\xff");
insert(mnem("bhcs", 2, "\x29\x00", "\xff\x00"))
->help("Branch if Half Carry Set. (rel)")
->example("here: bhcs here")
->rel("\x00\xff");
insert(mnem("bhi", 2, "\x22\x00", "\xff\x00"))
->help("Branch if Higher. (rel)")
->example("here: bhi here")
->rel("\x00\xff");
insert(mnem("bhs", 2, "\x24\x00", "\xff\x00")) //Same BCLR.
->help("Branch if Higher or Same. (rel)")
->example("here: bhs here")
->rel("\x00\xff");
insert(mnem("bih", 2, "\x2f\x00", "\xff\x00")) //Same BCLR.
->help("Branch if IRQ High. (rel)")
->example("here: bih here")
->rel("\x00\xff");
insert(mnem("bil", 2, "\x2e\x00", "\xff\x00")) //Same BCLR.
->help("Branch if IRQ Low. (rel)")
->example("here: bil here")
->rel("\x00\xff");
insert(mnem("bit", 2, "\xa5\x00", "\xff\x00"))
->help("Bit Immediate Test. (imm)")
->example("bit #0xff")
->imm("\x00\xff");
insert(mnem("bit", 2, "\xb5\x00", "\xff\x00"))
->help("Bit Immediate Test. (dir)")
->example("bit @0xff")
->abs("\x00\xff");
insert(mnem("bit", 3, "\xc5\x00\x00", "\xff\x00\x00"))
->help("Bit Immediate Test. (ext)")
->example("bit @0xffff")
->abs("\x00\xff\xff");
insert(mnem("bit", 3, "\xd5\x00\x00", "\xff\x00\x00"))
->help("Bit Immediate Test. (ix2)")
->example("bit @0xffff, x")
->absx("\x00\xff\xff");
insert(mnem("bit", 2, "\xe5\x00", "\xff\x00"))
->help("Bit Immediate Test. (ix1)")
->example("bit @0xff, x")
->absx("\x00\xff");
insert(mnem("bit", 1, "\xf5", "\xff"))
->help("Bit Immediate Test. (ix)")
->example("bit @x")
->regnameind("x");
insert(mnem("blo", 2, "\x25\x00", "\xff\x00"))
->help("Branch if Lower. (rel)")
->example("here: blo here")
->rel("\x00\xff");
insert(mnem("bls", 2, "\x23\x00", "\xff\x00"))
->help("Branch if Lower or Same. (rel)")
->example("here: bls here")
->rel("\x00\xff");
insert(mnem("bmc", 2, "\x2c\x00", "\xff\x00"))
->help("Branch if Int Mask Clear. (rel)")
->example("here: bmc here")
->rel("\x00\xff");
insert(mnem("bmi", 2, "\x2b\x00", "\xff\x00"))
->help("Branch if Minus. (rel)")
->example("here: bmi here")
->rel("\x00\xff");
insert(mnem("bms", 2, "\x2d\x00", "\xff\x00"))
->help("Branch if Int Mask Set. (rel)")
->example("here: bms here")
->rel("\x00\xff");
insert(mnem("bne", 2, "\x26\x00", "\xff\x00"))
->help("Branch if Not Equal. (rel)")
->example("here: bne here")
->rel("\x00\xff");
insert(mnem("bpl", 2, "\x2a\x00", "\xff\x00"))
->help("Branch if Plus. (rel)")
->example("here: bpl here")
->rel("\x00\xff");
// Sheet 2
insert(mnem("bra", 2, "\x20\x00", "\xff\x00"))
->help("Branch Always. (rel)")
->example("here: bra here")
->rel("\x00\xff");
insert(mnem("brclr", 3, "\x01\x00\x00", "\xf1\x00\x00"))
->help("Branch if bit Clear. (dir)")
->example("here: brclr bit4, @0xff, here")
->bit3("\x0e\x00\x00")
->abs("\x00\xff\x00")
->rel("\x00\x00\xff");
insert(mnem("brn", 2, "\x21\x00", "\xff\x00"))
->help("Branch Never. (rel)")
->example("here: brn here")
->rel("\x00\xff");
insert(mnem("brset", 3, "\x00\x00\x00", "\xf1\x00\x00"))
->help("Branch if bit Set. (dir)")
->example("here: brset bit4, @0xff, here")
->bit3("\x0e\x00\x00")
->abs("\x00\xff\x00")
->rel("\x00\x00\xff");
insert(mnem("bset", 2, "\x10\x00", "\xf1\x00"))
->help("Bit Set. (dir)")
->example("bset bit4, @0xff")
->bit3("\x0e\x00")
->abs("\x00\xff");
insert(mnem("bsr", 2, "\xad\x00", "\xff\x00"))
->help("Branch to Subroutine. (rel)")
->example("here: bsr here")
->rel("\x00\xff");
insert(mnem("clc", 1, "\x98", "\xff"))
->help("Clear Carry Bit. (rel)")
->example("clc");
insert(mnem("cli", 1, "\x9a", "\xff"))
->help("Clear Int Mask. (rel)")
->example("cli");
insert(mnem("clr", 2, "\x3f\x00", "\xff\x00"))
->help("Clear. (dir)")
->example("clr @0xff")
->abs("\x00\xff");
insert(mnem("clr", 1, "\x4f", "\xff"))
->help("Clear. (inh)")
->example("clr a")
->regname("a");
insert(mnem("clr", 1, "\x5f", "\xff"))
->help("Clear. (inh)")
->example("clr x")
->regname("x");
insert(mnem("clr", 2, "\x6f\x00", "\xff\x00"))
->help("Clear. (ix1)")
->example("clr @0xff, x")
->absx("\x00\xff");
insert(mnem("clr", 1, "\x7f", "\xff"))
->help("Clear. (ix)")
->example("clr @x")
->regnameind("x");
insert(mnem("cmp", 2, "\xa1\x00", "\xff\x00"))
->help("Compare to Accumulator. (imm)")
->example("cmp #0xff")
->imm("\x00\xff");
insert(mnem("cmp", 2, "\xb1\x00", "\xff\x00"))
->help("Compare to Accumulator. (dir)")
->example("cmp @0xff")
->abs("\x00\xff");
insert(mnem("cmp", 3, "\xc1\x00\x00", "\xff\x00\x00"))
->help("Compare to Accumulator. (ext)")
->example("cmp @0xffff")
->abs("\x00\xff\xff");
insert(mnem("cmp", 3, "\xd1\x00\x00", "\xff\x00\x00"))
->help("Compare to Accumulator. (ix2)")
->example("cmp @0xffff, x")
->absx("\x00\xff\xff");
insert(mnem("cmp", 2, "\xe1\x00", "\xff\x00"))
->help("Compare to Accumulator. (ix1)")
->example("cmp @0xff, x")
->absx("\x00\xff");
insert(mnem("cmp", 1, "\xf1", "\xff"))
->help("Compare to Accumulator. (ix)")
->example("cmp @x")
->regnameind("x");
insert(mnem("com", 2, "\x33\x00", "\xff\x00"))
->help("One's Complement. (dir)")
->example("com @0xff")
->abs("\x00\xff");
insert(mnem("com", 1, "\x43", "\xff"))
->help("One's Complement. (inh)")
->example("com a")
->regname("a");
insert(mnem("com", 1, "\x53", "\xff"))
->help("One's Complement. (inh)")
->example("com x")
->regname("x");
insert(mnem("com", 2, "\x63\x00", "\xff\x00"))
->help("One's Complement. (ix1)")
->example("com @0xff, x")
->absx("\x00\xff");
insert(mnem("com", 1, "\x73", "\xff"))
->help("One's Complement. (ix)")
->example("com @x")
->regnameind("x");
insert(mnem("cpx", 2, "\xa3\x00", "\xff\x00"))
->help("Compare to X. (imm)")
->example("cpx #0xff")
->imm("\x00\xff");
insert(mnem("cpx", 2, "\xb3\x00", "\xff\x00"))
->help("Compare to X. (dir)")
->example("cpx @0xff")
->abs("\x00\xff");
insert(mnem("cpx", 3, "\xc3\x00\x00", "\xff\x00\x00"))
->help("Compare to X. (ext)")
->example("cpx @0xffff")
->abs("\x00\xff\xff");
insert(mnem("cpx", 3, "\xd3\x00\x00", "\xff\x00\x00"))
->help("Compare to X. (ix2)")
->example("cpx @0xffff, x")
->absx("\x00\xff\xff");
insert(mnem("cpx", 2, "\xe3\x00", "\xff\x00"))
->help("Compare to X. (ix1)")
->example("cpx @0xff, x")
->absx("\x00\xff");
insert(mnem("cpx", 1, "\xf3", "\xff"))
->help("Compare to X. (ix)")
->example("cpx @x")
->regnameind("x");
insert(mnem("dec", 2, "\x3a\x00", "\xff\x00"))
->help("Decrement. (dir)")
->example("dec @0xff")
->abs("\x00\xff");
insert(mnem("dec", 1, "\x4a", "\xff"))
->help("Decrement. (inh)")
->example("dec a")
->regname("a");
insert(mnem("dec", 1, "\x5a", "\xff"))
->help("Decrement. (inh)")
->example("dec x")
->regname("x");
insert(mnem("dec", 2, "\x6a\x00", "\xff\x00"))
->help("Decrement. (ix1)")
->example("dec @0xff, x")
->absx("\x00\xff");
insert(mnem("dec", 1, "\x7a", "\xff"))
->help("Decrement. (ix)")
->example("dec @x")
->regnameind("x");
//Sheet 3.
insert(mnem("eor", 2, "\xa8\x00", "\xff\x00"))
->help("Exclusive OR Accumulator. (imm)")
->example("eor #0xff")
->imm("\x00\xff");
insert(mnem("eor", 2, "\xb8\x00", "\xff\x00"))
->help("Exclusive OR Accumulator. (dir)")
->example("eor @0xff")
->abs("\x00\xff");
insert(mnem("eor", 3, "\xc8\x00\x00", "\xff\x00\x00"))
->help("Exclusive OR Accumulator. (ext)")
->example("eor @0xffff")
->abs("\x00\xff\xff");
insert(mnem("eor", 3, "\xd8\x00\x00", "\xff\x00\x00"))
->help("Exclusive OR Accumulator. (ix2)")
->example("eor @0xffff, x")
->absx("\x00\xff\xff");
insert(mnem("eor", 2, "\xe8\x00", "\xff\x00"))
->help("Exclusive OR Accumulator. (ix1)")
->example("eor @0xff, x")
->absx("\x00\xff");
insert(mnem("eor", 1, "\xf8", "\xff"))
->help("Exclusive OR Accumulator. (ix)")
->example("eor @x")
->regnameind("x");
insert(mnem("inc", 2, "\x3c\x00", "\xff\x00"))
->help("Increment. (dir)")
->example("inc @0xff")
->abs("\x00\xff");
insert(mnem("inc", 1, "\x4c", "\xff"))
->help("Increment. (inh)")
->example("inc a")
->regname("a");
insert(mnem("inc", 1, "\x5c", "\xff"))
->help("Increment. (inh)")
->example("inc x")
->regname("x");
insert(mnem("inc", 2, "\x6c\x00", "\xff\x00"))
->help("Increment. (ix1)")
->example("inc @0xff, x")
->absx("\x00\xff");
insert(mnem("inc", 1, "\x7c", "\xff"))
->help("Increment. (ix)")
->example("inc @x")
->regnameind("x");
// AC opcode is not a jump.
insert(mnem("jmp", 2, "\xbc\x00", "\xff\x00"))
->help("Unconditional Jump. (dir)")
->example("jmp 0xff")
->adr("\x00\xff");
insert(mnem("jmp", 3, "\xcc\x00\x00", "\xff\x00\x00"))
->help("Unconditional Jump. (ext)")
->example("jmp 0xffff")
->adr("\x00\xff\xff");
insert(mnem("jmp", 3, "\xdc\x00\x00", "\xff\x00\x00"))
->help("Unconditional Jump. (ix2)")
->example("jmp @0xffff, x")
->absx("\x00\xff\xff");
insert(mnem("jmp", 2, "\xec\x00", "\xff\x00"))
->help("Unconditional Jump. (ix1)")
->example("jmp @0xff, x")
->absx("\x00\xff");
insert(mnem("jmp", 1, "\xfc", "\xff"))
->help("Unconditional Jump. (ix)")
->example("jmp @x")
->regnameind("x");
// AD opcode is not a JSR.
insert(mnem("jsr", 2, "\xbd\x00", "\xff\x00"))
->help("Jump to Subroutine. (dir)")
->example("jsr 0xff")
->adr("\x00\xff");
insert(mnem("jsr", 3, "\xcd\x00\x00", "\xff\x00\x00"))
->help("Jump to Subroutine. (ext)")
->example("jsr 0xffff")
->adr("\x00\xff\xff");
insert(mnem("jsr", 3, "\xdd\x00\x00", "\xff\x00\x00"))
->help("Jump to Subroutine. (ix2)")
->example("jsr @0xffff, x")
->absx("\x00\xff\xff");
insert(mnem("jsr", 2, "\xed\x00", "\xff\x00"))
->help("Jump to Subroutine. (ix1)")
->example("jsr @0xff, x")
->absx("\x00\xff");
insert(mnem("jsr", 1, "\xfd", "\xff"))
->help("Jump to Subroutine. (ix)")
->example("jsr @x")
->regnameind("x");
insert(mnem("lda", 2, "\xa6\x00", "\xff\x00"))
->help("Load Accumulator. (imm)")
->example("lda #0xff")
->imm("\x00\xff");
insert(mnem("lda", 2, "\xb6\x00", "\xff\x00"))
->help("Load Accumulator. (dir)")
->example("lda @0xff")
->abs("\x00\xff");
insert(mnem("lda", 3, "\xc6\x00\x00", "\xff\x00\x00"))
->help("Load Accumulator. (ext)")
->example("lda @0xffff")
->abs("\x00\xff\xff");
insert(mnem("lda", 3, "\xd6\x00\x00", "\xff\x00\x00"))
->help("Load Accumulator. (ix2)")
->example("lda @0xffff, x")
->absx("\x00\xff\xff");
insert(mnem("lda", 2, "\xe6\x00", "\xff\x00"))
->help("Load Accumulator. (ix1)")
->example("lda @0xff, x")
->absx("\x00\xff");
insert(mnem("lda", 1, "\xf6", "\xff"))
->help("Load Accumulator. (ix)")
->example("lda @x")
->regnameind("x");
insert(mnem("ldx", 2, "\xae\x00", "\xff\x00"))
->help("Load Index. (imm)")
->example("ldx #0xff")
->imm("\x00\xff");
insert(mnem("ldx", 2, "\xbe\x00", "\xff\x00"))
->help("Load Index. (dir)")
->example("ldx @0xff")
->abs("\x00\xff");
insert(mnem("ldx", 3, "\xce\x00\x00", "\xff\x00\x00"))
->help("Load Index. (ext)")
->example("ldx @0xffff")
->abs("\x00\xff\xff");
insert(mnem("ldx", 3, "\xde\x00\x00", "\xff\x00\x00"))
->help("Load Index. (ix2)")
->example("ldx @0xffff, x")
->absx("\x00\xff\xff");
insert(mnem("ldx", 2, "\xee\x00", "\xff\x00"))
->help("Load Index. (ix1)")
->example("ldx @0xff, x")
->absx("\x00\xff");
insert(mnem("ldx", 1, "\xfe", "\xff"))
->help("Load Index. (ix)")
->example("ldx @x")
->regnameind("x");
//Same as ASL, because we're shifting into the carry bit.
insert(mnem("lsl", 2, "\x38\x00", "\xff\x00"))
->help("Logical Shift Left. (dir)")
->example("lsl @0xff")
->prioritize() // Above ASL.
->abs("\x00\xff");
insert(mnem("lsl", 1, "\x48", "\xff"))
->help("Logical Shift Left. (inh)")
->example("lsl a")
->prioritize() // Above ASL.
->regname("a");
insert(mnem("lsl", 1, "\x58", "\xff"))
->help("Logical Shift Left. (inh)")
->example("lsl x")
->prioritize() // Above ASL.
->regname("x");
insert(mnem("lsl", 2, "\x68\x00", "\xff\x00"))
->help("Logical Shift Left. (ix1)")
->example("lsl @0xff, x")
->prioritize() // Above ASL.
->absx("\x00\xff");
insert(mnem("lsl", 1, "\x78", "\xff"))
->help("Logical Shift Left. (ix)")
->example("lsl @x")
->prioritize() // Above ASL.
->regnameind("x");
insert(mnem("lsr", 2, "\x34\x00", "\xff\x00"))
->help("Logical Shift Right. (dir)")
->example("lsr @0xff")
->abs("\x00\xff");
insert(mnem("lsr", 1, "\x44", "\xff"))
->help("Logical Shift Right. (inh)")
->example("lsr a")
->regname("a");
insert(mnem("lsr", 1, "\x54", "\xff"))
->help("Logical Shift Right. (inh)")
->example("lsr x")
->regname("x");
insert(mnem("lsr", 2, "\x64\x00", "\xff\x00"))
->help("Logical Shift Right. (ix1)")
->example("lsr @0xff, x")
->absx("\x00\xff");
insert(mnem("lsr", 1, "\x74", "\xff"))
->help("Logical Shift Right. (ix)")
->example("lsr @x")
->regnameind("x");
//FIXME: This is in ST16CF54, not classic 6805.
insert(mnem("mul", 1, "\x42", "\xff"))
->help("Multiply. (ix)")
->example("mul x, a")
->regname("x")
->regname("a");
insert(mnem("neg", 2, "\x30\x00", "\xff\x00"))
->help("Negate with Two's Complement. (dir)")
->example("neg @0xff")
->abs("\x00\xff");
insert(mnem("neg", 1, "\x40", "\xff"))
->help("Negate with Two's Complement. (inh)")
->example("neg a")
->regname("a");
insert(mnem("neg", 1, "\x50", "\xff"))
->help("Negate with Two's Complement. (inh)")
->example("neg x")
->regname("x");
insert(mnem("neg", 2, "\x60\x00", "\xff\x00"))
->help("Negate with Two's Complement. (ix1)")
->example("neg @0xff, x")
->absx("\x00\xff");
insert(mnem("neg", 1, "\x70", "\xff"))
->help("Negate with Two's Complement. (ix)")
->example("neg @x")
->regnameind("x");
insert(mnem("nop", 1, "\x9d", "\xff"))
->help("No Operation.")
->example("nop");
insert(mnem("ora", 2, "\xaa\x00", "\xff\x00"))
->help("Inclusive OR Accumulator. (imm)")
->example("ora #0xff")
->imm("\x00\xff");
insert(mnem("ora", 2, "\xba\x00", "\xff\x00"))
->help("Inclusive OR Accumulator. (dir)")
->example("ora @0xff")
->abs("\x00\xff");
insert(mnem("ora", 3, "\xca\x00\x00", "\xff\x00\x00"))
->help("Inclusive OR Accumulator. (ext)")
->example("ora @0xffff")
->abs("\x00\xff\xff");
insert(mnem("ora", 3, "\xda\x00\x00", "\xff\x00\x00"))
->help("Inclusive OR Accumulator. (ix2)")
->example("ora @0xffff, x")
->absx("\x00\xff\xff");
insert(mnem("ora", 2, "\xea\x00", "\xff\x00"))
->help("Inclusive OR Accumulator. (ix1)")
->example("ora @0xff, x")
->absx("\x00\xff");
insert(mnem("ora", 1, "\xfa", "\xff"))
->help("Inclusive OR Accumulator. (ix)")
->example("ora @x")
->regnameind("x");
insert(mnem("rol", 2, "\x39\x00", "\xff\x00"))
->help("Rotate Left Through Carry. (dir)")
->example("rol @0xff")
->abs("\x00\xff");
insert(mnem("rol", 1, "\x49", "\xff"))
->help("Rotate Left Through Carry. (inh)")
->example("rol a")
->regname("a");
insert(mnem("rol", 1, "\x59", "\xff"))
->help("Rotate Left Through Carry. (inh)")
->example("rol x")
->regname("x");
insert(mnem("rol", 2, "\x69\x00", "\xff\x00"))
->help("Rotate Left Through Carry. (ix1)")
->example("rol @0xff, x")
->absx("\x00\xff");
insert(mnem("rol", 1, "\x79", "\xff"))
->help("Rotate Left Through Carry. (ix)")
->example("rol @x")
->regnameind("x");
insert(mnem("ror", 2, "\x36\x00", "\xff\x00"))
->help("Rotate Right Through Carry. (dir)")
->example("ror @0xff")
->abs("\x00\xff");
insert(mnem("ror", 1, "\x46", "\xff"))
->help("Rotate Right Through Carry. (inh)")
->example("ror a")
->regname("a");
insert(mnem("ror", 1, "\x56", "\xff"))
->help("Rotate Right Through Carry. (inh)")
->example("ror x")
->regname("x");
insert(mnem("ror", 2, "\x66\x00", "\xff\x00"))
->help("Rotate Right Through Carry. (ix1)")
->example("ror @0xff, x")
->absx("\x00\xff");
insert(mnem("ror", 1, "\x76", "\xff"))
->help("Rotate Right Through Carry. (ix)")
->example("ror @x")
->regnameind("x");
insert(mnem("rsp", 1, "\x9c", "\xff"))
->help("Reset Stack Pointer.")
->example("rsp");
insert(mnem("rti", 1, "\x80", "\xff"))
->help("Return from Interrupt.")
->example("rti");
insert(mnem("rts", 1, "\x81", "\xff"))
->help("Return from Subroutine.")
->example("rts");
insert(mnem("sbc", 2, "\xa2\x00", "\xff\x00"))
->help("Subtract and Carry from A. (imm)")
->example("sbc #0xff")
->imm("\x00\xff");
insert(mnem("sbc", 2, "\xb2\x00", "\xff\x00"))
->help("Subtract and Carry from A. (dir)")
->example("sbc @0xff")
->abs("\x00\xff");
insert(mnem("sbc", 3, "\xc2\x00\x00", "\xff\x00\x00"))
->help("Subtract and Carry from A. (ext)")
->example("sbc @0xffff")
->abs("\x00\xff\xff");
insert(mnem("sbc", 3, "\xd2\x00\x00", "\xff\x00\x00"))
->help("Subtract and Carry from A. (ix2)")
->example("sbc @0xffff, x")
->absx("\x00\xff\xff");
insert(mnem("sbc", 2, "\xe2\x00", "\xff\x00"))
->help("Subtract and Carry from A. (ix1)")
->example("sbc @0xff, x")
->absx("\x00\xff");
insert(mnem("sbc", 1, "\xf2", "\xff"))
->help("Subtract and Carry from A. (ix)")
->example("sbc @x")
->regnameind("x");
insert(mnem("sec", 1, "\x99", "\xff"))
->help("Set Carry Bit.")
->example("sec");
insert(mnem("sei", 1, "\x9b", "\xff"))
->help("Set Interrupt Mask.")
->example("sei");
//A7 opcode is not STA.
insert(mnem("sta", 2, "\xb7\x00", "\xff\x00"))
->help("Store Accumulator. (dir)")
->example("sta @0xff")
->abs("\x00\xff");
insert(mnem("sta", 3, "\xc7\x00\x00", "\xff\x00\x00"))
->help("Store Accumulator. (ext)")
->example("sta @0xffff")
->abs("\x00\xff\xff");
insert(mnem("sta", 3, "\xd7\x00\x00", "\xff\x00\x00"))
->help("Store Accumulator. (ix2)")
->example("sta @0xffff, x")
->absx("\x00\xff\xff");
insert(mnem("sta", 2, "\xe7\x00", "\xff\x00"))
->help("Store Accumulator. (ix1)")
->example("sta @0xff, x")
->absx("\x00\xff");
insert(mnem("sta", 1, "\xf7", "\xff"))
->help("Store Accumulator. (ix)")
->example("sta @x")
->regnameind("x");
//Stop
insert(mnem("stop", 1, "\x8e", "\xff"))
->help("Enable !IRQ, stop oscilator.")
->example("stop");
//STX
insert(mnem("stx", 2, "\xbf\x00", "\xff\x00"))
->help("Store Index. (dir)")
->example("stx @0xff")
->abs("\x00\xff");
insert(mnem("stx", 3, "\xcf\x00\x00", "\xff\x00\x00"))
->help("Store Index. (ext)")
->example("stx @0xffff")
->abs("\x00\xff\xff");
insert(mnem("stx", 3, "\xdf\x00\x00", "\xff\x00\x00"))
->help("Store Index. (ix2)")
->example("stx @0xffff, x")
->absx("\x00\xff\xff");
insert(mnem("stx", 2, "\xef\x00", "\xff\x00"))
->help("Store Index. (ix1)")
->example("stx @0xff, x")
->absx("\x00\xff");
insert(mnem("stx", 1, "\xff", "\xff"))
->help("Store Index. (ix)")
->example("stx @x")
->regnameind("x");
insert(mnem("sub", 2, "\xa0\x00", "\xff\x00"))
->help("Subtract from A. (imm)")
->example("sub #0xff")
->imm("\x00\xff");
insert(mnem("sub", 2, "\xb0\x00", "\xff\x00"))
->help("Subtract from A. (dir)")
->example("sub @0xff")
->abs("\x00\xff");
insert(mnem("sub", 3, "\xc0\x00\x00", "\xff\x00\x00"))
->help("Subtract from A. (ext)")
->example("sub @0xffff")
->abs("\x00\xff\xff");
insert(mnem("sub", 3, "\xd0\x00\x00", "\xff\x00\x00"))
->help("Subtract from A. (ix2)")
->example("sub @0xffff, x")
->absx("\x00\xff\xff");
insert(mnem("sub", 2, "\xe0\x00", "\xff\x00"))
->help("Subtract from A. (ix1)")
->example("sub @0xff, x")
->absx("\x00\xff");
insert(mnem("sub", 1, "\xf0", "\xff"))
->help("Subtract from A. (ix)")
->example("sub @x")
->regnameind("x");
insert(mnem("swi", 1, "\x83", "\xff"))
->help("Software Interrupt.")
->example("swi");
insert(mnem("tax", 1, "\x97", "\xff"))
->help("Transfer A to X.")
->example("tax");
insert(mnem("tst", 2, "\x3d\x00", "\xff\x00"))
->help("Test for Negative or Zero. (dir)")
->example("tst @0xff")
->abs("\x00\xff");
insert(mnem("tst", 1, "\x4d", "\xff"))
->help("Test for Negative or Zero. (inh)")
->example("tst a")
->regname("a");
insert(mnem("tst", 1, "\x5d", "\xff"))
->help("Test for Negative or Zero. (inh)")
->example("tst x")
->regname("x");
insert(mnem("tst", 2, "\x6d\x00", "\xff\x00"))
->help("Test for Negative or Zero. (ix1)")
->example("tst @0xff, x")
->absx("\x00\xff");
insert(mnem("tst", 1, "\x7d", "\xff"))
->help("Test for Negative or Zero. (ix)")
->example("tst @x")
->regnameind("x");
insert(mnem("txa", 1, "\x9f", "\xff"))
->help("Transfer X to A.")
->example("txa");
insert(mnem("wait", 1, "\x8f", "\xff"))
->help("Enable Interrupts and Halt CPU.")
->example("wait");
}