forked from crsjones/MIKBUG2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmikbug2.lst
1830 lines (1830 loc) · 101 KB
/
mikbug2.lst
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
0001 *
0002 * CONVERTED TO AN ASSEMBLY FILE FROM A CRAPPY PDF BY
0003 * MEMBERS OF THE MOTOROLA 6809 / 6309, 6800 ASSEMBLY
0004 * LANGUAGE PROGRAMMING FACEBOOK GROUP
0005 * BY CRAIG JONES,RAY BELLIS
0006 *
0007
0008 NAM MIKBUG
0009 TTL 2.0 WITH AUDIO CASSETTE
0010 * REV 0
0011 * COPYRIGHT (C) 1977 BY MOTOROLA INC.
0012 *
0013 * MIKBUG (TM) MOTOROLA
0014 *
0015 * AUSTIN, TEXAS
0016 * MICROCOMPUTER CAPITAL OF THE WORLD!
0017 *
0018 * L LOAD
0019 * M MEMORY CHANGE
0020 * P PRINT/PUNCH DUMP
0021 * R DISPLAY CONTENTS OF TARGET STACK
0022 * CC B A X P S
0023 * S 1,SET SPEED FOR 10 CPS
0024 * 3,SET SPEED FOR 30 CPS
0025 * B PRINT OUT ALL BREAKPOINTS
0026 * C CONTINUE EXECUTION FROM CURRENT LOCATION
0027 * N NEXT INSTRUCTION
0028 * T TRACE 'N' INSTRUCTIONS
0029 * G GO TO LOCATION 'N'
0030 * D DELETE ALL BREAKPOINTS
0031 * U RESET BREAKPOINT WITH ADDRESS 'N'
0032 * V SET A BREAKPOINT WITH ADDRESS 'N'
0033 * E EXORTAPE CASSETTE INTERFACE
0034 *
0035 * OPT S,O,LLEN=80,CREF
0036 8008 ACIAS EQU $8008
0037 8009 ACIAD EQU $8009
0038 003f SWI EQU $3F SWI OP CODE
0039 *
0040 f800 ORG $F800
0041 f800 BASORG EQU * BASE ORIGIN
0042 *
0043 * I/O INTERRUPT SEQUENCE
0044 *
0045 f800 fe a0 00 IO LDX IOV
0046 f803 6e 00 JMP 0,X
0047 *
0048 * NMI SEQUENCE
0049 *
0050 f805 fe a0 06 POWDWN LDX NIO GET NMI VECTOR
0051 f808 6e 00 JMP 0,X
0052 *
0053 * SWI INTERRUPT SEQUENCE
0054 *
0055 f80a fe a0 0a SFEI LDX SWI1
0056 f80d 6e 00 JMP 0,X
0057 *
0058 * JUMP TABLE TO ROUTINES PERFORMING MIKBUG FCTN'S
0059 *
0060 f80f FCTABL EQU *
0061 f80f 42 FCC /B/ "B" - PRINT ALL BREAKS
0062 f810 fa 16 FDB PNTBRK
0063 f812 43 FCC /C/ "C" - CONTINUE
0064 f813 fa 54 FDB CONT
0065 f815 44 FCC /D/ "D" - DELETE ALL BREAKS
0066 f816 fa 0b FDB DELBRK
0067 f818 47 FCC /G/ "G" - GO TO ENTERED ADDRESS
0068 f819 fa 25 FDB GOTO
0069 f81b 4c FCC /L/ "L" - LOAD
0070 f81c f8 d0 FDB LOAD
0071 f81e 4d FCC /M/ "M" - MEMORY CHANGE
0072 f81f f9 1d FDB CHANGE
0073 f821 4e FCC /N/ "N" - NEXT (TRACE 1 INSTR)
0074 f822 fa 37 FDB NEXT
0075 f824 50 FCC /P/ "P" - PUNCH
0076 f825 fb 02 FDB PUNCH
0077 f827 52 FCC /R/ "R" - PRINT STACK
0078 f828 fa 5c FDB PSTAK1
0079 f82a 53 FCC /S/ "S" - CHANGE SPEED FOR TTY
0080 f82b f9 fe FDB SPD
0081 f82d 54 FCC /T/ "T" - TRACE N INSTRUCTIONS
0082 f82e fa 50 FDB TRACE
0083 f830 55 FCC /U/ "U" - RESET A BREAKPOINT
0084 f831 fa 11 FDB RSTBRK
0085 f833 45 FCC /E/ "E" - EXORTAPE CASSETT INTERFACE
0086 f834 fd 05 FDB EXORT
0087 f836 56 FCC /V/ "V" - SET A BREAKPOINT
0088 f837 fa 1d FDB SETBRK
0089 f839 FCTBEN EQU *
0090 *
0091 * INITIALIZATION/RESET CODE
0092 *
0093 f839 ADRSTR EQU *
0094 f839 a0 78 FDB STACK INIT FOR "SP"
0095 f83b fb 76 FDB SWI15 INIT FOR "SWI1"
0096 f83d fb a0 FDB BRKINH INIT FOR "SWI2"
0097 *
0098 f83f 20 03 BRA BRG "BRA" INST IS REPLACED BY
0099 f841 7e fb de JMP BRNOGO COND BRA INST IN ROUT.
0100 f844 7e fb e2 BRG JMP BRGO WHICH DETERMINES IF
0101 * BRA IS GO/NOGO
0102 *
0103 * BUILD ADDRESS
0104 *
0105 f847 8d 0c BADDR BSR BYTE READ 2 FRAMES
0106 f849 b7 a0 3e STAA XHI
0107 f84c 8d 07 BSR BYTE
0108 f84e b7 a0 3f STAA XLOW
0109 f851 fe a0 3e LDX XHI (X) ADDRESS WE BUILT
0110 f854 39 RTS
0111 * INPUT BYTE (TWO FRAMES)
0112 f855 8d 53 BYTE BSR INHEX GET HEX CHAR
0113 f857 48 BYTE2 ASLA
0114 f858 48 ASLA
0115 f859 48 ASLA
0116 f85a 48 ASLA
0117 f85b 16 TAB
0118 f85c 8d 4c BSR INHEX
0119 f85e 1b ABA
0120 f85f 16 TAB
0121 f860 fb a0 3c ADDB CKSM
0122 f863 f7 a0 3c STAB CKSM
0123 f866 39 RTS
0124 f867 44 OUTHL LSRA OUT HEX LEFT BCD DIGIT
0125 f868 44 LSRA
0126 f869 44 LSRA
0127 f86a 44 LSRA
0128 f86b 84 0f OUTHR ANDA #$F OUT HEX RIGHT BCD DIGIT
0129 f86d 8b 30 ADDA #$30
0130 f86f 81 39 CMPA #$39
0131 f871 23 02 BLS OUTCH
0132 f873 8b 07 ADDA #$7
0133 * OUTPUT ONE CHAR
0134 f875 7e f9 59 OUTCH JMP OUTCH1
0135 f878 7e f9 66 INCH JMP INCH1
0136 * PRINT DATA POINTED AT BY X-REG
0137 f87b 8d f8 PDATA2 BSR OUTCH
0138 f87d 08 INX
0139 f87e a6 00 PDATA1 LDAA 0,X
0140 f880 81 04 CMPA #4
0141 f882 26 f7 BNE PDATA2
0142 f884 39 RTS STOP ON EOT
0143 *
0144 * INPUT ADDRESS
0145 *
0146 f885 8d 17 GETADD BSR PCRLF PRINT CR LF
0147 f887 ce fc ae LDX #MCL4
0148 f88a 8d f2 BSR PDATA1 ASK FOR BEGADDR
0149 f88c 8d b9 BSR BADDR GET BEG ADDR
0150 f88e ff a0 02 STX BEGA
0151 f891 8d 0b BSR PCRLF PRINT CR LF
0152 f893 ce fc b9 LDX #MCL5
0153 f896 8d e6 BSR PDATA1 ASK FOR END ADDR
0154 f898 8d ad BSR BADDR GET END ADDRESS
0155 f89a ff a0 04 STX ENDA
0156 f89d 39 RTS *
0157 * PRINT CR LF
0158 *
0159 f89e ff a0 3e PCRLF STX XHI SAVE XR
0160 f8a1 ce fc 86 LDX #MCL1
0161 f8a4 8d d8 BSR PDATA1 PRINT CRLF
0162 f8a6 fe a0 3e LDX XHI
0163 f8a9 39 RTS
0164
0165 *
0166 f8aa 8d cc INHEX BSR INCH
0167 f8ac 80 30 INHEX2 SUBA #$30
0168 f8ae 2b 6a BMI C1 NOT HEX
0169 f8b0 81 09 CMPA #$09
0170 f8b2 2f 0a BLE IN1HG
0171 f8b4 81 11 CMPA #$11
0172 f8b6 2b 62 BMI C1 NOT HEX
0173 f8b8 81 16 CMPA #$16
0174 f8ba 2e 5e BGT C1 NOT HEX
0175 f8bc 80 07 SUBA #7
0176 f8be 39 IN1HG RTS
0177 *
0178 f8bf a6 00 OUT2H LDAA 0,X OUTPUT 2 HEX CHAR
0179 f8c1 8d a4 OUT2HA BSR OUTHL OUT LEFT HEX CHAR
0180 f8c3 a6 00 LDAA 0,X PICK UP BYTE AGAIN
0181 f8c5 08 INX
0182 f8c6 20 a3 BRA OUTHR OUTPUT RIGHT HEX CHAR AND RTS
0183 f8c8 8d f5 OUT4HS BSR OUT2H OUTPUT 4 HEX CHAR + SPACE
0184 f8ca 8d f3 OUT2HS BSR OUT2H OUTPUT 2 HEX CHAR + SPACE
0185 f8cc 86 20 OUTS LDAA #$20 SPACE
0186 f8ce 20 a5 BRA OUTCH (BSR & RTS)
0187 f8d0 LOAD EQU *
0188 f8d0 86 11 LDAA #@21
0189 f8d2 8d a1 BSR OUTCH OUTPUT CHAR
0190 *
0191 * TURN READER RELAY ON
0192 *
0193 f8d4 b6 a0 44 LDAA ACIAT GET ACIA CONTROL REG FORMAT
0194 f8d7 8a 40 ORAA #$40 SET RTS TO TURN RDR RELAY ON
0195 f8d9 b7 80 08 STAA ACIAS TURN IT ON
0196 *
0197 f8dc 7c a0 16 INC OUTSW DO NOT ECHO TAPE
0198 *
0199 f8df 8d 97 LOAD3 BSR INCH
0200 f8e1 20 03 BRA LOAD4
0201 f8e3 7e f9 a4 ENTER JMP ENT1 MIKBUG 1 ENTRY POINT
0202 f8e6 LOAD4 EQU *
0203 f8e6 81 53 CMPA #'S
0204 f8e8 26 f5 BNE LOAD3 1ST CHAR NOT (S)
0205 f8ea 8d 8c BSR INCH READ CHAR
0206 f8ec 81 39 CMPA #'9
0207 f8ee 27 2a BEQ C1
0208 f8f0 81 31 CMPA #'1
0209 f8f2 26 eb BNE LOAD3 2ND CHAR NOT (1)
0210 f8f4 7f a0 3c CLR CKSM ZERO CHECKSUM
0211 f8f7 bd f8 55 JSR BYTE READ BYTE
0212 f8fa 80 02 SUBA #2
0213 f8fc b7 a0 3d STAA BYTECT BYTE COUNT
0214 * BUILD ADDRESS
0215 f8ff bd f8 47 JSR BADDR
0216 * STORE DATA
0217 f902 bd f8 55 LOAD11 JSR BYTE
0218 f905 7a a0 3d DEC BYTECT
0219 f908 27 09 BEQ LOAD15 ZERO BYTE COUNT
0220 f90a a7 00 STAA 0,X STORE DATA
0221 f90c a1 00 CMPA 0,X CHECK DATA
0222 f90e 26 06 BNE LOAD19 DATA NOT STORED
0223 f910 08 INX
0224 f911 20 ef BRA LOAD11
0225 *
0226 * DOES CHECKSUM CHECK?
0227 *
0228 f913 5c LOAD15 INCB
0229 f914 27 c9 BEQ LOAD3
0230 f916 86 3f LOAD19 LDAA #'? PRINT QUESTION MARK
0231 f918 8d 3f BSR OUTCH1
0232 f91a 7e f9 ba C1 JMP CONTRL
0233 *
0234 * CHANGE MEMORY (M AAAA DD NN)
0235 *
0236 f91d bd f8 47 CHANGE JSR BADDR BUILD ADDRESS
0237 f920 8d aa BSR OUTS OUTPUT SPACE
0238 f922 fe a0 3e CHANG LDX XHI
0239 f925 8d a3 BSR OUT2HS PRINT DATA OLD
0240 f927 09 DEX
0241 f928 8d 3c CHA1 BSR INCH1 INPUT CHAR
0242 f92a 81 0a CMPA #$0A
0243 f92c 27 12 BEQ LF CHECK FOR LINE FEED
0244 f92e 81 5e CMPA #$5E
0245 f930 27 11 BEQ UA CHECK FOR ^
0246 f932 bd f8 ac JSR INHEX2 S BSR BYTE
0247 f935 bd f8 57 JSR BYTE2 GET NEW BYTE
0248 f938 a7 00 STAA 0,X CHANGE MEMORY
0249 f93a a1 00 CMPA 0,X
0250 f93c 26 d8 BNE LOAD19 NO CHANGE
0251 f93e 20 e8 BRA CHA1
0252 f940 08 LF INX INC ADDR
0253 f941 20 05 BRA UA1
0254 f943 86 0a UA LDAA #$0A
0255 f945 8d 12 BSR OUTCH1 OUTPUT LF
0256 f947 09 DEX DEC ADDR
0257 f948 ff a0 3e UA1 STX XHI SAV DATA ADDR
0258 f94b ce fc 7e LDX #MCL+1
0259 f94e bd f8 7e JSR PDATA1 PRINT CR
0260 f951 ce a0 3e LDX #XHI
0261 f954 bd f8 c8 JSR OUT4HS OUTPUT DATA ADDR
0262 f957 20 c9 BRA CHANG
0263 *
0264 f959 37 OUTCH1 PSHB SAVE BREG
0265 f95a f6 80 08 OUTC1 LDAB ACIAS
0266 f95d 57 ASRB
0267 f95e 57 ASRB
0268 f95f 24 f9 BCC OUTC1 XMIT NOT READY
0269 f961 b7 80 09 STAA ACIAD OUTPUT CHAR
0270 f964 33 PULB
0271 f965 39 RTS
0272 *
0273 * INPUT ONE CHAR TO AREG
0274 f966 b6 80 08 INCH1 LDAA ACIAS
0275 f969 47 ASRA
0276 f96a 24 fa BCC INCH1 RECEIVER NOT READY
0277 f96c b6 80 09 LDAA ACIAD INPUT CHAR
0278 f96f 84 7f ANDA #$7F RESET PARITY BIT
0279 f971 81 7f CMPA #$7F
0280 f973 27 f1 BEQ INCH1 RUBOUT;DEL
0281 f975 7d a0 16 TST OUTSW SHOULD INPUT BE ECHOED?
0282 f978 27 df BEQ OUTCH1 IF SO, OUTPUT THE CHAR
0283 f97a 39 RTS ELSE,RETURN TO CALLER OF INCH1
0284 *
0285 * CONSTANT INITIALIZATION
0286 * S = POINTER TO ROM BYTES TO BE COPIED TO RAM
0287 * X = POINTER TO RAM BYTES TO BE INITIALIZED
0288 *
0289 f97b START EQU * ACTUAL CODE START
0290 f97b 8e f8 38 LDS #ADRSTR-1 START OF CONSTANT DATA
0291 f97e ce a0 08 LDX #SP START OF RAM AREA
0292 *
0293 f981 32 INILP1 PULA GET NEXT CONSTANT BYTE
0294 f982 a7 00 STAA 0,X INIT NEXT RAM BYTE
0295 f984 08 INX UPDATE POINTER
0296 f985 8c a0 16 CPX #BRANEN END OF CONSTANT RAM AREA?
0297 f988 26 f7 BNE INILP1 NO, CONTINUE INITIALIZATION
0298 *
0299 * INITIALIZATION TO 0
0300 * X HOLDS INDEX OF 1ST BYTE TO BE SET TO 0
0301 *
0302 f98a 6f 00 INILP2 CLR 0,X CLEAR NEXT BYTE OF RAM
0303 f98c 08 INX UPDATE INDEX
0304 f98d 8c a0 80 CPX #ENDIN0 ANY MORE BYTES TO INIT?
0305 f990 26 f8 BNE INILP2 NO, CONTINUE CLEARING
0306 *
0307 * SET CC SO WHEN WE 'GO' TO USER PGM THE
0308 * INTERUPT MASK IS SET
0309 *
0310 f992 86 d0 LDAA #$D0
0311 f994 b7 a0 79 STAA $A079 PUT IN STACK TO BE PULLED
0312 *
0313 * INITIALIZE ACIA
0314 *
0315 f997 86 03 LDAA #3 MASTER RESET CODE
0316 f999 b7 80 08 STAA ACIAS RESET ACIA
0317 *
0318 f99c 86 11 INZ LDAA #%00010001 CHAR LEN=8; NO PARITY
0319 * 2 STOP BITS
0320 *
0321 f99e b7 a0 44 INZ1 STAA ACIAT SAVE FOR CONTROL LOOP ACIA IN
0322 *
0323 f9a1 b7 80 08 STAA ACIAS INZ ACIA
0324 f9a4 be a0 08 ENT1 LDS SP
0325 f9a7 bd f8 9e JSR PCRLF
0326 f9aa 20 02 BRA CONTB SKIP TO INSURE MIKBUG : COMPAT.
0327 f9ac 20 b8 INCH2 BRA INCH1 MIKBUG 1.0 INPUT 1 CHARACTER
0328 f9ae ce fc 8d CONTB LDX #MCL2 PRINT HEADER
0329 f9b1 bd f8 7e JSR PDATA1 PRINT DATA STRING
0330 f9b4 ce f9 eb LDX #NMI INIT PDN
0331 f9b7 ff a0 06 STX NIO
0332 *
0333 * MAIN COMMAND/CONTROL LOOP
0334 *
0335 f9ba CONTRL EQU *
0336 *
0337 * RESTORE STACK POINTER REGISTER
0338 *
0339 f9ba be a0 08 LDS SP SP WAS INITIALIZED EARLIER
0340 *
0341 f9bd b6 a0 44 LDAA ACIAT GET PROPER ACIA INIT BITS
0342 * FOR USER'S TERMINAL
0343 f9c0 b7 80 08 STAA ACIAS INZ ACIA
0344 *
0345 f9c3 7f a0 16 CLR OUTSW MAKE SURE INPUT IS ECHOED
0346 *
0347 f9c6 ce fc 7c LDX #MCLOFF TERMINAL INIT STRING
0348 f9c9 bd f8 7e JSR PDATA1 PRINT DATA STRING
0349 *
0350 f9cc 8d 98 BSR INCH1 READ COMMAND CHARACTER
0351 f9ce 16 TAB SAVE CHARACTER IN B
0352 f9cf 20 02 BRA CNTA SKIP OVER MIKBUG 1.0 VECTOR
0353 f9d1 20 86 OUT2 BRA OUTCH1 MIKBUG 1.0 ; OUTPUT 1 CHAR ROUTINE
0354 f9d3 bd f8 cc CNTA JSR OUTS PRINT SPACE AFTER COMMAND
0355 *
0356 * B REGISTER HOLDS CHARACTER INPUT BY USER
0357 * USE JUMP TABLE TO GO TO APPROPRIATE ROUTINE.
0358 *
0359 f9d6 ce f8 0f LDX #FCTABL X:= ADDRESS OF JUMP TABLE
0360 f9d9 e1 00 NXTCHR CMPB 0,X DOES INPUT CHAR MATCH?
0361 f9db 27 0a BEQ GOODCH YES, GOTO APROPRIATE ROUTINE
0362 f9dd 08 INX ELSE, UPDATE INDEX INTO TABLE
0363 f9de 08 INX
0364 f9df 08 INX
0365 f9e0 8c f8 39 CPX #FCTBEN END OF TABLE REACHED?
0366 f9e3 26 f4 BNE NXTCHR NO, TRY NEXT CHAR
0367 f9e5 20 d3 BRA CONTRL NO MATCH, REPROMPT USER
0368 *
0369 *
0370 f9e7 ee 01 GOODCH LDX 1,X GET ADDRESS FROM J.T.
0371 f9e9 6e 00 JMP 0,X GOTO APPROPRIATE ROUTINE
0372 *
0373 *
0374 * NMI ENTRY
0375 *
0376 f9eb bf a0 08 NMI STS SP SAVE STACK
0377 f9ee bd f8 9e JSR PCRLF
0378 f9f1 86 42 LDAA #'B PRINT B
0379 f9f3 8d dc BSR OUT2
0380 f9f5 bd f8 cc JSR OUTS
0381 f9f8 86 02 LDAA #2 REMOVE BREAKPOINTS
0382 f9fa 8d 6e BSR BRKSUB
0383 f9fc 20 5e BRA PSTAK1
0384 *
0385 * SET SPEED FOR USER TTY
0386 *
0387 f9fe 8d ac SPD BSR INCH2 INPUT CHAR
0388 fa00 81 31 CMPA #'1
0389 fa02 27 98 BEQ INZ
0390 fa04 86 15 LDAA #$15
0391 fa06 20 96 BRA INZ1 SET 2 STOP BITS
0392 *
0393 *
0394 fa08 7e f8 47 BADDRJ JMP BADDR GO BUILD ADDRESS
0395 *
0396 *
0397 * RESET ALL BREAKPOINTS
0398 *
0399 fa0b 86 01 DELBRK LDAA #1 RESET BREAKS FLAG
0400 fa0d 8d 5b BSRBRK BSR BRKSUB BREAK HANDLING SUBR.
0401 fa0f 20 56 BRA CNTRL2 RETURN TO COMMAND LEVEL
0402 *
0403 * RESET 1 BREAKPOINT
0404 *
0405 fa11 8d f5 RSTBRK BSR BADDRJ PUTS USER ENTERED ADDRESS
0406 * INTO XHI,XLO
0407 fa13 4f CLRA RESET 1 BREAK FLAG
0408 fa14 20 f7 BRA BSRBRK GO RESET 1
0409 *
0410 * PRINT OUT ALL NON-ZERO BREAK ADDRESSES
0411 *
0412 fa16 bd f8 9e PNTBRK JSR PCRLF DO CR/LF
0413 fa19 86 02 LDAA #2 PRINT BREAK ADDRESSES FLAGS
0414 fa1b 20 f0 BRA BSRBRK GO PRINT
0415 *
0416 * SET ONE BREAK
0417 *
0418 fa1d 8d e9 SETBRK BSR BADDRJ GET USER ENTERED ADDRESS (XHI,XLO)
0419 fa1f 86 04 LDAA #4 SET ONE BREAK FLAG
0420 fa21 8d 47 BSR BRKSUB GO SET IT
0421 fa23 20 f1 BRA PNTBRK PRINT ALL BREAKPOINTS
0422 *
0423 * GO TO REQUESTED
0424 *
0425 fa25 8d e1 GOTO BSR BADDRJ GO GET ADDRESS FROM USER
0426 * XHI,XLOW HOLD ADDRESS
0427 fa27 86 ff LDAA #$FF FLAG FOR PUTTING IN BREAKS
0428 fa29 8d 3f BSR BRKSUB GO PUT IN BREAKS
0429 fa2b 30 TSX
0430 fa2c b6 a0 3e LDAA XHI SAVE PCH ON STACK
0431 fa2f a7 05 STAA 5,X
0432 fa31 b6 a0 3f LDAA XLOW PUSH PCL
0433 fa34 a7 06 STAA 6,X
0434 fa36 3b RTI GO TO USER PRG
0435 *
0436 * SINGLE INSTRUCTION TRACE REQUESTED
0437 *
0438 fa37 ce 00 01 NEXT LDX #1 # INSTRUCTIONS TO TRACE
0439 fa3a 7f a0 43 TRACE2 CLR BRKTRC CLEAR FLAG INDICATING TRACE
0440 * IS DUE TO BREAK
0441 fa3d ff a0 1a TRACE3 STX NTRACE SAVE # INST'S TO TRACE
0442 * IS DUE TO BREAK
0443 fa40 fe a0 08 LDX SP X : = STACK POINTER
0444 fa43 ee 06 LDX 6,X X : = ADDRESS OF INSTR TO BE EX
0445 fa45 ff a0 17 STX TRCADR SAVE IN TRACE ADDRESS STORE
0446 fa48 a6 00 LDAA 0,X GET INSTRUCTION TO BE TRACED
0447 fa4a b7 a0 19 STAA TRCINS SAVE IN TRACE INSTRUCTION STORE
0448 fa4d 7e fb cb JMP CONTRC GO TO CONTINUE TRACE PART OF
0449 *
0450 * MULTIPLE INSTRUCTION TRACE
0451 *
0452 fa50 8d b6 TRACE BSR BADDRJ GET # OF INSTRUCTIONS TO TRACE
0453 fa52 20 e6 BRA TRACE2 GO TRACE'M
0454 *
0455 * CONTINUE EXECUTION
0456 *
0457 fa54 7c a0 43 CONT INC BRKTRC TRACE 1 TO RESTORE SWI'S
0458 fa57 ce 00 01 LDX #1 ONE TRACE ONLY
0459 fa5a 20 e1 BRA TRACE3
0460 *
0461 *
0462 * R COMMAND
0463 *
0464 * PRINT STACK CONTENTS
0465 *
0466 fa5c bd f8 9e PSTAK1 JSR PCRLF PRINT CR LF
0467 fa5f ce fc 98 LDX #MCL3 PRINT HEADER
0468 fa62 bd f8 7e JSR PDATA1
0469 fa65 8d 7b PSTAK BSR PRINT PRINT STACK
0470 fa67 7e f9 ba CNTRL2 JMP CONTRL RETURN TO COMMAND LEVEL
0471 **********
0472 *
0473 * BRKSUB
0474 *
0475 *
0476 * THIS ROUTINE DOES A NUMBER OF OPERATIONS HAVING
0477 * TO DO WITH BREAKPOINTS.
0478 *
0479 * THE A REGISTER DETERMINES FUNCTION PERFORMED:
0480 *
0481 * A = -1 => BREAKS ARE PUT INTO USER'S CODE
0482 * A = 0 => THE BREAKPOINT WHOSE ADDRESS IS IN
0483 * XHI, XLO IS PURGED;
0484 * ALL BREAKPOINTS ARE TEMPORARILY REMOVED
0485 * A = 1 => ALL BREAKPOINTS ARE PURGED
0486 * A = 2 => ALL BREAKPOINTS ARE PRINTED OUT
0487 * ALL BREAKPOINTS ARE TEMPORARILY REMOVED
0488 * A = 3 => ALL BREAKPOINTS ARE TEMPORARILY REMOVED
0489 * A = 4 => THE BREAK ADDRESS IN XHI, XLO IS
0490 * PUT INTO THE FIRST ZERO BREAKPOINT
0491 * POSITION; ALL BREAKS ARE TEMPORARILY REMOVED
0492 *
0493 **********
0494 *
0495 fa6a BRKSUB EQU *
0496 fa6a bf a0 40 STS SSAVE SAVE S SO WE CAN USE
0497 fa6d b7 a0 3c STAA ASAVE A HOLDS THE FUNCTION #
0498 *
0499 fa70 ce a0 1c LDX #BRKADR INIT X FOR LOOP THROUGH BREAKS
0500 *
0501 * START OF LOOP THROUGH BREAK ADDRESSES
0502 *
0503 fa73 b6 a0 3c BRKLP LDAA ASAVE GET FUNCTION #
0504 fa76 ae 00 LDS 0,X S:=NEXT ADDRESS IN BRRKPT LIST
0505 fa78 27 2d BEQ LN IF 0, THEN NOT A VALID BREAK
0506 *
0507 fa7a 7d a0 42 TST BRKSIN ARE BREAKS IN USER'S CODE?
0508 fa7d 27 36 BEQ NOBRIN BRANCH, IF NOT
0509 *
0510 * BREAKS ARE IN USER'S CODE
0511 *
0512 fa7f 4d TSTA SHOULD BREAKS BE IN?
0513 fa80 2b 21 BMI BKDONE YES, RETURN TO CALLER
0514 *
0515 * BREAKS ARE TO BE TAKEN OUT OF USER'S
0516 * CODE TEMPORARILY
0517 *
0518 fa82 a6 10 BRK2 LDAA 2*NBRBPT,X GET INSTR. BELONG-
0519 * ING IN USER CODE
0520 fa84 36 PSHA PUT IT THERE
0521 *
0522 * OTHER LOOP ACTIONS TO BE PERFORMED EACH TIME THROUGH
0523 * LOOP WHEN BREAK ADDRESS NOT EQUAL TO 0.
0524 *
0525 fa85 b6 a0 3c BKCON1 LDAA ASAVE WHAT FUNCTION IS TO BE DONE
0526 fa88 27 37 BEQ FNDRPL SEE IF BREAKPOINT NEEDS TO
0527 * BE REPLACED
0528 fa8a 81 01 CMPA #1 IS BREAK ADDRESS TO BE RESET?
0529 fa8c 27 41 BEQ CLRBRK YES, SET BRKADR TO 0
0530 *
0531 fa8e 81 02 CMPA #2 IS BRK ADDR TO BE PRINTED?
0532 fa90 27 49 BEQ PRNTBK YES, GO PRINT ADDRESS
0533 *
0534 * UPDATE LOOP INDEX AND LOOP IF APPROPRIATE
0535 *
0536 fa92 08 BKCON2 INX MAKE X POINT TO
0537 fa93 08 INX NEXT BREAK ADDRESS
0538 fa94 8c a0 2c BKCON3 CPX #BRKINS ANY MORE BREAKS?
0539 fa97 26 da BNE BRKLP YES,LOOP
0540 *
0541 * WRAP-UP PROCESSING AND EXIT
0542 *
0543 fa99 4f CLRA A = BREAKS IN FLAG
0544 fa9a 7d a0 3c TST ASAVE IS FUNCTION = -1?
0545 fa9d 2a 01 BPL BKPUT NO, SO BRKSIN = 0
0546 fa9f 4c INCA FCTN = -1 => BRKSIN:=1
0547 faa0 b7 a0 42 BKPUT STAA BRKSIN STORE APPROPRIATE FLAG
0548 *
0549 * RESTORE S-REG AND RETURN TO CALLER
0550 *
0551 faa3 be a0 40 BKDONE LDS SSAVE RESTORE USER S-REG
0552 faa6 39 RTS RETURN
0553 *
0554 *
0555 * MISCELLANEOUS ROUTINES FOR BRKSUB
0556 *
0557 * BREAKPOINT ADDRESS = 0 - IF FUNCTION = 4 THEN
0558 * PUT BREAKPOINT ADDRESS IN CURRENT POSITION
0559 * A HOLDS THE FUNCTION #, X HOLDS BREAKPOINT INDEX
0560 *
0561 faa7 81 04 LN CMPA #4 IS FUNCTION = 4
0562 faa9 26 e7 BNE BKCON2 IF NOT, THEN CONTINUE LOOP
0563 *
0564 faab be a0 3e LDS XHI GET NEW BREAK ADDRESS
0565 faae af 00 STS 0,X PUT IN CURRENT POSITION
0566 *
0567 fab0 7a a0 3c DEC ASAVE DO NOT PLACE ADDRESS MORE
0568 * THAN ONCE-CONT TO
0569 * TAKE OUT BREAKPOINTS
0570 fab3 20 dd BRA BKCON2 CONTINUE LOOP
0571 *
0572 * BREAKS ARE NOT IN AND ADDRESS IS NON-ZERO.
0573 * IF FUNCTION = -1 THEN SWI'S ARE TO BE PUT IN.
0574 * A HOLDS FUNCTION NUMBER, S HOLDS ADDRESS
0575 *
0576 fab5 4d NOBRIN TSTA IS FUNCTION = -1
0577 fab6 2a cd BPL BKCON1 NO, CONTINUE
0578 *
0579 fab8 34 DES MAKE ADDRESS POINT TO 1 LESS
0580 fab9 32 PULA GET USER INSTRUCTION
0581 faba a7 10 STAA 2*NBRBPT,X SAVE
0582 fabc 86 3f LDAA #SWI GET SWI OP CODE
0583 fabe 36 PSHA REPLACE USER INSTRUCTION
0584 fabf 20 d1 BRA BKCON2 CONTINUE LOOP
0585 *
0586 * FUNCTION=0 BRK ADDR NOT = 0, USER'S INSTR
0587 * IS IN (NOT SWI).
0588 * IF ADDRESS = XHI,XLO THEN SET ADDRESS = 0
0589 fac1 a6 00 FNDRPL LDAA 0,X GET TOP BYTE OF ADDRESS
0590 fac3 b1 a0 3e CMPA XHI DO TOP BYTES COMPARE
0591 fac6 26 ca BNE BKCON2 NO,CONTINUE LOOP
0592 fac8 e6 01 LDAB 1,X GET LOW BYTE OF ADDR
0593 faca f1 a0 3f CMPB XLOW SAME FOR LOW BYTES
0594 facd 26 c3 BNE BKCON2
0595 *
0596 facf 6f 00 CLRBRK CLR 0,X CLEAR OUT BREAK
0597 fad1 6f 01 CLR 1,X ADDRESS FIELD
0598 fad3 20 bd BRA BKCON2 CONTINUE LOOP
0599 *
0600 *
0601 fad5 7e f8 ca OT2HS JMP OUT2HS
0602 fad8 7e f8 c8 OT4HS JMP OUT4HS
0603 *
0604 *
0605 * PRINT OUT BREAK ADDRESS
0606 * FUNCTION = 2, BREAK ADDRESS NOT = 0, X = ADDRESS IN
0607 *
0608 fadb be a0 40 PRNTBK LDS SSAVE
0609 fade 8d f8 BSR OT4HS OUTPUT ADDRESS AND SPACE
0610 fae0 20 b2 BRA BKCON3 OUT4HS INCREMENTS X,
0611 * SO BYPAS 2 INX'S
0612 *
0613 * PRINT CONTENTS OF STACK
0614 *
0615 fae2 bd f8 9e PRINT JSR PCRLF PRINT CR LF
0616 fae5 fe a0 08 LDX SP PRINT OUT STACK
0617 fae8 08 INX
0618 fae9 8d ea BSR OT2HS CONDITION CODES
0619 faeb 8d e8 BSR OT2HS ACC-B
0620 faed 8d e6 BSR OT2HS ACC-A
0621 faef 8d e7 BSR OT4HS X-REG
0622 faf1 8d e5 BSR OT4HS P-COUNTER
0623 faf3 ce a0 08 LDX #SP
0624 faf6 8d e0 BSR OT4HS STACK POINTER
0625 faf8 39 RTS
0626
0627
0628 * PUNCH DUMP
0629 * PUNCH FROM BEGINNING ADDRESS (BEGA) THRU ENDING
0630 * ADDRESS (ENDA)
0631 *
0632
0633 faf9 0d 0a 00 00 00 00 MTAPE1 FCB $D,$A,0,0,0,0,'S,'1,4 PUNCH FORMAT
53 31 04
0634
0635 fb02 PUNCH EQU *
0636
0637 fb02 bd f8 85 JSR GETADD GET ADDRESS
0638 fb05 86 12 LDAA #$12 TURN TTY PUNCH ON
0639 fb07 bd f8 75 JSR OUTCH OUT CHAR
0640 *
0641 * PUNCH LEADER - 25 NULLS
0642 *
0643 fb0a c6 19 LDAB #25 B HOLDS # NULLS TO PUNCH
0644 fb0c 4f PNULL CLRA A=0 (NULL CHAR)
0645 fb0d bd f8 75 JSR OUTCH GO OUTPUT NULL
0646 fb10 5a DECB DECREMENT COUNTER
0647 fb11 26 f9 BNE PNULL IF NOT DONE, THEN LOOP
0648 *
0649 fb13 fe a0 02 LDX BEGA
0650 fb16 ff a0 40 STX TW TEMP BEGINNING ADDRESS
0651 fb19 b6 a0 05 PUN11 LDAA ENDA+1
0652 fb1c b0 a0 41 SUBA TW+1
0653 fb1f f6 a0 04 LDAB ENDA
0654 fb22 f2 a0 40 SBCB TW
0655 fb25 26 04 BNE PUN22
0656 fb27 81 10 CMPA #16
0657 fb29 25 02 BCS PUN23
0658 fb2b 86 0f PUN22 LDAA #15
0659 fb2d 8b 04 PUN23 ADDA #4
0660 fb2f b7 a0 3d STAA MCONT FRAME COUNT THIS RECORD
0661 fb32 80 03 SUBA #3
0662 fb34 b7 a0 3c STAA TEMP BYTE COUNT THIS RECORD
0663 * PUNCH C/R,L/F,NULLS,S,1
0664 fb37 ce fa f9 LDX #MTAPE1
0665 fb3a bd f8 7e JSR PDATA1
0666 fb3d 5f CLRB ZERO CHECKSUM
0667 * PUNCH FRAME COUNT
0668 fb3e ce a0 3d LDX #MCONT
0669 fb41 8d 2e BSR PUNT2 PUNCH 2 HEX CHAR
0670 * PUNCH ADDRESS
0671 fb43 ce a0 40 LDX #TW
0672 fb46 8d 29 BSR PUNT2
0673 fb48 8d 27 BSR PUNT2
0674 * PUNCH DATA
0675 fb4a fe a0 40 LDX TW
0676 fb4d 8d 22 PUN32 BSR PUNT2 PUNCH ONE BYTE (2 FRAMES)
0677 fb4f 7a a0 3c DEC TEMP DEC BYTE COUNT
0678 fb52 26 f9 BNE PUN32
0679 fb54 ff a0 40 STX TW
0680 fb57 53 COMB
0681 fb58 37 PSHB
0682 fb59 30 TSX
0683 fb5a 8d 15 BSR PUNT2 PUNCH CHECKSUM
0684 fb5c 33 PULB RESTORE STACK
0685 fb5d fe a0 40 LDX TW
0686 fb60 09 DEX
0687 fb61 bc a0 04 CPX ENDA
0688 fb64 26 b3 BNE PUN11
0689 fb66 bd f8 9e JSR PCRLF
0690 fb69 ce fc 71 LDX #MEOF
0691 fb6c bd f8 7e JSR PDATA1 OUTPUT EOF
0692 fb6f 20 32 BRA CTRL BRANCH TO CONTRL
0693
0694 * PUNCH 2 HEX CHAR, UPDATE CHECKSUM
0695 fb71 eb 00 PUNT2 ADDB 0,X UPDATE CHECKSUM
0696 fb73 7e f8 bf JMP OUT2H OUTPUT TWO HEX CHARS AND RTS
0697 *
0698 * SWI-1 SOFTWARE INTERRUPT LEVEL 1 PROCESSING
0699 *
0700 fb76 SWI15 EQU *
0701 fb76 bf a0 08 STS SP SAVE USER'S SP
0702 *
0703 fb79 86 03 LDAA #3
0704 fb7b bd fa 6a JSR BRKSUB GO TAKE OUT ALL THE BREAKS
0705 *
0706 * DECREMENT P-COUNTER
0707 *
0708 fb7e 30 TSX X:=STACK POINTER - 1
0709 fb7f 6d 06 TST 6,X IF LOWER BYTE = 0 => BORROW
0710 fb81 26 02 BNE SWI151 BRANCH IF BORROW NOT REQ'D
0711 fb83 6a 05 DEC 5,X DECREMENT UPPER BYTE
0712 fb85 6a 06 SWI151 DEC 6,X DECREMENT LOWER BYTE
0713 *
0714 * TEST FOR ADDRESS TRACE OR BREAK
0715 *
0716 fb87 ee 05 LDX 5,X X:=P COUNTER
0717 fb89 bc a0 17 CPX TRCADR IS SWI FOR TRACE?
0718 fb8c 27 18 BEQ TRCINH YES, GO TO TRACE INT HANDLER
0719 *
0720 fb8e a6 00 LDAA 0,X GET INSTRUCTION CAUSING SWI
0721 fb90 81 3f CMPA #SWI WAS IT REPLACED BY CALL TO BREAK
0722 fb92 26 0c BNE BRKINH YES, SO MUST BE A BREAK
0723 *
0724 * USER SWI-TRANSFER THROUGH LEVEL 2 SWI
0725 *
0726 fb94 30 TSX X:=STACK POINTER
0727 fb95 6c 06 INC 6,X UPDATE LOW BYTE OF P-COUNTER
0728 fb97 26 02 BNE INCNOV BRANCH IF NO CARRY
0729 fb99 6c 05 INC 5,X UPDATE HIGH BYTE IF NECESSARY
0730 fb9b fe a0 0c INCNOV LDX SWI2 X:=POINTER TO LEVEL 2 SWI HANDLER
0731 fb9e 6e 00 JMP 0,X GO TO LEVEL 2 HANDLER
0732 *
0733 *
0734 *
0735 *
0736 * BREAK INTERRUPT HANDLER
0737 *
0738 fba0 BRKINH EQU *
0739 fba0 bd fa e2 JSR PRINT STOP AND SHOW REGS TO USER
0740 fba3 7e f9 ba CTRL JMP CONTRL RETURN TO CONTROL LOOP
0741 *
0742 * TRACE INTERRUPT HANDLER
0743 * P-COUNTER HAS BEEN DECREMENTED TO POINT AT SWI
0744 * TRCINS HOLDS OP CODE REPLACED BY SWI
0745 * X HOLD ADDRESS WHERE TRACE SWI IS
0746 *
0747 fba6 b6 a0 19 TRCINH LDAA TRCINS GET OP CODE OF TRACED INSTR
0748 fba9 a7 00 STAA 0,X RESTORE TO USER'S CODE
0749 *
0750 fbab 7d a0 43 TST BRKTRC IS PROCESSING TO BE
0751 * IMMEDIATELY CONTINUED?
0752 fbae 27 0f BEQ NBKTRC BRANCH IF NOT
0753 *
0754 * PROCESSING IS TO 'CONTINUE'
0755 *
0756 fbb0 7f a0 43 CLR BRKTRC RESET CONTINUE FLAG
0757 fbb3 86 ff LDAA #$FF FLAG TO SET BREAKS IN CODE
0758 fbb5 bd fa 6a JSR BRKSUB PUT BREAKS IN
0759 fbb8 7f a0 17 CLR TRCADR NO MORE TRACE, SO CLEAR ADDRESS
0760 fbbb 7f a0 18 CLR TRCADR+1
0761 fbbe 3b RTI CONTINUE
0762 *
0763 * TRACE IS DUE TO N OR T TRACE COMMANDS
0764 *
0765 fbbf bd fa e2 NBKTRC JSR PRINT PRINT STACK
0766 fbc2 fe a0 1a LDX NTRACE GET # INSTRUCTIONS TO TRACE
0767 fbc5 09 DEX DECREMENT COUNT
0768 fbc6 ff a0 1a STX NTRACE AND RESTORE
0769 fbc9 27 d8 BEQ CTRL BRANCH IF ALL TRACES DONE
0770 *
0771 * TRACE NOT DONE - TRACE NEXT INSTRUCTION
0772 *
0773 fbcb b6 a0 19 CONTRC LDAA TRCINS GET CURRENT INSTRUCTION
0774 fbce b7 a0 0e STAA BRINS SAVE IN CASE IT'S A BRANCH
0775 fbd1 8d 70 BSR OPCBYT GO GET # BYTES/TYPE
0776 fbd3 4d TSTA CHECK FOR BRANCH
0777 fbd4 2a 35 BPL CKOBRA CHECK FOR OTHER THAN BRANCH
0778 *
0779 * RELATIVE BRANCH TYPE INSTRUCTION
0780 * DETERMINE WHERE TO PUT SWI
0781 * S- HOLDS POINTER TO USER STACK AFTER SWI
0782 fbd6 32 PULA GET CONDITION CODE
0783 fbd7 34 DES UPDATE STACK POINTER AFTER PULL
0784 fbd8 8a 10 ORAA #%00010000 MAKE INT'S INHIBITED
0785 fbda 06 TAP RESTORE USER'S C. CODE REG
0786 fbdb 7e a0 0e JMP BRINS GO SEE HOW RELATIVE BRANCH
0787 * FARES
0788 *
0789 * BRANCH WAS NOGO - PUT SWI AT NEXT INSTRUCTION
0790 *
0791 fbde 86 02 BRNOGO LDAA #2 A = # BYTES AFTER CURRENT INSTR
0792 fbe0 20 29 BRA CKOBRA GO PUT SWI APPROPRIATELY
0793 *
0794 * BRANCH WAS GO, PUT SWI AT ADDRESS BEING
0795 * JUMPED TO
0796 *
0797 fbe2 fe a0 17 BRGO LDX TRCADR X : = TRACE ADDRESS
0798 fbe5 a6 01 LDAA 1,X GET BRANCH OFFSET
0799 fbe7 08 INX OFFSET IS RELATIVE TO
0800 fbe8 08 INX INSTR FOLLOWING BRANCH
0801 fbe9 2b 12 BMI BRGODC BRANCH IF OFFSET NEGATIVE
0802 fbeb 8d 16 BRG1 BSR INCX INCREMENT X BY AMOUNT IN
0803 * A REG
0804 fbed ff a0 17 BRG2 STX TRCADR SAVE ADDRESS OF NEXT
0805 * INSTR TO STOP ON
0806 fbf0 a6 00 LDAA 0,X GET INSTRUCTION TO BE REPLACED
0807 fbf2 b7 a0 19 STAA TRCINS SAVE
0808 fbf5 86 3f LDAA #SWI GET SWI OP CODE
0809 fbf7 a7 00 STAA 0,X REPLACE INSTR WITH SWI
0810 fbf9 be a0 08 LDS SP GET ORIGINAL STACK POINTER
0811 fbfc 3b RTI TRACE ANOTHER INSTR
0812 *
0813 * X NEEDS TO BE DECREMENTED (OFFSET NEGATIVE)
0814 *
0815 fbfd 09 BRGODC DEX DECREMENT ADDRESS
0816 fbfe 4c INCA INCREMENT COUNTER
0817 fbff 26 fc BNE BRGODC IF COUNTER NOT 0, BRANCH
0818 fc01 20 ea BRA BRG2 IF DONE, GO RETURN TO USER PROG
0819 *
0820 * SUBROUTINE TO INCREMENT X BY CONTENTS OF A
0821 *
0822 fc03 4d INCX TSTA IS A = 0?
0823 fc04 27 04 BEQ INCXR IF SO, INC DONE
0824 fc06 08 INXLP INX ELSE INCREMENT X
0825 fc07 4a DECA DECREMENT COUNT
0826 fc08 26 fc BNE INXLP IF COUNT NOT YET 0, LOOP
0827 fc0a 39 INCXR RTS RETURN FROM THIS SUBROUTINE
0828 *
0829 * INSTRUCTION TO BE TRACED IS NOT A BRANCH
0830 *
0831 fc0b fe a0 17 CKOBRA LDX TRCADR X : = TRACE ADDRESS
0832 fc0e e6 00 LDAB 0,X GET INSTR TO BE TRACED
0833 fc10 c1 6e CMPB #$6E IS IT A JUMP, INDEXED?
0834 fc12 27 1a BEQ JMPIDX YES, GO SIMULATE JUMP IDXED
0835 fc14 c1 7e CMPB #$7E JUMP, EXTENDED?
0836 fc16 27 1d BEQ JMPEXT
0837 fc18 c1 ad CMPB #$AD JSR, INDEXED?
0838 fc1a 27 12 BEQ JMPIDX (JUMP IDXED IS SAME AS
0839 * TRANSFER OF CONTROL)
0840 fc1c c1 bd CMPB #$BD JSR, EXTENDED?
0841 fc1e 27 15 BEQ JMPEXT
0842 fc20 c1 3b CMPB #$3B RTI?
0843 fc22 27 15 BEQ RTISIM
0844 fc24 c1 39 CMPB #$39 RTS?
0845 fc26 27 16 BEQ RTSSIM
0846 fc28 c1 8d CMPB #$8D BSR?
0847 fc2a 27 b6 BEQ BRGO (BRANCH PROCESSING)
0848 *
0849 * NOT A BRANCH, JUMP. RTI, RTS
0850 * A REGISTER HOLDS # BYTES IN INSTRUCTION
0851 *
0852 fc2c 20 bd BRA BRG1 PUT IN NEW SWI AND
0853 * TRACE NEXT INSTRUCTION
0854 *
0855 * JUMP, JSR INDEXED SIMULATION
0856 *
0857 fc2e a6 01 JMPIDX LDAA 1,X A : = ADDRESS OFFSET
0858 fc30 30 TSX
0859 fc31 ee 03 LDX 3,X GET TARGETS X REG
0860 fc33 20 b6 BRA BRG1 UPDATE X, TRACE NEXT INSTR
0861 *
0862 * JUMP, JSR EXTENDED
0863 *
0864 fc35 ee 01 JMPEXT LDX 1,X GET ADDRESS TO BE JUMPED TO
0865 fc37 20 b4 BRA BRG2 GO TRACE NEXT INSTR.
0866 *
0867 * RTI ENCOUNTERED
0868 *
0869 fc39 30 RTISIM TSX
0870 fc3a ee 0c LDX 12,X GET P-COUNTER FROM STACK
0871 fc3c 20 af BRA BRG2 GO TRACE NEXT INSTR.
0872 *
0873 * RTS ENCOUNTERED
0874 *
0875 fc3e 30 RTSSIM TSX
0876 fc3f ee 07 LDX 7,X GET RETURN P-REG FROM STACK
0877 fc41 20 aa BRA BRG2 GO TRACE NEXT INSTR
0878 *************************
0879 *
0880 * OPBCYT
0881 *
0882 * THIS ROUTINE DETERMINES THE # OF BYTES IN AN INSTRUCTION
0883 * GIVEN ITS OP CODE.
0884 *
0885 * INPUT: A HOLDS THE OP CODE
0886 *
0887 * OUTPUT: X HOLDS THE INDEX OF TABLE ELEMENT
0888 * B NOT RESTORED
0889 * A HOLDS # BYTES IN INSTRUCTION
0890 * EXCEPT FOR BRANCHES IN WHICH CASE IS NEGATIVE
0891 *
0892 ************************
0893 *
0894 fc43 OPCBYT EQU *
0895 fc43 16 TAB B:= OP CODE
0896 fc44 44 LSRA
0897 fc45 44 LSRA
0898 fc46 44 LSRA PUT 4 UPPER BITS OF OP CODE IN
0899 fc47 44 LSRA LOWER 4 BITS OF A
0900 *
0901 fc48 ce fc 61 LDX #OPBTTB X:= ADDRESS OF TABLE
0902 fc4b 8d b6 BSR INCX INCREMENT X TO POINT TO CORRECT
0903 *
0904 fc4d a6 00 LDAA 0,X GET TABLE ENTRY
0905 fc4f 26 0f BNE OPBTRT IF NOT 0 THEN NO FURTHER
0906 * PROCESSING NEEDED
0907 *
0908 * IF TOP 4 BITS = 8 OR C, THEN THERE ARE TWO CLASSES
0909 * OF INSTRUCTIONS: 2 BYTE INSTRUCTIONS AND
0910 * CE, 8C AND 8E WHICH ARE 3 BYTE INSTRUCTIONS
0911 *
0912 fc51 86 02 LDAA #2 # BYTES IN MOST OF 8# INSTRUCTIONS
0913 fc53 c1 8c CMPB #$8C 3 BYTE INSTRUCTION?
0914 fc55 27 08 BEQ OPBT3 YES, UPDATE A
0915 fc57 c1 ce CMPB #$CE 3 BYTE INSTR?
0916 fc59 27 04 BEQ OPBT3 YES, UPDATE A
0917 fc5b c1 08 CMPB #8E 3 BYTE INSTRUCTION?
0918 fc5d 26 01 BNE OPBTRT NO, RETURN
0919 *
0920 fc5f 4c OPBT3 INCA # BYTES IN INSTRUCTION:=3
0921 *
0922 fc60 39 OPBTRT RTS RETURN TO CALLER
0923 *
0924 * OP CODE TO NUMBER OF BYTES CONVERSION TABLE
0925 *
0926 * # BYTES TOP 4 BITS OF OPCODE
0927 * ------- --------------------
0928 *
0929 fc61 OPBTTB EQU *
0930 fc61 01 FCB 1 0
0931 fc62 01 FCB 1 1
0932 fc63 82 FCB 2+%10000000 2 ( MINUS=> BRANCHES )
0933 fc64 01 FCB 1 3
0934 fc65 01 FCB 1 4
0935 fc66 01 FCB 1 5
0936 fc67 02 FCB 2 6
0937 fc68 03 FCB 3 7
0938 fc69 00 FCB 0 8 # BYTES=2 EXCEPT 8C,8E
0939 fc6a 02 FCB 2 9
0940 fc6b 02 FCB 2 A
0941 fc6c 03 FCB 3 B
0942 fc6d 00 FCB 0 C # BYTES = 2 EXCEPT CE
0943 fc6e 02 FCB 2 D
0944 fc6f 02 FCB 2 E
0945 fc70 03 FCB 3 F
0946 *
0947 * CONSTANT DATA
0948 *
0949 fc71 53 39 30 33 30 30 MEOF FCC /S9030000FC/
30 30 46 43
0950 fc7b 04 FCB 4
0951 fc7c 13 MCLOFF FCB $13 READER OFF
0952 fc7d 0a 0d 14 00 00 00 MCL FCB $A,$D,$14,0,0,0,0,'*,4 LF,CR,PUNCH
00 2a 04
0953 fc86 0d 0a 00 00 00 00 MCL1 FCB $D,$A,0,0,0,0,4 CR LF
04
0954 fc8d 4d 49 4b 42 55 47 MCL2 FCC /MIKBUG 2.0/
20 32 2e 30
0955 fc97 04 FCB 4
0956 fc98 43 43 20 42 20 20 MCL3 FCC /CC B A X P S/
41 20 20 20 58 20
20 20 20 50 20 20
20 20 53
0957 fcad 04 FCB 4
0958 fcae 42 45 47 20 41 44 MCL4 FCC /BEG ADDR ?/
44 52 20 3f
0959 fcb8 04 FCB 4
0960 fcb9 45 4e 44 20 41 44 MCL5 FCC /END ADDR ?/
44 52 20 3f
0961 fcc3 04 FCB 4
0962 *
0963 *
0964 * MAXIMAL SOFTWARE IMPLEMENTATION OF THE
0965 * RITTER-ZETTNER STANDARDS
0966 *
0967 * COPYRIGHT (C) 1977 MOTOROLA INC. AND T. F. RITTER
0968 *
0969 * COMMANDS FOR EXORTAPE
0970 * C L D S :
0971 * C - CHECK TAPE
0972 * L - LOAD FROM TAPE TO MEMORY
0973 * D - DUMP FROM MEMORY TO TAPE
0974 * S - SET BAUD RATE
0975 *
0976 * SPEED :
0977 * ENTER 04 08 12 16 20
0978 *
0979 * FILE ID :
0980 * ENTER FOUR HEX CHARACTERS
0981 *
0982 * STARTSTOP PAGES:
0983 * ENTER STARTING PAGE, TWO HEX CHARACTERS
0984 * ENTER STOPPAGE, TWO HEX CHARACTERS
0985 *
0986 *
0987 *
0988 * FILE SPECIFICATIONS
0989 * ALC := UNDEFINED BIT; AUTOMATIC LEVEL CONTROL
0990 * POST := UNDEFINED BIT; MISSING PULSE PROTECT