-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.X68
More file actions
2767 lines (2143 loc) · 82.3 KB
/
Main.X68
File metadata and controls
2767 lines (2143 loc) · 82.3 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
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
*--------------------------------------------------------------------------
* Title : Disassembler (Some Assembly Required)
* Written by : Cody Stuck, Ardalan Ahanchi, Natallia Ustsiamchuk
* Date : March 17, 2019
*---------------------------------------------------------------------------
ORG $1000 *Don't change this.
*---------------------------------------------------------------------------
START:
*********************************************************************************
********************************* I/O Section ***********************************
*********************************************************************************
*Reads the starting and ending address into A6 and A4 respectively.
readConfigFile
LEA inputFile,A1 *Load the file to read
MOVE #51,D0 *Open the file
TRAP #15
MOVE.L #filesize, D2 *attemp to read 80 bytes
LEA addressbuff, A1
MOVE.L #53, D0 *Reading a file
TRAP #15 *Gets content
MOVE.L #0, D7 *Read the starting address into A6.
JSR AsciiToHex
MOVE.L D7, A6
CMPI.W #$0D0A, (A1)+ *Check for newline.
BNE invalidConfig
MOVE.L #0, D7 *Read ending address into A4.
JSR AsciiToHex
MOVE.L D7, A4
*Main loop which does the decoding.
mainloop
CMPA A4,A6
BGT endmainloop
MOVE.B #0,D6 *Reset bad flag
MOVEA #printbuff,A5 *Reset printbuff
JSR printAddress
JSR identifyOPCODE
CMP.B #1,D6 *Check if the badflag is set.
BEQ badbuff
MOVE.B #0,(A5)
MOVEA #printbuff,A1
JSR TrapTask13
JMP mainloop
*Comes here when the badflag is set.
badbuff
MOVEA #printbuff,A5 *Reset printbuff
JSR printAddress
MOVE.B #' ',(A5)+ *Print the data keyword.
MOVE.B #'D',(A5)+
MOVE.B #'A',(A5)+
MOVE.B #'T',(A5)+
MOVE.B #'A',(A5)+
MOVE.B #' ',(A5)+
MOVE.W -(A6), D4 *print Instruction.
ADDA #2, A6
MOVE.B #'$', (A5)+
MOVE.B #0, D3
printInstructionLoop
CMP.B #4, D3 *Check if we've read 4 nibbles.
BEQ printInstructionLoop_done
ROL.W #4, D4 *Rotate, get the first nibble and store in D4.
MOVE.B D4, D5
AND.B firstNibble, D5
JSR hexToAscii *Get the ASCII value.
MOVE.B D5, (A5)+ *Add the new ASCII byte to the output.
ADD.B #1, D3 *Increase the counter.
JMP printInstructionLoop
printInstructionLoop_done
MOVE.B #' ', (A5)+
MOVE.B #0,(A5)
MOVEA #printbuff,A1 *Print the data.
JSR TrapTask13
JMP mainloop
*Comes here when there is an error reading the config file, or invalid addresses are
*given to the program (If ending address < starting address).
invalidConfig
SIMHALT
*Last part of the program.
endmainloop
SIMHALT
*********************************************************************************
* Method Name: printAddress
* Description: Prints the address of A6 in to the output buffer specified in A5.
*
* Preconditions: A6 should contain the address to print.
* A5 Should contain the pointer to the next space in good buffer.
*
* Postconditions: A5 will contain the pointer to the next space in the good buffer
*
* MODIFIES: A6
* A5
*********************************************************************************
printAddress:
MOVEM.L D1-D7, -(SP) *Save the status of the registers.
MOVE.L A6, D4 *print address
MOVE.B #'$', (A5)+
MOVE.B #0, D3
printAddressLoop
CMP.B #8, D3 *Check if we've read 8 nibbles.
BEQ printAddressLoop_done
ROL.L #4, D4 *Rotate, get the first nibble and store in D4.
MOVE.B D4, D5
AND.B firstNibble, D5
JSR hexToAscii *Get the ASCII value.
MOVE.B D5, (A5)+ *Add the new ASCII byte to the output.
ADD.B #1, D3 *Increase the counter.
JMP printAddressLoop
printAddressLoop_done
MOVE.B #' ', (A5)+
MOVEM.L (SP)+, D1-D7 *Restore the registers.
RTS
*********************************************************************************
******************************* OP Code Section *********************************
*********************************************************************************
*********************************************************************************
* Method Name: identifyOPCODE
* Description: Attempts to decode an opcode by first examining the first nibble,
* then branching off to identify opcode
*
* Preconditions: A6 should contain the pointer to the opcode.
* A5 Should contain the pointer to the next space in good buffer.
* D6 should contain the good/bad flag.
*
* Postconditions: A5 will contain the pointer to the next space in the good buffer
* D6 will contain the good/bad flag
* D7 will contain mode and register bits
*
* MODIFIES: D3
*********************************************************************************
identifyOPCODE:
*****IDENTIFY FIRST NIBBLE*****
MOVE.W (A6),D3 *move opcode to D3
CMP.W RTS,D3 *check if the OP is rts
BEQ dRTS
CMP.W RESET,D3 *check if the OP is RESET
BEQ dRESET
CMP.W NOP,D3 *check if the OP is NOP
BEQ dNOP
AND.W isolateNibbleMask,D3 *isolate nibble by clearing the rest of the bits
* check the first nibble and jump to the proper jumptable for that prefix
CMP.W chk0000,D3 *0000
BEQ ident0000
CMP.W chk0100,D3 *0100
BEQ ident0100
CMP.W chk0101,D3 *0101
BEQ ident0101
CMP.W chk0110,D3 *0110
BEQ ident0110
CMP.W chk1000,D3 *1000
BEQ ident1000
CMP.W chk1001,D3 *1001
BEQ ident1001
CMP.W chk1011,D3 *1011
BEQ ident1011
CMP.W chk1100,D3 *1100
BEQ ident1100
CMP.W chk1101,D3 *1101
BEQ ident1101
CMP.W chk0001,D3 *MOVE_A.B
BEQ identMOVE_A
CMP.W chk0011,D3 *MOVE_A.W
BEQ identMOVE_A
CMP.W chk0010,D3 *MOVE_A.L
BEQ identMOVE_A
CMP.W chk1110,D3 *SHIFT/ROTATE OP
BEQ identREGMEM
JMP ddata *data
*****IDENTIFY OPCODE FROM NIBBLE*****
ident0000 * is this ORI/CMPI/BCLR
MOVE.W (A6),D3 *move the full opcode back into D3
* ORI?
AND.W ORIISO,D3 *clear irrelevant bits
CMP.W ORICHK,D3 *compare to identity
BEQ dORI *match?
MOVE (A6),D3 *move the full opcode back into D3
* CMPI?
AND.W CMPIISO,D3 *clear irrelevant bits
CMP.W CMPICHK,D3 *compare to identity
BEQ dCMPI *match?
MOVE.W (A6),D3 *move the full opcode back into D3
* BCLR_SA?
AND.W BCLR_SA_ISO,D3 *clear irrelevant bits
CMP.W BCLR_SA_CHK,D3 *compare to identity
BEQ dBCLR_SA *match?
MOVE.W (A6),D3 *move the full opcode back into D3
* BCLR_D?
AND.W BCLR_D_ISO,D3 *clear irrelevant bits
CMP.W BCLR_D_CHK,D3 *compare to identity
BEQ dBCLR_D *match?
MOVE.W (A6),D3 *move the full opcode back into D3
JMP ddata *could not identify
ident0100 * is this NEG/RTS/JSR/MOVEM/LEA
MOVE.W (A6),D3 *move the full opcode back into D3
*RTS has already been checked
* NEG?
AND.W NEGISO,D3 *clear irrelevant bits
CMP.W NEGCHK,D3 *compare to identity
BEQ dNEG *match?
MOVE.W (A6),D3 *move the full opcode back into D3
* JSR?
AND.W JSRISO,D3 *clear irrelevant bits
CMP.W JSRCHK,D3 *compare to identity
BEQ dJSR *match?
MOVE.W (A6),D3 *move the full opcode back into D3
* MOVEM?
AND.W MOVEMISO,D3 *clear irrelevant bits
CMP.W MOVEMCHK,D3 *compare to identity
BEQ dMOVEM *match?
MOVE.W (A6),D3 *move the full opcode back into D3
* LEA?
AND.W LEAISO,D3 *clear irrelevant bits
CMP.W LEACHK,D3 *compare to identity
BEQ dLEA *match?
MOVE.W (A6),D3 *move the full opcode back into D3
JMP ddata *could not identify
ident0101 * is this SUBQ
MOVE.W (A6),D3 *move the full opcode back into D3
* SUBQ?
AND.W SUBQISO,D3 *clear irrelevant bits
CMP.W SUBQCHK,D3 *compare to identity
BEQ dSUBQ *match?
MOVE.W (A6),D3 *move the full opcode back into D3
JMP ddata *could not identify
ident0110 * is this BRA/BCS/BGE/BLT/BVC
MOVE.W (A6),D3 *move the full opcode back into D3
* BRA?
AND.W BCCISO,D3 *clear irrelevant bits
CMP.W BRACHK,D3 *compare to identity
BEQ dBRA *match?
MOVE.W (A6),D3 *move the full opcode back into D3
* BCS?
AND.W BCCISO,D3 *clear irrelevant bits
CMP.W BCSCHK,D3 *compare to identity
BEQ dBCS *match?
MOVE.W (A6),D3 *move the full opcode back into D3
* BGE?
AND.W BCCISO,D3 *clear irrelevant bits
CMP.W BGECHK,D3 *compare to identity
BEQ dBGE *match?
MOVE.W (A6),D3 *move the full opcode back into D3
* BLT?
AND.W BCCISO,D3 *clear irrelevant bits
CMP.W BLTCHK,D3 *compare to identity
BEQ dBLT *match?
MOVE.W (A6),D3 *move the full opcode back into D3
* BVC?
AND.W BCCISO,D3 *clear irrelevant bits
CMP.W BVCCHK,D3 *compare to identity
BEQ dBVC *match?
MOVE.W (A6),D3 *move the full opcode back into D3
JMP ddata *could not identify
ident1000 * is this DIVS/OR
MOVE.W (A6),D3 *move the full opcode back into D3
* DIVS?
AND.W DIVSISO,D3 *clear irrelevant bits
CMP.W DIVSCHK,D3 *compare to identity
BEQ dDIVS *match?
MOVE.W (A6),D3 *move the full opcode back into D3
* assume OR
JMP dOR
JMP ddata *could not identify
ident1001 * is this SUB
MOVE.W (A6),D3 *move the full opcode back into D3
* assume SUB
JMP dSUB
JMP ddata *could not identify
ident1011 * is this EOR/CMP
MOVE.W (A6),D3 *move the full opcode back into D3
* EOR?
AND.W EORISO,D3 *clear irrelevant bits
CMP.W EORCHK,D3 *compare to identity
BEQ dEOR *match?
MOVE.W (A6),D3 *move the full opcode back into D3
* assume CMP
JMP dCMP
JMP ddata
ident1100 * is this MULS
MOVE.W (A6),D3 *move the full opcode back into D3
* MULS?
AND.W MULSISO,D3 *clear irrelevant bits
CMP.W MULSCHK,D3 *compare to identity
BEQ dMULS *match?
MOVE.W (A6),D3 *move the full opcode back into D3
JMP ddata *could not identify
ident1101 * is this ADD/ADDA
MOVE.W (A6),D3 *move the full opcode back into D3
AND.W ADDAISO,D3 *clear irrelevant bits
CMP.W ADDACHK,D3 *compare to identity
BEQ dADDA *match?
MOVE.W (A6),D3 *move the full opcode back into D3
* assume ADD
JMP dADD
JMP ddata
identMOVE_A *is this MOVE/MOVEA
MOVE.W (A6),D3
* MOVEA?
AND.W MOVEAISO,D3 *clear irrelevant bits
CMP.W MOVEACHK,D3 *compare to identity
BEQ dMOVEA
* ASSUME MOVE
JMP dMOVE
identREGMEM *is this a register or memory shift/rotate
MOVE.W (A6),D3
* mem?
AND.W SHIFTROTMEMCHK,D3 *clear irrelevant bits
CMP.W SHIFTROTMEMCHK,D3 *compare to identity
BEQ identSHIFTROTMEM
* ASSUME REG
JMP identSHIFTROTREG
identSHIFTROTMEM
MOVE.W (A6),D3
*ASD?
AND.W MEMSHIFTORROTISO,D3
CMP.W MEMASDCHK,D3
BEQ dMEM_ASD
*LSD?
AND.W MEMSHIFTORROTISO,D3
CMP.W MEMLSDCHK,D3
BEQ dMEM_LSD
*ROD?
AND.W MEMSHIFTORROTISO,D3
CMP.W MEMRODCHK,D3
BEQ dMEM_ROD
JMP ddata
identSHIFTROTREG
MOVE.W (A6),D3
*ASD?
AND.W REGSHIFTORROTISO,D3
CMP.W REGASDCHK,D3
BEQ dREG_ASD
*LSD?
AND.W REGSHIFTORROTISO,D3
CMP.W REGLSDCHK,D3
BEQ dREG_LSD
*ROD?
AND.W REGSHIFTORROTISO,D3
CMP.W REGRODCHK,D3
BEQ dREG_ROD
JMP ddata
*****OPCODE IDENTIFIED*****
dMEM_ASD *this is mem ASD
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'A',(A5)+
MOVE.B #'S',(A5)+
JSR identDIRECTION
JSR EApi_Xn
JMP endIdent
dMEM_LSD *this is mem LSD
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'L',(A5)+
MOVE.B #'S',(A5)+
JSR identDIRECTION
JSR EApi_Xn
JMP endIdent
dMEM_ROD *this is mem ROD
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'R',(A5)+
MOVE.B #'O',(A5)+
JSR identDIRECTION
JSR EApi_Xn
JMP endIdent
dREG_ASD *this is reg ASD
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'A',(A5)+
MOVE.B #'S',(A5)+
JSR identDIRECTION
JSR identifyOPSIZE *identify size of operation and add to buffer
JSR EApi_Data_Dn
JMP endIdent
dREG_LSD *this is reg LSD
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'L',(A5)+
MOVE.B #'S',(A5)+
JSR identDIRECTION
JSR identifyOPSIZE *identify size of operation and add to buffer
JSR EApi_Data_Dn
JMP endIdent
dREG_ROD *this is reg ROD
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'R',(A5)+
MOVE.B #'O',(A5)+
JSR identDIRECTION
JSR identifyOPSIZE *identify size of operation and add to buffer
JSR EApi_Data_Dn
JMP endIdent
dMOVEA *this is MOVEA
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'M',(A5)+
MOVE.B #'O',(A5)+
MOVE.B #'V',(A5)+
MOVE.B #'E',(A5)+
MOVE.B #'A',(A5)+
JSR identifyMOVE_ASIZE
JSR EApi_An_Xn *Decode and Print EA.
JMP endIdent
dMOVE *this is MOVE
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'M',(A5)+
MOVE.B #'O',(A5)+
MOVE.B #'V',(A5)+
MOVE.B #'E',(A5)+
JSR identifyMOVE_ASIZE
JSR EApi_Xn_Xn *Decode and Print EA.
JMP endIdent
dRTS *this is RTS
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'R',(A5)+
MOVE.B #'T',(A5)+
MOVE.B #'S',(A5)+
JSR increaseOpPtr
JMP endIdent
dNOP *this is NOP
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'N',(A5)+
MOVE.B #'O',(A5)+
MOVE.B #'P',(A5)+
JSR increaseOpPtr
JMP endIdent
dORI *this is ORI
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'O',(A5)+
MOVE.B #'R',(A5)+
MOVE.B #'I',(A5)+
JSR identifyOPSIZE *identify size of operation and add to buffer
JSR EApi_Imd_Xn *Decode and Print EA.
JMP endIdent
dCMPI *this is CMPI
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'C',(A5)+
MOVE.B #'M',(A5)+
MOVE.B #'P',(A5)+
MOVE.B #'I',(A5)+
JSR identifyOPSIZE *identify size of operation and add to buffer
JSR EApi_Imd_Xn *Decode and Print EA.
JMP endIdent
dBCLR_SA *this is BCLR_SA
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'B',(A5)+
MOVE.B #'C',(A5)+
MOVE.B #'L',(A5)+
MOVE.B #'R',(A5)+
JSR EApi_Bclr_SA
JMP endIdent
dBCLR_D *this is BCLR_D
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'B',(A5)+
MOVE.B #'C',(A5)+
MOVE.B #'L',(A5)+
MOVE.B #'R',(A5)+
JSR EApi_Xn_Dn
JMP endIdent
dNEG *this is NEG
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'N',(A5)+
MOVE.B #'E',(A5)+
MOVE.B #'G',(A5)+
JSR identifyOPSIZE *identify size of operation and add to buffer
JSR EApi_Xn *Decode and Print EA.
JMP endIdent
dJSR *this is JSR
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'J',(A5)+
MOVE.B #'S',(A5)+
MOVE.B #'R',(A5)+
JSR EApi_Xn *Decode and Print EA.
JMP endIdent
dMOVEM *this is MOVEM
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'M',(A5)+
MOVE.B #'O',(A5)+
MOVE.B #'V',(A5)+
MOVE.B #'E',(A5)+
MOVE.B #'M',(A5)+
*find and append size
JSR identMOVEMSIZE
JSR EApi_Movem *Decode and Print Movem.
JMP endIdent
dLEA *this is LEA
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'L',(A5)+
MOVE.B #'E',(A5)+
MOVE.B #'A',(A5)+
JSR EApi_An_Xn *Decode and Print EA.
JMP endIdent
dSUBQ *this is SUBQ
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'S',(A5)+
MOVE.B #'U',(A5)+
MOVE.B #'B',(A5)+
MOVE.B #'Q',(A5)+
JSR identifyOPSIZE *identify size of operation and add to buffer
JSR EApi_Data_Xn *Decode and Print EA.
JMP endIdent
dBRA *this is BRA
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'B',(A5)+
MOVE.B #'R',(A5)+
MOVE.B #'A',(A5)+
JSR EApi_Displacement
JMP endIdent
dBCS *this is BCS
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'B',(A5)+
MOVE.B #'C',(A5)+
MOVE.B #'S',(A5)+
JSR EApi_Displacement
JMP endIdent
dBGE *this is BGE
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'B',(A5)+
MOVE.B #'G',(A5)+
MOVE.B #'E',(A5)+
JSR EApi_Displacement
JMP endIdent
dBLT *this is BTL
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'B',(A5)+
MOVE.B #'T',(A5)+
MOVE.B #'L',(A5)+
JSR EApi_Displacement
JMP endIdent
dBVC *this is BVC
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'B',(A5)+
MOVE.B #'V',(A5)+
MOVE.B #'C',(A5)+
JSR EApi_Displacement
JMP endIdent
dDIVS *this is DIVS
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'D',(A5)+
MOVE.B #'I',(A5)+
MOVE.B #'V',(A5)+
MOVE.B #'S',(A5)+
JSR EApi_Dn_Xn *Decode and Print EA.
JMP endIdent
dOR *this is OR
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'O',(A5)+
MOVE.B #'R',(A5)+
JSR identifyOPSIZE *identify size of operation and add to buffer
JSR EApi_Dn_Xn *Decode and Print EA.
JMP endIdent
dSUB *this is SUB
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'S',(A5)+
MOVE.B #'U',(A5)+
MOVE.B #'B',(A5)+
JSR identifyOPSIZE *identify size of operation and add to buffer
JSR EApi_Dn_Xn *Decode and Print EA.
JMP endIdent
dEOR *this is EOR
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'E',(A5)+
MOVE.B #'O',(A5)+
MOVE.B #'R',(A5)+
JSR identifyOPSIZE *identify size of operation and add to buffer
JSR EApi_Xn_Dn *Decode and Print EA.
JMP endIdent
dCMP *this is CMP
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'C',(A5)+
MOVE.B #'M',(A5)+
MOVE.B #'P',(A5)+
JSR identifyOPSIZE *identify size of operation and add to buffer
JSR EApi_Dn_Xn *Decode and Print EA.
JMP endIdent
dMULS *this is MULS
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'M',(A5)+
MOVE.B #'U',(A5)+
MOVE.B #'L',(A5)+
MOVE.B #'S',(A5)+
JSR EApi_Dn_Xn *Decode and Print EA.
JMP endIdent
dADD *this is ADD
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'A',(A5)+
MOVE.B #'D',(A5)+
MOVE.B #'D',(A5)+
JSR identifyOPSIZE *identify size of operation and add to buffer
JSR EApi_Dn_Xn *Decode and Print EA.
JMP endIdent
dADDA *this is ADDA
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'A',(A5)+
MOVE.B #'D',(A5)+
MOVE.B #'D',(A5)+
MOVE.B #'A',(A5)+
JSR identADDAsize
JSR EApi_An_Xn *Decode and Print EA.
JMP endIdent
ddata *this must be data
*print DATA here maybe?
MOVE.B #1,D6 *set bad flag
JSR increaseOpPtr
JMP endIdent
dRESET *this is RESET
*add to buffer
MOVE.B #' ',(A5)+
MOVE.B #'R',(A5)+
MOVE.B #'E',(A5)+
MOVE.B #'S',(A5)+
MOVE.B #'E',(A5)+
MOVE.B #'T',(A5)+
JSR increaseOpPtr
JMP endIdent
endIdent
RTS
*********************************************************************************
* Method Name: identMOVEMSIZE
* Description: adds the size of the MOVEM operation to the buffer
*
* Preconditions: A5 Should contain the pointer to the next space in good buffer.
* A6 should contain the pointer to the opcode
*
* Postconditions: A5 will contain the pointer to the next space in the good buffer
* the size of the operation will be appended to the buffer
*
* MODIFIES: D3
*********************************************************************************
identMOVEMSIZE:
MOVE (A6),D3 *move the full opcode back into D3
AND.W MOVEMSIZECHK,D3
CMP.W MOVEMSIZECHK,D3
BEQ dMOVEML
JMP dMOVEMW
dMOVEMW
*add to buffer
MOVE.B #'.',(A5)+
MOVE.B #'W',(A5)+
JMP endidentMOVEMSIZE
dMOVEML
*add to buffer
MOVE.B #'.',(A5)+
MOVE.B #'L',(A5)+
JMP endidentMOVEMSIZE
endidentMOVEMSIZE
RTS
*********************************************************************************
* Method Name: identDIRECTION
* Description: adds the direction of the shift/rotation to the buffer
*
* Preconditions: A5 Should contain the pointer to the next space in good buffer.
* A6 should contain the pointer to the opcode
*
* Postconditions: A5 will contain the pointer to the next space in the good buffer
* the size of the operation will be appended to the buffer
*
* MODIFIES: D3
*********************************************************************************
identDIRECTION:
MOVE (A6),D3 *move the full opcode back into D3
AND.W DIRECTIONCHK,D3
CMP.W DIRECTIONCHK,D3
BEQ dirLEFT
JMP dirRIGHT
dirRIGHT
*add to buffer
MOVE.B #'R',(A5)+
JMP endidentDIRECTION
dirLEFT
*add to buffer
MOVE.B #'L',(A5)+
JMP endidentDIRECTION
endidentDIRECTION
RTS
*********************************************************************************
* Method Name: identADDAsize
* Description: adds the size of the ADDA op to the buffer
*
* Preconditions: A5 Should contain the pointer to the next space in good buffer.
* A6 should contain the pointer to the opcode
*
* Postconditions: A5 will contain the pointer to the next space in the good buffer
* the size of the operation will be appended to the buffer
*
* MODIFIES: D3
* D5
************************************************,*********************************
identADDAsize:
MOVE (A6),D3 *move the full opcode back into D3
AND.W ADDASIZECHK,D3
CMP.W ADDASIZECHK,D3
BEQ ADDAL
JMP ADDAW
ADDAW
JSR addWbuff
JMP endidentADDAsize
ADDAL
JSR addLbuff
JMP endidentADDAsize
endidentADDAsize
RTS
*********************************************************************************
* Method Name: addBbuff
* Description: adds B to buff
*
* Preconditions: A5 Should contain the pointer to the next space in good buffer.
*
* Postconditions: A5 will contain the pointer to the next space in the good buffer
* .B will be added to the buffer
* D5 will contain the number of bytes that were last identified.