-
Notifications
You must be signed in to change notification settings - Fork 1
/
bsmon.asm
3532 lines (3051 loc) · 77.3 KB
/
bsmon.asm
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 *
*************
WHITE = $05
YELLOW = $9e
LRED = $96
CR = $0d
REV = $12
CRIGHT = $1d
QUOTE = $22
APOSTR = $27
************************************************
* Register storage for JMPFAR and JSRFAR calls *
************************************************
Bank = 2
PCH = 3
PCL = 4
SR = 5
AC = 6
XR = 7
YR = 8
ZR = 9
*************************************
* Used direct (zero) page addresses *
*************************************
BP = 10
SPH = 11
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
& = $59
Long_AC .BSS 4 ; 32 bit accumulator
Long_CT .BSS 4 ; 32 bit counter
Long_PC .BSS 4 ; 32 bit program counter
Long_DA .BSS 4 ; 32 bit data pointer
; Flags are used in BBR BBS instructions
Adr_Flags .BSS 1
Mode_Flags .BSS 1
Op_Code .BSS 1
Op_Flag .BSS 1 ; 7: two operands
; 6: long branch
; 5: 32 bit address
; 4: Q register
Op_Size .BSS 1
Dig_Cnt .BSS 1
Buf_Index .BSS 1
; operating system variables
STATUS = $90
VERCK = $93
FNLEN = $b7
SA = $b9
FA = $ba
FNADR = $bb
BA = $bd
FNBANK = $be
NDX = $d0 ; length of keyboard buffer
MODE_80 = $d7 ; 80 column / 40 volumn flag
B_Margin = $e4 ; SCBOT default = 24
T_Margin = $e5 ; SCTOP default = 0
L_Margin = $e6 ; SCLF default = 0
R_Margin = $e7 ; SCRT default = 39 or 79
QTSW = $f4 ; Quote switch
Stack = $0100
Buffer = $0200 ; input buffer
IIRQ = $0314
IBRK = $0316
EXMON = $032e
& = $400 ; bottom of BASIC runtime stack
; should be a safe space
Ix_Mne .BSS 1 ; index to mnemonics table
Op_Mne .BSS 3 ; 3 bytes for mnemonic
Op_Ix .BSS 1 ; type of constant
Op_Len .BSS 1 ; length of operand
Disk_Unit .BSS 1 ; target unit
Disk_Src .BSS 1 ; source unit
Disk_Track .BSS 1 ; logical track 1 -> 255
Disk_Sector .BSS 1 ; logical sector 0 -> 255
Disk_Status .BSS 1 ; BCD value of status
File_Ext .BSS 3 ; file extension
Mon_Data .BSS 40 ; buffer for hunt and filename
Disk_Msg .BSS 40 ; disk status as text message
EXIT = $cfaf ; exit address for ROM 92xxxx
SETBNK = $ff6b
JSRFAR = $ff6e
JMPFAR = $ff71
LDA_FAR = $ff74
STA_FAR = $ff77
CMP_FAR = $ff7a
PRIMM = $ff7d
CINT = $ff81
IOINIT = $ff84
SETMSG = $ff90
SECOND = $ff93
TKSA = $ff96
MEMTOP = $ff99
MEMBOT = $ff9c
KEY = $ff9f
SETTMO = $ffa2
ACPTR = $ffa5
CIOUT = $ffa8
UNTALK = $ffab
UNLSN = $ffae
LISTEN = $ffb1
TALK = $ffb4
READSS = $ffb7
SETLFS = $ffba
SETNAM = $ffbd
OPEN = $ffc0
CLOSE = $ffc3
CHKIN = $ffc6
CHKOUT = $ffc9
CLRCHN = $ffcc
CHRIN = $ffcf
CHROUT = $ffd2
LOAD = $ffd5
SAVE = $ffd8
SETTIM = $ffdb
GETTIM = $ffde
STOP = $ffe1
GETIN = $ffe4
CLALL = $ffe7
SCAN = $ffea
SCRORG = $ffed
PLOT = $fff0
* = $1fff
.STORE $1fff,$0101,"bsm.prg"
*************
Module header
*************
.WORD $2001 ; load address
.WORD Link ; line link
.WORD 2021 ; line number
.BYTE $fe,$02 ; BANK token
.BYTE "0:" ; BANK argument
.BYTE $9e ; SYS token
.BYTE "(8235):" ; $202d
.BYTE $8f ; REM token
.BYTE " BIT SHIFTER 01-JAN-21",0
Link .WORD 0 ; BASIC end marker
; copy image to $030000
SEI
; map memory to monitor configuration
LDA #$a0
LDX #$82
LDY #$00
LDZ #$83
MAP
EOM
; VIC IV registers visible
LDA #$47
STA $d02f
LDA #$53
STA $d02f
; toggle write protection
LDA #$70
STA $D640
NOP
LDZ #0
STZ Long_AC
LDA #$21
STA Long_AC+1
STZ Long_CT
STZ Long_CT+1
LDA #3
STA Long_CT+2
STZ Long_CT+3
LDX #$20
_loop LDA (Long_AC),Z
STA [Long_CT],Z
INZ
BNE _loop
INC Long_AC+1
INC Long_CT+1
DEX
BNE _loop
LDA #$70
STA $D640 ; toggle write protection
NOP
RTS
EndMod
.FILL $2100-* (0)
* = $6000
********************
Monitor_Call ; $6000
********************
JMP Mon_Call
*********************
Monitor_Break ; $6003
*********************
JMP Mon_Break
**********************
Monitor_Switch ; $6009
**********************
JMP Mon_Switch
****************
Module Mon_Break
****************
JSR PRIMM
.BYTE "\rBREAK\a",0
JSR Print_Commands
; pull BP, Z, Y, X, A,SR,PCL,PCH
; 7 6 5 4 3 2 1 0
LDX #7
_loop PLA
STA PCH,X
DEX
BPL _loop
; decrement PC to point after BRK
LDA PCL
BNE _nopage
DEC PCH
_nopage DEC PCL
LDA $011d
BBR7 Bank,_bank
LDA $011f
_bank AND #15
STA Bank
BRA Mon_Start
EndMod
***************
Module Mon_Call
***************
JSR Print_Commands
; clear register for monitor call
LDA #0
LDX #6
_loop STA AC,X
DEX
BPL _loop
; set default PC to "exit to BASIC"
LDA #<EXIT ; ROM 911110
LDX #>EXIT
_store STA PCL
STX PCH
EndMod
****************
Module Mon_Start
****************
CLD
TSY
STY SPH
TSX
STX SPL
LDA #$c0
JSR SETMSG
CLI
NOP
EndMod
***************************
Module Mon_Register ; $6042
***************************
JSR Reg_Text
; print Bank,PCH
LDY #0
_loopa LDA Bank,Y
JSR Print_Hex
INY
CPY #2
BCC _loopa
; print SR,PCL,A,X,Y,Z,BP
_loopb LDA Bank,Y
JSR Print_Hex_Blank
INY
CPY #9
BCC _loopb
; print 16 bit stack pointer
LDA SPH
JSR Print_Hex
LDA SPL
JSR Print_Hex_Blank
; print flags
LDY #8
LDA SR
_loopc ASL A
PHA
LDA #'-'
BCC _flag
LDA #'1'
_flag JSR CHROUT
PLA
DEY
BNE _loopc
EndMod
***********
Module Main
***********
JSR Print_CR
LDX #0
; read one line into buffer
******
Main_A
******
_loop JSR CHRIN
STA Buffer,X
INX
CPX #80
BCS Mon_Error ; input too long
CMP #CR
BNE _loop
LDA #0
STA Buf_Index
STA Buffer-1,X ; terminate buffer
_getcomm JSR Get_Char
BEQ Main
CMP #' '
BEQ _getcomm
EndMod
*****************
Module Mon_Switch
*****************
LDX #24
_loop CMP Command_Char,X
BEQ Mon_Select
DEX
BPL _loop
; fall through to error routine if not found
****************
Module Mon_Error
****************
; put a question mark at the end of the text
JSR PRIMM
.BYTE "\eO",CRIGHT,'?',0
LDX #$f8 ; reset stack pointer
TXS
BRA Main
*****************
Module Mon_Select
*****************
STA VERCK
CPX #23
LBCS Load_Save
TXA
ASL A
TAX
JMP (Jump_Table,X)
EndMod
**************
Print_Commands
**************
JSR PRIMM
.BYTE CR,YELLOW,REV,"BS MONITOR COMMANDS:"
************
Command_Char
************
; 0123456789abcdef
.BYTE "ABCDFGHJMRTUX@.>;?"
***********
Cons_Prefix
***********
.BYTE "$+&%'"
****************
Load_Save_Verify
****************
.BYTE "LSV",WHITE,0
RTS
**********
Jump_Table
**********
.WORD Mon_Assemble ; A
.WORD Mon_Bits ; B
.WORD Mon_Compare ; C
.WORD Mon_Disassemble ; D
.WORD Mon_Fill ; F
.WORD Mon_Go ; G
.WORD Mon_Hunt ; H
.WORD Mon_JSR ; J
.WORD Mon_Memory ; M
.WORD Mon_Register ; R
.WORD Mon_Transfer ; T
.WORD Mon_Unit_Copy ; U
.WORD EXIT ; X
.WORD Mon_DOS ; @
.WORD Mon_Assemble ; .
.WORD Mon_Set_Memory ; >
.WORD Mon_Set_Register ; ;
.WORD Mon_Help ; ?
.WORD Converter ; $
.WORD Converter ; +
.WORD Converter ; &
.WORD Converter ; %
.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
BCS _error
LDA Long_AC
STA Bank+2
LDA Long_AC+1
STA Bank+1
LDA Long_AC+2
ORA Long_AC+3
STA Bank
_error RTS
EndMod
*****************
Module LAC_To_LPC
*****************
PHX
LDX #3
_loop LDA Long_AC,X
STA Long_PC,X
DEX
BPL _loop
PLX
RTS
EndMod
*****************
Module LAC_To_LCT
*****************
PHX
LDX #3
_loop LDA Long_AC,X
STA Long_CT,X
DEX
BPL _loop
PLX
RTS
EndMod
*****************
Module LAC_To_LDA
*****************
PHX
LDX #3
_loop LDA Long_AC,X
STA Long_DA,X
DEX
BPL _loop
PLX
RTS
EndMod
*******************
Module LAC_Plus_LCT
*******************
PHX
LDX #252 ; use ZP wrap around
CLC
_loop LDA Long_AC+4,X
ADC Long_CT+4,X
STA Long_AC+4,X
INX
BNE _loop
PLX
RTS
EndMod
********************
Module LAC_Minus_LPC
********************
PHX
LDX #252 ; use ZP wrap around
SEC
_loop LDA Long_AC+4,X
SBC Long_PC+4,X
STA Long_CT+4,X
INX
BNE _loop
PLX
RTS
EndMod
**********************
Module LAC_Compare_LPC
**********************
PHX
LDX #252 ; use ZP wrap around
SEC
_loop LDA Long_AC+4,X
SBC Long_PC+4,X
INX
BNE _loop
PLX
RTS
EndMod
**************
Module Inc_LAC
**************
INW Long_AC
BNE _return
INW Long_AC+2
_return RTS
EndMod
**************
Module Dec_LAC
**************
LDA Long_AC
ORA Long_AC+1
BNE _skip
DEW Long_AC+2
_skip DEW Long_AC
RTS
EndMod
**************
Module Inc_LPC
**************
INW Long_PC
BNE _return
INW Long_PC+2
_return RTS
EndMod
**************
Module Dec_LDA
**************
LDA Long_DA
ORA Long_DA+1
BNE _skip
DEW Long_DA+2
_skip DEW Long_DA
RTS
EndMod
************
Module Fetch
************
PHZ
TYA
TAZ
BBS7 Long_PC+3,_banked ; trigger banked access
NOP ; use LDA [Long_PC],Z
_banked LDA (Long_PC),Z
PLZ
AND #$ff
RTS
EndMod
*****************
Module Mon_Memory
*****************
JSR Get_LAC ; get 1st. parameter
LDZ #16 ; default row count
BCS _row ; no address
JSR LAC_To_LPC ; Long_PC = start address
JSR Get_LAC ; Long_AC = end address
BCS _row ; not given
JSR LAC_Minus_LPC ; Long_CT = range
LBCC Mon_Error ; negative range -> error
LDX #4 ; 16 bytes / line
BBR7 MODE_80,_shift
DEX ; 8 bytes / line
_shift LSR Long_CT+1
ROR Long_CT
DEX
BNE _shift
LDZ Long_CT ; row count
INZ
_row JSR STOP
BEQ _exit
JSR Dump_Row
DEZ
BNE _row
_exit JMP Main
EndMod
*****************
Module Print_Bits
*****************
PHZ
STA Long_DA
LDY #8
_loop LDA #'*'
BBS7 Long_DA,_set
LDA #'.'
_set JSR CHROUT
ASL Long_DA
DEY
BNE _loop
PLZ
RTS
EndMod
***************
Module Mon_Bits
***************
JSR Get_LAC ; get 1st. parameter
BCS _lab
JSR LAC_To_LPC ; Long_PC = start address
_lab JSR Print_CR
LDA #WHITE
STA Long_DA+1
LDX #8
_row PHX
JSR Hex_LPC
LDZ #0
_col SEC
LDA #WHITE+LRED ; toggle colour
SBC Long_DA+1
STA Long_DA+1
JSR CHROUT
LDA [Long_PC],Z
JSR Print_Bits
CLC
TZA
ADC #8
TAZ
CMP #64
BBR7 MODE_80,_next
CMP #32
_next BCC _col
JSR Print_CR
JSR Inc_LPC
PLX
DEX
BNE _row
JMP Main
EndMod
***********************
Module Mon_Set_Register
***********************
JSR Get_LAC ; get 1st. parameter
JSR LAC_To_PC
LDY #3
_loop JSR Get_LAC
BCS _exit
LDA Long_AC
STA Bank,Y
INY
CPY #9
BCC _loop
_exit JMP Main
EndMod
*********************
Module Mon_Set_Memory
*********************
JSR Get_LAC ; get 1st. parameter
BCS _exit
JSR LAC_To_LPC ; Long_PC = row address
LDZ #0
_loop JSR Get_LAC
BCS _exit
LDA Long_AC
BBS7 Long_PC+3,_banked ; trigger banked access
NOP ; use STA [Long_PC],Z
_banked STA (Long_PC),Z
INZ
CPZ #16
BBR7 MODE_80,_next
CPZ #8
_next BCC _loop
_exit JSR PRIMM
.BYTE "\eO"
.BYTE $91,$00
JSR Dump_Row
JMP Main
EndMod
*************
Module Mon_Go
*************
JSR Get_LAC ; get 1st. parameter
JSR LAC_To_PC
LDX SPL
TXS
JMP JMPFAR
EndMod
**************
Module Mon_JSR
**************
JSR Get_LAC ; get 1st. parameter
JSR LAC_To_PC
LDX SPL
TXS
JSR JSRFAR
TSX
STX SPL
JMP Main
EndMod
*******************
Module Dump_4_Bytes
*******************
JSR CHROUT ; colour
_loop BBS7 Long_PC+3,_banked ; trigger banked access
NOP ; use LDA [Long_PC],Z
_banked LDA (Long_PC),Z
JSR Print_Hex_Blank
INZ
TZA
AND #3
BNE _loop
RTS
EndMod
*******************
Module Dump_4_Chars
*******************
LDY #0
STY QTSW ; disable quote mode
JSR CHROUT ; colour
_loop BBS7 Long_PC+3,_banked ; trigger banked access
NOP ; use LDA [Long_PC],Z
_banked LDA (Long_PC),Z
TAY
AND #%0110 0000
BNE _laba
LDY #'.'
_laba TYA
JSR CHROUT
INZ
TZA
AND #3
BNE _loop
RTS
EndMod
***************
Module Dump_Row
***************
PHZ
JSR Print_CR
LDA #'>'
JSR CHROUT
JSR Hex_LPC
LDZ #0
LDX #2 ; 2 blocks in 80 columns
BBR7 MODE_80,_loop
DEX ; 1 block in 40 columns
_loop LDA #LRED
JSR Dump_4_Bytes
LDA #WHITE
JSR Dump_4_Bytes
DEX
BNE _loop
JSR PRIMM
.BYTE $12,$00 ; : reverse on
LDZ #0
LDX #2 ; 4 blocks in 80 columns
BBR7 MODE_80,_lchr
DEX ; 2 blocks in 40 columns
_lchr LDA #LRED
JSR Dump_4_Chars
LDA #WHITE
JSR Dump_4_Chars
DEX
BNE _lchr
TZA
JSR Add_LPC
PLZ
RTS
EndMod
*******************
Module Mon_Transfer
*******************
JSR Param_Range ; Long_PC = source
LBCS Mon_Error ; Long_CT = count
JSR Get_LAC ; Long_AC = target
LBCS Mon_Error
LDZ #0
JSR LAC_Compare_LPC ; target - source
BCC _forward
; source < target: backward transfer
JSR LAC_Plus_LCT ; Long_AC = end of target
_lpback BBS7 Long_DA+3,_rb ; bit 31 ?
NOP ; LDA [Long_DA],Z
_rb LDA (Long_DA),Z ; backward copy
BBS7 Long_AC+3,_wb ; bit 31 ?
NOP ; STA [Long_AC],Z
_wb STA (Long_AC),Z
JSR Dec_LDA
JSR Dec_LAC
JSR Dec_LCT
BPL _lpback
JMP Main
_forward BBS7 Long_PC+3,_rf ; bit 31 ?
NOP ; LDA [Long_PC],Z
_rf LDA (Long_PC),Z ; backward copy
BBS7 Long_AC+3,_wf ; bit 31 ?
NOP ; STA [Long_AC],Z
_wf STA (Long_AC),Z
JSR Inc_LPC
JSR Inc_LAC
JSR Dec_LCT
BPL _forward
JMP Main
EndMod
******************
Module Mon_Compare
******************
JSR Param_Range ; Long_PC = source
LBCS Mon_Error ; Long_CT = count
JSR Get_LAC ; Long_AC = target
LBCS Mon_Error
JSR Print_CR
LDZ #0
_loop BBS7 Long_PC+3,_rf ; bit 31 ?
NOP ; LDA [Long_PC],Z
_rf LDA (Long_PC),Z ; backward copy
BBS7 Long_AC+3,_cf ; bit 31 ?
NOP ; CMP [Long_AC],Z
_cf CMP (Long_AC),Z
BEQ _laba
JSR Hex_LPC
_laba JSR Inc_LAC
JSR Inc_LPC
JSR Dec_LCT
BPL _loop
JMP Main
EndMod
***************
Module Mon_Hunt
***************
JSR Param_Range ; Long_PC = start
LBCS Mon_Error ; Long_CT = count
LDY #0
JSR Get_Char
CMP #APOSTR
BNE _bin
JSR Get_Char ; string hunt
CMP #0
LBEQ Mon_Error ; null string
_lpstr STA Mon_Data,Y
INY
JSR Get_Char