-
Notifications
You must be signed in to change notification settings - Fork 1
/
bsmon.lst
4480 lines (3997 loc) · 176 KB
/
bsmon.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
***************************************************************************
* *
* BBBBBBBBB SSSSSSSS *
* BBB BBB SSS SSS *
* BBB BBB SSS *
* BBBBBBBBB SSSSSSSS *
* BBB BBB SSS *
* BBB BBB SSS SSS *
* BBBBBBBBB SSSSSSSS *
* *
* MMM MMM OOOOOOO NNN NN III TTTTTTTTT OOOOOOO RRRRRRRR *
* MMMM MMMM OOO OOO NNNN NN III TTT OOO OOO RRR RRR *
* MMMMMMMMM OOO OOO NNNNN NN III TTT OOO OOO RRR RRR *
* MMM M MMM OOO OOO NNN NN NN III TTT OOO OOO RRRRRRRR *
* MMM MMM OOO OOO NNN NNNN III TTT OOO OOO RRR RRR *
* MMM MMM OOO OOO NNN NNN III TTT OOO OOO RRR RRR *
* MMM MMM OOOOOOO NNN NN III TTT OOOOOOO RRR RRR *
* *
* Bit Shifter's Monitor for the MEGA65 - 18-JAN-2021 *
* *
***************************************************************************
.CPU 45GS02
.STORE $6000,$2000,"10000-11FFF.MONITOR"
*************
* Constants *
*************
0005 WHITE = $05
009e YELLOW = $9e
0096 LRED = $96
000d CR = $0d
0012 REV = $12
001d CRIGHT = $1d
0022 QUOTE = $22
0027 APOSTR = $27
************************************************
* Register storage for JMPFAR and JSRFAR calls *
************************************************
0002 Bank = 2
0003 PCH = 3
0004 PCL = 4
0005 SR = 5
0006 AC = 6
0007 XR = 7
0008 YR = 8
0009 ZR = 9
*************************************
* Used direct (zero) page addresses *
*************************************
000a BP = 10
000b SPH = 11
000c SPL = 12
; following variables overlap with the BASIC floating point area
; $59 - $5d : temporary floating point accumulator
; $5e - $62 : temporary floating point accumulator
; $63 - $69 : primary floating point accumulator
; $6a - $6f : secondary floating point accumulator
; A set of 32 bit variables also used as 32 bit pointer
0059 & = $59
0059 Long_AC .BSS 4 ; 32 bit accumulator
005d Long_CT .BSS 4 ; 32 bit counter
0061 Long_PC .BSS 4 ; 32 bit program counter
0065 Long_DA .BSS 4 ; 32 bit data pointer
; Flags are used in BBR BBS instructions
0069 Adr_Flags .BSS 1
006a Mode_Flags .BSS 1
006b Op_Code .BSS 1
006c Op_Flag .BSS 1 ; 7: two operands
; 6: long branch
; 5: 32 bit address
; 4: Q register
006d Op_Size .BSS 1
006e Dig_Cnt .BSS 1
006f Buf_Index .BSS 1
; operating system variables
0090 STATUS = $90
0093 VERCK = $93
00b7 FNLEN = $b7
00b9 SA = $b9
00ba FA = $ba
00bb FNADR = $bb
00bd BA = $bd
00be FNBANK = $be
00d0 NDX = $d0 ; length of keyboard buffer
00d7 MODE_80 = $d7 ; 80 column / 40 volumn flag
00e4 B_Margin = $e4 ; SCBOT default = 24
00e5 T_Margin = $e5 ; SCTOP default = 0
00e6 L_Margin = $e6 ; SCLF default = 0
00e7 R_Margin = $e7 ; SCRT default = 39 or 79
00f4 QTSW = $f4 ; Quote switch
0100 Stack = $0100
0200 Buffer = $0200 ; input buffer
0314 IIRQ = $0314
0316 IBRK = $0316
032e EXMON = $032e
0400 & = $400 ; bottom of BASIC runtime stack
; should be a safe space
0400 Ix_Mne .BSS 1 ; index to mnemonics table
0401 Op_Mne .BSS 3 ; 3 bytes for mnemonic
0404 Op_Ix .BSS 1 ; type of constant
0405 Op_Len .BSS 1 ; length of operand
0406 Disk_Unit .BSS 1 ; target unit
0407 Disk_Src .BSS 1 ; source unit
0408 Disk_Track .BSS 1 ; logical track 1 -> 255
0409 Disk_Sector .BSS 1 ; logical sector 0 -> 255
040a Disk_Status .BSS 1 ; BCD value of status
040b File_Ext .BSS 3 ; file extension
040e Mon_Data .BSS 40 ; buffer for hunt and filename
0436 Disk_Msg .BSS 40 ; disk status as text message
cfaf EXIT = $cfaf ; exit address for ROM 92xxxx
ff6b SETBNK = $ff6b
ff6e JSRFAR = $ff6e
ff71 JMPFAR = $ff71
ff74 LDA_FAR = $ff74
ff77 STA_FAR = $ff77
ff7a CMP_FAR = $ff7a
ff7d PRIMM = $ff7d
ff81 CINT = $ff81
ff84 IOINIT = $ff84
ff90 SETMSG = $ff90
ff93 SECOND = $ff93
ff96 TKSA = $ff96
ff99 MEMTOP = $ff99
ff9c MEMBOT = $ff9c
ff9f KEY = $ff9f
ffa2 SETTMO = $ffa2
ffa5 ACPTR = $ffa5
ffa8 CIOUT = $ffa8
ffab UNTALK = $ffab
ffae UNLSN = $ffae
ffb1 LISTEN = $ffb1
ffb4 TALK = $ffb4
ffb7 READSS = $ffb7
ffba SETLFS = $ffba
ffbd SETNAM = $ffbd
ffc0 OPEN = $ffc0
ffc3 CLOSE = $ffc3
ffc6 CHKIN = $ffc6
ffc9 CHKOUT = $ffc9
ffcc CLRCHN = $ffcc
ffcf CHRIN = $ffcf
ffd2 CHROUT = $ffd2
ffd5 LOAD = $ffd5
ffd8 SAVE = $ffd8
ffdb SETTIM = $ffdb
ffde GETTIM = $ffde
ffe1 STOP = $ffe1
ffe4 GETIN = $ffe4
ffe7 CLALL = $ffe7
ffea SCAN = $ffea
ffed SCRORG = $ffed
fff0 PLOT = $fff0
ffffffff * = $1fff
.STORE $1fff,$0101,"bsm.prg"
*************
Module header
*************
1fff 01 20 .WORD $2001 ; load address
2001 29 20 .WORD Link ; line link
2003 e5 07 .WORD 2021 ; line number
2005 fe 02 .BYTE $fe,$02 ; BANK token
2007 30 3a .BYTE "0:" ; BANK argument
2009 9e .BYTE $9e ; SYS token
200a 28 38 32 .BYTE "(8235):" ; $202d
2011 8f .BYTE $8f ; REM token
2012 20 42 49 .BYTE " BIT SHIFTER 01-JAN-21",0
2029 00 00 Link .WORD 0 ; BASIC end marker
; copy image to $030000
202b 78 SEI
; map memory to monitor configuration
202c a9 a0 LDA #$a0
202e a2 82 LDX #$82
2030 a0 00 LDY #$00
2032 a3 83 LDZ #$83
2034 5c MAP
2035 ea EOM
; VIC IV registers visible
2036 a9 47 LDA #$47
2038 8d 2f d0 STA $d02f
203b a9 53 LDA #$53
203d 8d 2f d0 STA $d02f
; toggle write protection
2040 a9 70 LDA #$70
2042 8d 40 d6 STA $D640
2045 ea NOP
2046 a3 00 LDZ #0
2048 64 59 STZ Long_AC
204a a9 21 LDA #$21
204c 85 5a STA Long_AC+1
204e 64 5d STZ Long_CT
2050 64 5e STZ Long_CT+1
2052 a9 03 LDA #3
2054 85 5f STA Long_CT+2
2056 64 60 STZ Long_CT+3
2058 a2 20 LDX #$20
205a b2 59 _loop LDA (Long_AC),Z
205c ea 92 5d STA [Long_CT],Z
205f 1b INZ
2060 d0 f8 BNE _loop
2062 e6 5a INC Long_AC+1
2064 e6 5e INC Long_CT+1
2066 ca DEX
2067 d0 f1 BNE _loop
2069 a9 70 LDA #$70
206b 8d 40 d6 STA $D640 ; toggle write protection
206e ea NOP
206f 60 RTS
2070 EndMod [header] Size = 113 [$71]
2070 00 00 00 .FILL $2100-* (0) ; 144 bytes
2100 * = $6000
********************
6000 Monitor_Call ; $6000
********************
6000 4c 36 60 JMP Mon_Call
*********************
6003 Monitor_Break ; $6003
*********************
6003 4c 09 60 JMP Mon_Break
**********************
6006 Monitor_Switch ; $6009
**********************
6006 4c b4 60 JMP Mon_Switch
****************
Module Mon_Break
****************
6009 20 7d ff JSR PRIMM
600c 0d 42 52 .BYTE "\rBREAK\a",0
6014 20 d8 60 JSR Print_Commands
; pull BP, Z, Y, X, A,SR,PCL,PCH
; 7 6 5 4 3 2 1 0
6017 a2 07 LDX #7
6019 68 _loop PLA
601a 95 03 STA PCH,X
601c ca DEX
601d 10 fa BPL _loop
; decrement PC to point after BRK
601f a5 04 LDA PCL
6021 d0 02 BNE _nopage
6023 c6 03 DEC PCH
6025 c6 04 _nopage DEC PCL
6027 ad 1d 01 LDA $011d
602a 7f 02 03 BBR7 Bank,_bank
602d ad 1f 01 LDA $011f
6030 29 0f _bank AND #15
6032 85 02 STA Bank
6034 80 14 BRA Mon_Start
6036 EndMod [Mon_Break] Size = 45 [$2d]
***************
Module Mon_Call
***************
6036 20 d8 60 JSR Print_Commands
; clear register for monitor call
6039 a9 00 LDA #0
603b a2 06 LDX #6
603d 95 06 _loop STA AC,X
603f ca DEX
6040 10 fb BPL _loop
; set default PC to "exit to BASIC"
6042 a9 af LDA #<EXIT ; ROM 911110
6044 a2 cf LDX #>EXIT
6046 85 04 _store STA PCL
6048 86 03 STX PCH
604a EndMod [Mon_Call] Size = 20 [$14]
****************
Module Mon_Start
****************
604a d8 CLD
604b 0b TSY
604c 84 0b STY SPH
604e ba TSX
604f 86 0c STX SPL
6051 a9 c0 LDA #$c0
6053 20 90 ff JSR SETMSG
6056 58 CLI
6057 ea NOP
6058 EndMod [Mon_Start] Size = 14 [$e]
***************************
Module Mon_Register ; $6042
***************************
6058 20 f7 73 JSR Reg_Text
; print Bank,PCH
605b a0 00 LDY #0
605d b9 02 00 _loopa LDA Bank,Y
6060 20 35 6b JSR Print_Hex
6063 c8 INY
6064 c0 02 CPY #2
6066 90 f5 BCC _loopa
; print SR,PCL,A,X,Y,Z,BP
6068 b9 02 00 _loopb LDA Bank,Y
606b 20 20 6b JSR Print_Hex_Blank
606e c8 INY
606f c0 09 CPY #9
6071 90 f5 BCC _loopb
; print 16 bit stack pointer
6073 a5 0b LDA SPH
6075 20 35 6b JSR Print_Hex
6078 a5 0c LDA SPL
607a 20 20 6b JSR Print_Hex_Blank
; print flags
607d a0 08 LDY #8
607f a5 05 LDA SR
6081 0a _loopc ASL A
6082 48 PHA
6083 a9 2d LDA #'-'
6085 90 02 BCC _flag
6087 a9 31 LDA #'1'
6089 20 d2 ff _flag JSR CHROUT
608c 68 PLA
608d 88 DEY
608e d0 f1 BNE _loopc
6090 EndMod [Mon_Register] Size = 56 [$38]
***********
Module Main
***********
6090 20 28 6b JSR Print_CR
6093 a2 00 LDX #0
; read one line into buffer
******
6095 Main_A
******
6095 20 cf ff _loop JSR CHRIN
6098 9d 00 02 STA Buffer,X
609b e8 INX
609c e0 50 CPX #80
609e b0 1e BCS Mon_Error ; input too long
60a0 c9 0d CMP #CR
60a2 d0 f1 BNE _loop
60a4 a9 00 LDA #0
60a6 85 6f STA Buf_Index
60a8 9d ff 01 STA Buffer-1,X ; terminate buffer
60ab 20 65 6b _getcomm JSR Get_Char
60ae f0 e0 BEQ Main
60b0 c9 20 CMP #' '
60b2 f0 f7 BEQ _getcomm
60b4 EndMod [Main] Size = 36 [$24]
*****************
Module Mon_Switch
*****************
60b4 a2 18 LDX #24
60b6 dd f2 60 _loop CMP Command_Char,X
60b9 f0 10 BEQ Mon_Select
60bb ca DEX
60bc 10 f8 BPL _loop
; fall through to error routine if not found
****************
Module Mon_Error
****************
; put a question mark at the end of the text
60be 20 7d ff JSR PRIMM
60c1 1b 4f 1d .BYTE "\eO",CRIGHT,'?',0
60c6 a2 f8 LDX #$f8 ; reset stack pointer
60c8 9a TXS
60c9 80 c5 BRA Main
*****************
Module Mon_Select
*****************
60cb 85 93 STA VERCK
60cd e0 17 CPX #23
60cf b3 3c 03 LBCS Load_Save
60d2 8a TXA
60d3 0a ASL A
60d4 aa TAX
60d5 7c 0f 61 JMP (Jump_Table,X)
60d8 EndMod [Mon_Select] Size = 13 [$d]
**************
60d8 Print_Commands
**************
60d8 20 7d ff JSR PRIMM
60db 0d 9e 12 .BYTE CR,YELLOW,REV,"BS MONITOR COMMANDS:"
************
60f2 Command_Char
************
; 0123456789abcdef
60f2 41 42 43 .BYTE "ABCDFGHJMRTUX@.>;?"
***********
6104 Cons_Prefix
***********
6104 24 2b 26 .BYTE "$+&%'"
****************
6109 Load_Save_Verify
****************
6109 4c 53 56 .BYTE "LSV",WHITE,0
610e 60 RTS
**********
610f Jump_Table
**********
610f e4 64 .WORD Mon_Assemble ; A
6111 18 62 .WORD Mon_Bits ; B
6113 7d 63 .WORD Mon_Compare ; C
6115 e9 67 .WORD Mon_Disassemble ; D
6117 ba 64 .WORD Mon_Fill ; F
6119 a2 62 .WORD Mon_Go ; G
611b ad 63 .WORD Mon_Hunt ; H
611d ae 62 .WORD Mon_JSR ; J
611f ce 61 .WORD Mon_Memory ; M
6121 58 60 .WORD Mon_Register ; R
6123 33 63 .WORD Mon_Transfer ; T
6125 4b 6d .WORD Mon_Unit_Copy ; U
6127 af cf .WORD EXIT ; X
6129 10 6f .WORD Mon_DOS ; @
612b e4 64 .WORD Mon_Assemble ; .
612d 74 62 .WORD Mon_Set_Memory ; >
612f 5a 62 .WORD Mon_Set_Register ; ;
6131 2a 74 .WORD Mon_Help ; ?
6133 b5 6b .WORD Converter ; $
6135 b5 6b .WORD Converter ; +
6137 b5 6b .WORD Converter ; &
6139 b5 6b .WORD Converter ; %
613b b5 6b .WORD Converter ; '
****************
Module LAC_To_PC
****************
; called from Mon_Set_Register, Mon_Go and Mon_JSR
; as the first instruction. The carry flag was set from
; the routine Got_LAC if an error occured.
; Notice that the Bank, PCH and PCL values are stored
; high to low, reverse to the standard order.
; Bank, PCH and PCL are part of a list, that is used by
; the routines FAR_JMP and FAR_JSR of the operating system
613d b0 0e BCS _error
613f a5 59 LDA Long_AC
6141 85 04 STA Bank+2
6143 a5 5a LDA Long_AC+1
6145 85 03 STA Bank+1
6147 a5 5b LDA Long_AC+2
6149 05 5c ORA Long_AC+3
614b 85 02 STA Bank
614d 60 _error RTS
614e EndMod [LAC_To_PC] Size = 17 [$11]
*****************
Module LAC_To_LPC
*****************
614e da PHX
614f a2 03 LDX #3
6151 b5 59 _loop LDA Long_AC,X
6153 95 61 STA Long_PC,X
6155 ca DEX
6156 10 f9 BPL _loop
6158 fa PLX
6159 60 RTS
615a EndMod [LAC_To_LPC] Size = 12 [$c]
*****************
Module LAC_To_LCT
*****************
615a da PHX
615b a2 03 LDX #3
615d b5 59 _loop LDA Long_AC,X
615f 95 5d STA Long_CT,X
6161 ca DEX
6162 10 f9 BPL _loop
6164 fa PLX
6165 60 RTS
6166 EndMod [LAC_To_LCT] Size = 12 [$c]
*****************
Module LAC_To_LDA
*****************
6166 da PHX
6167 a2 03 LDX #3
6169 b5 59 _loop LDA Long_AC,X
616b 95 65 STA Long_DA,X
616d ca DEX
616e 10 f9 BPL _loop
6170 fa PLX
6171 60 RTS
6172 EndMod [LAC_To_LDA] Size = 12 [$c]
*******************
Module LAC_Plus_LCT
*******************
6172 da PHX
6173 a2 fc LDX #252 ; use ZP wrap around
6175 18 CLC
6176 b5 5d _loop LDA Long_AC+4,X
6178 75 61 ADC Long_CT+4,X
617a 95 5d STA Long_AC+4,X
617c e8 INX
617d d0 f7 BNE _loop
617f fa PLX
6180 60 RTS
6181 EndMod [LAC_Plus_LCT] Size = 15 [$f]
********************
Module LAC_Minus_LPC
********************
6181 da PHX
6182 a2 fc LDX #252 ; use ZP wrap around
6184 38 SEC
6185 b5 5d _loop LDA Long_AC+4,X
6187 f5 65 SBC Long_PC+4,X
6189 95 61 STA Long_CT+4,X
618b e8 INX
618c d0 f7 BNE _loop
618e fa PLX
618f 60 RTS
6190 EndMod [LAC_Minus_LPC] Size = 15 [$f]
**********************
Module LAC_Compare_LPC
**********************
6190 da PHX
6191 a2 fc LDX #252 ; use ZP wrap around
6193 38 SEC
6194 b5 5d _loop LDA Long_AC+4,X
6196 f5 65 SBC Long_PC+4,X
6198 e8 INX
6199 d0 f9 BNE _loop
619b fa PLX
619c 60 RTS
619d EndMod [LAC_Compare_LPC] Size = 13 [$d]
**************
Module Inc_LAC
**************
619d e3 59 INW Long_AC
619f d0 02 BNE _return
61a1 e3 5b INW Long_AC+2
61a3 60 _return RTS
61a4 EndMod [Inc_LAC] Size = 7 [$7]
**************
Module Dec_LAC
**************
61a4 a5 59 LDA Long_AC
61a6 05 5a ORA Long_AC+1
61a8 d0 02 BNE _skip
61aa c3 5b DEW Long_AC+2
61ac c3 59 _skip DEW Long_AC
61ae 60 RTS
61af EndMod [Dec_LAC] Size = 11 [$b]
**************
Module Inc_LPC
**************
61af e3 61 INW Long_PC
61b1 d0 02 BNE _return
61b3 e3 63 INW Long_PC+2
61b5 60 _return RTS
61b6 EndMod [Inc_LPC] Size = 7 [$7]
**************
Module Dec_LDA
**************
61b6 a5 65 LDA Long_DA
61b8 05 66 ORA Long_DA+1
61ba d0 02 BNE _skip
61bc c3 67 DEW Long_DA+2
61be c3 65 _skip DEW Long_DA
61c0 60 RTS
61c1 EndMod [Dec_LDA] Size = 11 [$b]
************
Module Fetch
************
61c1 db PHZ
61c2 98 TYA
61c3 4b TAZ
61c4 ff 64 01 BBS7 Long_PC+3,_banked ; trigger banked access
61c7 ea NOP ; use LDA [Long_PC],Z
61c8 b2 61 _banked LDA (Long_PC),Z
61ca fb PLZ
61cb 29 ff AND #$ff
61cd 60 RTS
61ce EndMod [Fetch] Size = 13 [$d]
*****************
Module Mon_Memory
*****************
61ce 20 33 6a JSR Get_LAC ; get 1st. parameter
61d1 a3 10 LDZ #16 ; default row count
61d3 b0 1f BCS _row ; no address
61d5 20 4e 61 JSR LAC_To_LPC ; Long_PC = start address
61d8 20 33 6a JSR Get_LAC ; Long_AC = end address
61db b0 17 BCS _row ; not given
61dd 20 81 61 JSR LAC_Minus_LPC ; Long_CT = range
61e0 93 dc fe LBCC Mon_Error ; negative range -> error
61e3 a2 04 LDX #4 ; 16 bytes / line
61e5 7f d7 01 BBR7 MODE_80,_shift
61e8 ca DEX ; 8 bytes / line
61e9 46 5e _shift LSR Long_CT+1
61eb 66 5d ROR Long_CT
61ed ca DEX
61ee d0 f9 BNE _shift
61f0 ab 5d 00 LDZ Long_CT ; row count
61f3 1b INZ
61f4 20 e1 ff _row JSR STOP
61f7 f0 06 BEQ _exit
61f9 20 f2 62 JSR Dump_Row
61fc 3b DEZ
61fd d0 f5 BNE _row
61ff 4c 90 60 _exit JMP Main
6202 EndMod [Mon_Memory] Size = 52 [$34]
*****************
Module Print_Bits
*****************
6202 db PHZ
6203 85 65 STA Long_DA
6205 a0 08 LDY #8
6207 a9 2a _loop LDA #'*'
6209 ff 65 02 BBS7 Long_DA,_set
620c a9 2e LDA #'.'
620e 20 d2 ff _set JSR CHROUT
6211 06 65 ASL Long_DA
6213 88 DEY
6214 d0 f1 BNE _loop
6216 fb PLZ
6217 60 RTS
6218 EndMod [Print_Bits] Size = 22 [$16]
***************
Module Mon_Bits
***************
6218 20 33 6a JSR Get_LAC ; get 1st. parameter
621b b0 03 BCS _lab
621d 20 4e 61 JSR LAC_To_LPC ; Long_PC = start address
6220 20 28 6b _lab JSR Print_CR
6223 a9 05 LDA #WHITE
6225 85 66 STA Long_DA+1
6227 a2 08 LDX #8
6229 da _row PHX
622a 20 f6 6a JSR Hex_LPC
622d a3 00 LDZ #0
622f 38 _col SEC
6230 a9 9b LDA #WHITE+LRED ; toggle colour
6232 e5 66 SBC Long_DA+1
6234 85 66 STA Long_DA+1
6236 20 d2 ff JSR CHROUT
6239 ea b2 61 LDA [Long_PC],Z
623c 20 02 62 JSR Print_Bits
623f 18 CLC
6240 6b TZA
6241 69 08 ADC #8
6243 4b TAZ
6244 c9 40 CMP #64
6246 7f d7 02 BBR7 MODE_80,_next
6249 c9 20 CMP #32
624b 90 e2 _next BCC _col
624d 20 28 6b JSR Print_CR
6250 20 af 61 JSR Inc_LPC
6253 fa PLX
6254 ca DEX
6255 d0 d2 BNE _row
6257 4c 90 60 JMP Main
625a EndMod [Mon_Bits] Size = 66 [$42]
***********************
Module Mon_Set_Register
***********************
625a 20 33 6a JSR Get_LAC ; get 1st. parameter
625d 20 3d 61 JSR LAC_To_PC
6260 a0 03 LDY #3
6262 20 33 6a _loop JSR Get_LAC
6265 b0 0a BCS _exit
6267 a5 59 LDA Long_AC
6269 99 02 00 STA Bank,Y
626c c8 INY
626d c0 09 CPY #9
626f 90 f1 BCC _loop
6271 4c 90 60 _exit JMP Main
6274 EndMod [Mon_Set_Register] Size = 26 [$1a]
*********************
Module Mon_Set_Memory
*********************
6274 20 33 6a JSR Get_LAC ; get 1st. parameter
6277 b0 1c BCS _exit
6279 20 4e 61 JSR LAC_To_LPC ; Long_PC = row address
627c a3 00 LDZ #0
627e 20 33 6a _loop JSR Get_LAC
6281 b0 12 BCS _exit
6283 a5 59 LDA Long_AC
6285 ff 64 01 BBS7 Long_PC+3,_banked ; trigger banked access
6288 ea NOP ; use STA [Long_PC],Z
6289 92 61 _banked STA (Long_PC),Z
628b 1b INZ
628c c2 10 CPZ #16
628e 7f d7 02 BBR7 MODE_80,_next
6291 c2 08 CPZ #8
6293 90 e9 _next BCC _loop
6295 20 7d ff _exit JSR PRIMM
6298 1b 4f .BYTE "\eO"
629a 91 00 .BYTE $91,$00
629c 20 f2 62 JSR Dump_Row
629f 4c 90 60 JMP Main
62a2 EndMod [Mon_Set_Memory] Size = 46 [$2e]
*************
Module Mon_Go
*************
62a2 20 33 6a JSR Get_LAC ; get 1st. parameter
62a5 20 3d 61 JSR LAC_To_PC
62a8 a6 0c LDX SPL
62aa 9a TXS
62ab 4c 71 ff JMP JMPFAR
62ae EndMod [Mon_Go] Size = 12 [$c]
**************
Module Mon_JSR
**************
62ae 20 33 6a JSR Get_LAC ; get 1st. parameter
62b1 20 3d 61 JSR LAC_To_PC
62b4 a6 0c LDX SPL
62b6 9a TXS
62b7 20 6e ff JSR JSRFAR
62ba ba TSX
62bb 86 0c STX SPL
62bd 4c 90 60 JMP Main
62c0 EndMod [Mon_JSR] Size = 18 [$12]
*******************
Module Dump_4_Bytes
*******************
62c0 20 d2 ff JSR CHROUT ; colour
62c3 ff 64 01 _loop BBS7 Long_PC+3,_banked ; trigger banked access
62c6 ea NOP ; use LDA [Long_PC],Z
62c7 b2 61 _banked LDA (Long_PC),Z
62c9 20 20 6b JSR Print_Hex_Blank
62cc 1b INZ
62cd 6b TZA
62ce 29 03 AND #3
62d0 d0 f1 BNE _loop
62d2 60 RTS
62d3 EndMod [Dump_4_Bytes] Size = 19 [$13]
*******************
Module Dump_4_Chars
*******************
62d3 a0 00 LDY #0
62d5 84 f4 STY QTSW ; disable quote mode
62d7 20 d2 ff JSR CHROUT ; colour
62da ff 64 01 _loop BBS7 Long_PC+3,_banked ; trigger banked access
62dd ea NOP ; use LDA [Long_PC],Z
62de b2 61 _banked LDA (Long_PC),Z
62e0 a8 TAY
62e1 29 60 AND #%0110 0000
62e3 d0 02 BNE _laba
62e5 a0 2e LDY #'.'
62e7 98 _laba TYA
62e8 20 d2 ff JSR CHROUT
62eb 1b INZ
62ec 6b TZA
62ed 29 03 AND #3
62ef d0 e9 BNE _loop
62f1 60 RTS
62f2 EndMod [Dump_4_Chars] Size = 31 [$1f]
***************
Module Dump_Row
***************
62f2 db PHZ
62f3 20 28 6b JSR Print_CR
62f6 a9 3e LDA #'>'
62f8 20 d2 ff JSR CHROUT
62fb 20 f6 6a JSR Hex_LPC
62fe a3 00 LDZ #0
6300 a2 02 LDX #2 ; 2 blocks in 80 columns
6302 7f d7 01 BBR7 MODE_80,_loop
6305 ca DEX ; 1 block in 40 columns
6306 a9 96 _loop LDA #LRED
6308 20 c0 62 JSR Dump_4_Bytes
630b a9 05 LDA #WHITE
630d 20 c0 62 JSR Dump_4_Bytes
6310 ca DEX
6311 d0 f3 BNE _loop
6313 20 7d ff JSR PRIMM
6316 12 00 .BYTE $12,$00 ; : reverse on
6318 a3 00 LDZ #0
631a a2 02 LDX #2 ; 4 blocks in 80 columns
631c 7f d7 01 BBR7 MODE_80,_lchr
631f ca DEX ; 2 blocks in 40 columns
6320 a9 96 _lchr LDA #LRED
6322 20 d3 62 JSR Dump_4_Chars
6325 a9 05 LDA #WHITE
6327 20 d3 62 JSR Dump_4_Chars
632a ca DEX
632b d0 f3 BNE _lchr
632d 6b TZA
632e 20 8e 6b JSR Add_LPC
6331 fb PLZ
6332 60 RTS
6333 EndMod [Dump_Row] Size = 65 [$41]
*******************
Module Mon_Transfer
*******************
6333 20 9c 6b JSR Param_Range ; Long_PC = source
6336 b3 86 fd LBCS Mon_Error ; Long_CT = count
6339 20 33 6a JSR Get_LAC ; Long_AC = target
633c b3 80 fd LBCS Mon_Error
633f a3 00 LDZ #0
6341 20 90 61 JSR LAC_Compare_LPC ; target - source
6344 90 1d BCC _forward
; source < target: backward transfer
6346 20 72 61 JSR LAC_Plus_LCT ; Long_AC = end of target
6349 ff 68 01 _lpback BBS7 Long_DA+3,_rb ; bit 31 ?
634c ea NOP ; LDA [Long_DA],Z
634d b2 65 _rb LDA (Long_DA),Z ; backward copy
634f ff 5c 01 BBS7 Long_AC+3,_wb ; bit 31 ?
6352 ea NOP ; STA [Long_AC],Z
6353 92 59 _wb STA (Long_AC),Z
6355 20 b6 61 JSR Dec_LDA
6358 20 a4 61 JSR Dec_LAC
635b 20 81 6b JSR Dec_LCT
635e 10 e9 BPL _lpback
6360 4c 90 60 JMP Main
6363 ff 64 01 _forward BBS7 Long_PC+3,_rf ; bit 31 ?
6366 ea NOP ; LDA [Long_PC],Z
6367 b2 61 _rf LDA (Long_PC),Z ; backward copy
6369 ff 5c 01 BBS7 Long_AC+3,_wf ; bit 31 ?
636c ea NOP ; STA [Long_AC],Z
636d 92 59 _wf STA (Long_AC),Z
636f 20 af 61 JSR Inc_LPC
6372 20 9d 61 JSR Inc_LAC
6375 20 81 6b JSR Dec_LCT
6378 10 e9 BPL _forward
637a 4c 90 60 JMP Main
637d EndMod [Mon_Transfer] Size = 74 [$4a]
******************
Module Mon_Compare
******************
637d 20 9c 6b JSR Param_Range ; Long_PC = source
6380 b3 3c fd LBCS Mon_Error ; Long_CT = count
6383 20 33 6a JSR Get_LAC ; Long_AC = target
6386 b3 36 fd LBCS Mon_Error
6389 20 28 6b JSR Print_CR
638c a3 00 LDZ #0
638e ff 64 01 _loop BBS7 Long_PC+3,_rf ; bit 31 ?
6391 ea NOP ; LDA [Long_PC],Z
6392 b2 61 _rf LDA (Long_PC),Z ; backward copy
6394 ff 5c 01 BBS7 Long_AC+3,_cf ; bit 31 ?
6397 ea NOP ; CMP [Long_AC],Z
6398 d2 59 _cf CMP (Long_AC),Z
639a f0 03 BEQ _laba
639c 20 f6 6a JSR Hex_LPC
639f 20 9d 61 _laba JSR Inc_LAC
63a2 20 af 61 JSR Inc_LPC
63a5 20 81 6b JSR Dec_LCT
63a8 10 e4 BPL _loop
63aa 4c 90 60 JMP Main
63ad EndMod [Mon_Compare] Size = 48 [$30]
***************
Module Mon_Hunt
***************
63ad 20 9c 6b JSR Param_Range ; Long_PC = start
63b0 b3 0c fd LBCS Mon_Error ; Long_CT = count
63b3 a0 00 LDY #0
63b5 20 65 6b JSR Get_Char
63b8 c9 27 CMP #APOSTR
63ba d0 17 BNE _bin
63bc 20 65 6b JSR Get_Char ; string hunt
63bf c9 00 CMP #0
63c1 f3 fb fc LBEQ Mon_Error ; null string
63c4 99 0e 04 _lpstr STA Mon_Data,Y
63c7 c8 INY
63c8 20 65 6b JSR Get_Char