-
Notifications
You must be signed in to change notification settings - Fork 78
/
c64disasm_cbm.txt
4909 lines (4907 loc) · 273 KB
/
c64disasm_cbm.txt
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
- Fully Commented Commodore 64 KERNAL ROM Disassembly (English, "CBM")
-
- The comments have been taken from
- The original C64 KERNAL source by Commodore (901227-03)
- https://github.com/mist64/cbmsrc
- https://www.pagetable.com/?p=894
-
- The comments here are basically a complete copy of the original
- source code, lined up with the version in the C64 ROM.
- This way, even all variable names are intact.
-
- Converted and formatted by Michael Steil <[email protected]>
-
- Corrections (formatting, lining up) welcome at:
- https://github.com/mist64/c64ref
-
------------------------------------------------------------
-
# This plain text file is formatted so that it can be automatically
# parsed in order to create cross-references etc.
# * Lines starting with "-" is top-level information. The first line
# is the title. Lines starting with "--" are separators.
# * Lines starting with "#" are internal comments.
# * Lines starting with ".," indicate code to be disassembled.
# * Lines starting with ".:" indicate bytes to be dumped.
# * Comments start at the 33rd column.
# * 32 leading spaces and ".LIB" indicate a heading.
# * Otherwise, 32 leading spaces indicate an overflow comment.
# The encoding is UTF-8.
.LIB DISCLAIMER
;****************************************
;* *
;* KK K EEEEE RRRR NN N AAA LL *
;* KK KK EE RR R NNN N AA A LL *
;* KKK EE RR R NNN N AA A LL *
;* KKK EEEE RRRR NNNNN AAAAA LL *
;* KK K EE RR R NN NN AA A LL *
;* KK KK EE RR R NN NN AA A LL *
;* KK KK EEEEE RR R NN NN AA A LLLLL *
;* *
;***************************************
;
;***************************************
;* PET KERNAL *
;* MEMORY AND I/O DEPENDENT ROUTINES *
;* DRIVING THE HARDWARE OF THE *
;* FOLLOWING CBM MODELS: *
;* COMMODORE 64 OR MODIFED VIC-40 *
;* COPYRIGHT (C) 1982 BY *
;* COMMODORE BUSINESS MACHINES (CBM) *
;***************************************
;****LISTING DATE --1200 14 MAY 1982****
;***************************************
;* THIS SOFTWARE IS FURNISHED FOR USE *
;* USE IN THE VIC OR COMMODORE COMPUTER*
;* SERIES ONLY. *
;* *
;* COPIES THEREOF MAY NOT BE PROVIDED *
;* OR MADE AVAILABLE FOR USE ON ANY *
;* OTHER SYSTEM. *
;* *
;* THE INFORMATION IN THIS DOCUMENT IS *
;* SUBJECT TO CHANGE WITHOUT NOTICE. *
;* *
;* NO RESPONSIBILITY IS ASSUMED FOR *
;* RELIABILITY OF THIS SOFTWARE. RSR *
;* *
;***************************************
.END
.LIB DECLARE
*=$0000 ;DECLARE 6510 PORTS
D6510 *=*+1 ;6510 DATA DIRECTION REGISTER
R6510 *=*+1 ;6510 DATA REGISTER
*=$0002 ;MISS 6510 REGS
;VIRTUAL REGS FOR MACHINE LANGUAGE MONITOR
PCH *=*+1
PCL *=*+1
FLGS *=*+1
ACC *=*+1
XR *=*+1
YR *=*+1
SP *=*+1
INVH *=*+1 ;USER MODIFIABLE IRQ
INVL *=*+1
* =$90
STATUS *=*+1 ;I/O OPERATION STATUS BYTE
; CRFAC *=*+2 ;CORRECTION FACTOR (UNUSED)
STKEY *=*+1 ;STOP KEY FLAG
SVXT *=*+1 ;TEMPORARY
VERCK *=*+1 ;LOAD OR VERIFY FLAG
C3P0 *=*+1 ;IEEE BUFFERED CHAR FLAG
BSOUR *=*+1 ;CHAR BUFFER FOR IEEE
SYNO *=*+1 ;CASSETTE SYNC #
XSAV *=*+1 ;TEMP FOR BASIN
LDTND *=*+1 ;INDEX TO LOGICAL FILE
DFLTN *=*+1 ;DEFAULT INPUT DEVICE #
DFLTO *=*+1 ;DEFAULT OUTPUT DEVICE #
PRTY *=*+1 ;CASSETTE PARITY
DPSW *=*+1 ;CASSETTE DIPOLE SWITCH
MSGFLG *=*+1 ;OS MESSAGE FLAG
PTR1 ;CASSETTE ERROR PASS1
T1 *=*+1 ;TEMPORARY 1
TMPC
PTR2 ;CASSETTE ERROR PASS2
T2 *=*+1 ;TEMPORARY 2
TIME *=*+3 ;24 HOUR CLOCK IN 1/60TH SECONDS
R2D2 ;SERIAL BUS USAGE
PCNTR *=*+1 ;CASSETTE STUFF
; PTCH *=*+1 (UNUSED)
BSOUR1 ;TEMP USED BY SERIAL ROUTINE
FIRT *=*+1
COUNT ;TEMP USED BY SERIAL ROUTINE
CNTDN *=*+1 ;CASSETTE SYNC COUNTDOWN
BUFPT *=*+1 ;CASSETTE BUFFER POINTER
INBIT ;RS-232 RCVR INPUT BIT STORAGE
SHCNL *=*+1 ;CASSETTE SHORT COUNT
BITCI ;RS-232 RCVR BIT COUNT IN
RER *=*+1 ;CASSETTE READ ERROR
RINONE ;RS-232 RCVR FLAG FOR START BIT CHECK
REZ *=*+1 ;CASSETE READING ZEROES
RIDATA ;RS-232 RCVR BYTE BUFFER
RDFLG *=*+1 ;CASSETTE READ MODE
RIPRTY ;RS-232 RCVR PARITY STORAGE
SHCNH *=*+1 ;CASSETTE SHORT CNT
SAL *=*+1
SAH *=*+1
EAL *=*+1
EAH *=*+1
CMP0 *=*+1
TEMP *=*+1
TAPE1 *=*+2 ;ADDRESS OF TAPE BUFFER #1Y.
BITTS ;RS-232 TRNS BIT COUNT
SNSW1 *=*+1
NXTBIT ;RS-232 TRNS NEXT BIT TO BE SENT
DIFF *=*+1
RODATA ;RS-232 TRNS BYTE BUFFER
PRP *=*+1
FNLEN *=*+1 ;LENGTH CURRENT FILE N STR
LA *=*+1 ;CURRENT FILE LOGICAL ADDR
SA *=*+1 ;CURRENT FILE 2ND ADDR
FA *=*+1 ;CURRENT FILE PRIMARY ADDR
FNADR *=*+2 ;ADDR CURRENT FILE NAME STR
ROPRTY ;RS-232 TRNS PARITY BUFFER
OCHAR *=*+1
FSBLK *=*+1 ;CASSETTE READ BLOCK COUNT
MYCH *=*+1
CAS1 *=*+1 ;CASSETTE MANUAL/CONTROLLED SWITCH
TMP0
STAL *=*+1
STAH *=*+1
MEMUSS ;CASSETTE LOAD TEMPS (2 BYTES)
TMP2 *=*+2
;
;VARIABLES FOR SCREEN EDITOR
;
LSTX *=*+1 ;KEY SCAN INDEX
; SFST *=*+1 ;KEYBOARD SHIFT FLAG (UNUSED)
NDX *=*+1 ;INDEX TO KEYBOARD Q
RVS *=*+1 ;RVS FIELD ON FLAG
INDX *=*+1
LSXP *=*+1 ;X POS AT START
LSTP *=*+1
SFDX *=*+1 ;SHIFT MODE ON PRINT
BLNSW *=*+1 ;CURSOR BLINK ENAB
BLNCT *=*+1 ;COUNT TO TOGGLE CUR
GDBLN *=*+1 ;CHAR BEFORE CURSOR
BLNON *=*+1 ;ON/OFF BLINK FLAG
CRSW *=*+1 ;INPUT VS GET FLAG
PNT *=*+2 ;POINTER TO ROW
; POINT *=*+1 (UNUSED)
PNTR *=*+1 ;POINTER TO COLUMN
QTSW *=*+1 ;QUOTE SWITCH
LNMX *=*+1 ;40/80 MAX POSITON
TBLX *=*+1
DATA *=*+1
INSRT *=*+1 ;INSERT MODE FLAG
LDTB1 *=*+26 ;LINE FLAGS+ENDSPACE
USER *=*+2 ;SCREEN EDITOR COLOR IP
KEYTAB *=*+2 ;KEYSCAN TABLE INDIRECT
;RS-232 Z-PAGE
RIBUF *=*+2 ;RS-232 INPUT BUFFER POINTER
ROBUF *=*+2 ;RS-232 OUTPUT BUFFER POINTER
FREKZP *=*+4 ;FREE KERNAL ZERO PAGE 9/24/80
BASZPT *=*+1 ;LOCATION ($00FF) USED BY BASIC
*=$100
BAD *=*+1
*=$200
BUF *=*+89 ;BASIC/MONITOR BUFFER
; TABLES FOR OPEN FILES
;
LAT *=*+10 ;LOGICAL FILE NUMBERS
FAT *=*+10 ;PRIMARY DEVICE NUMBERS
SAT *=*+10 ;SECONDARY ADDRESSES
; SYSTEM STORAGE
;
KEYD *=*+10 ;IRQ KEYBOARD BUFFER
MEMSTR *=*+2 ;START OF MEMORY
MEMSIZ *=*+2 ;TOP OF MEMORY
TIMOUT *=*+1 ;IEEE TIMEOUT FLAG
; SCREEN EDITOR STORAGE
;
COLOR *=*+1 ;ACTIV COLOR NYBBLE
GDCOL *=*+1 ;ORIGINAL COLOR BEFORE CURSOR
HIBASE *=*+1 ;BASE LOCATION OF SCREEN (TOP)
XMAX *=*+1
RPTFLG *=*+1 ;KEY REPEAT FLAG
KOUNT *=*+1
DELAY *=*+1
SHFLAG *=*+1 ;SHIFT FLAG BYTE
LSTSHF *=*+1 ;LAST SHIFT PATTERN
KEYLOG *=*+2 ;INDIRECT FOR KEYBOARD TABLE SETUP
MODE *=*+1 ;0-PET MODE, 1-CATTACANNA
AUTODN *=*+1 ;AUTO SCROLL DOWN FLAG(=0 ON,<>0 OFF)
; RS-232 STORAGE
;
M51CTR *=*+1 ;6551 CONTROL REGISTER
M51CDR *=*+1 ;6551 COMMAND REGISTER
M51AJB *=*+2 ;NON STANDARD (BITTIME/2-100)
RSSTAT *=*+1 ; RS-232 STATUS REGISTER
BITNUM *=*+1 ;NUMBER OF BITS TO SEND (FAST RESPONSE)
BAUDOF *=*+2 ;BAUD RATE FULL BIT TIME (CREATED BY OPEN)
;
; RECIEVER STORAGE
;
; INBIT *=*+1 ;INPUT BIT STORAGE
; BITCI *=*+1 ;BIT COUNT IN
; RINONE *=*+1 ;FLAG FOR START BIT CHECK
; RIDATA *=*+1 ;BYTE IN BUFFER
; RIPRTY *=*+1 ;BYTE IN PARITY STORAGE
RIDBE *=*+1 ;INPUT BUFFER INDEX TO END
RIDBS *=*+1 ;INPUT BUFFER POINTER TO START
;
; TRANSMITTER STORAGE
;
; BITTS *=*+1 ;# OF BITS TO BE SENT
; NXTBIT *=*+1 ;NEXT BIT TO BE SENT
; ROPRTY *=*+1 ;PARITY OF BYTE SENT
; RODATA *=*+1 ;BYTE BUFFER OUT
RODBS *=*+1 ;OUTPUT BUFFER INDEX TO START
RODBE *=*+1 ;OUTPUT BUFFER INDEX TO END
;
IRQTMP *=*+2 ;HOLDS IRQ DURING TAPE OPS
;
; TEMP SPACE FOR VIC-40 VARIABLES ****
;
ENABL *=*+1 ;RS-232 ENABLES (REPLACES IER)
CASTON *=*+1 ;TOD SENSE DURING CASSETTES
KIKA26 *=*+1 ;TEMP STORAGE FOR CASSETTE READ ROUTINE
STUPID *=*+1 ;TEMP D1IRQ INDICATOR FOR CASSETTE READ
LINTMP *=*+1 ;TEMPORARY FOR LINE INDEX
*=$0300 ;REM PROGRAM INDIRECTS(10)
*=$0300+20 ;REM KERNAL/OS INDIRECTS(20)
CINV *=*+2 ;IRQ RAM VECTOR
CBINV *=*+2 ;BRK INSTR RAM VECTOR
NMINV *=*+2 ;NMI RAM VECTOR
IOPEN *=*+2 ;INDIRECTS FOR CODE
ICLOSE *=*+2 ; CONFORMS TO KERNAL SPEC 8/19/80
ICHKIN *=*+2
ICKOUT *=*+2
ICLRCH *=*+2
IBASIN *=*+2
IBSOUT *=*+2
ISTOP *=*+2
IGETIN *=*+2
ICLALL *=*+2
USRCMD *=*+2
ILOAD *=*+2
ISAVE *=*+2 ;SAVESP
*=$0300+60
TBUFFR *=*+192 ;CASSETTE DATA BUFFER
* =$400
VICSCN *=*+1024
RAMLOC
; I/O DEVICES
;
* =$D000
VICREG =* ;VIC REGISTERS
* =$D400
SIDREG =* ;SID REGISTERS
* =$D800
VICCOL *=*+1024 ;VIC COLOR NYBBLES
* =$DC00 ;DEVICE1 6526 (PAGE1 IRQ)
COLM ;KEYBOARD MATRIX
D1PRA *=*+1
ROWS ;KEYBOARD MATRIX
D1PRB *=*+1
D1DDRA *=*+1
D1DDRB *=*+1
D1T1L *=*+1
D1T1H *=*+1
D1T2L *=*+1
D1T2H *=*+1
D1TOD1 *=*+1
D1TODS *=*+1
D1TODM *=*+1
D1TODH *=*+1
D1SDR *=*+1
D1ICR *=*+1
D1CRA *=*+1
D1CRB *=*+1
* =$DD00 ;DEVICE2 6526 (PAGE2 NMI)
D2PRA *=*+1
D2PRB *=*+1
D2DDRA *=*+1
D2DDRB *=*+1
D2T1L *=*+1
D2T1H *=*+1
D2T2L *=*+1
D2T2H *=*+1
D2TOD1 *=*+1
D2TODS *=*+1
D2TODM *=*+1
D2TODH *=*+1
D2SDR *=*+1
D2ICR *=*+1
D2CRA *=*+1
D2CRB *=*+1
TIMRB =$19 ;6526 CRB ENABLE ONE-SHOT TB
;TAPE BLOCK TYPES
;
EOT =5 ;END OF TAPE
BLF =1 ;BASIC LOAD FILE
BDF =2 ;BASIC DATA FILE
PLF =3 ;FIXED PROGRAM TYPE
BDFH =4 ;BASIC DATA FILE HEADER
BUFSZ =192 ;BUFFER SIZE
;
;SCREEN EDITOR CONSTANTS
;
LLEN =40 ;SINGLE LINE 40 COLUMNS
LLEN2 =80 ;DOUBLE LINE = 80 COLUMNS
NLINES =25 ;25 ROWS ON SCREEN
WHITE =$01 ;WHITE SCREEN COLOR
BLUE =$06 ;BLUE CHAR COLOR
CR =$D ;CARRIAGE RETURN
.END
*=$E500 ;START OF VIC-40 KERNAL
.LIB EDITOR.1
MAXCHR=80
NWRAP=2 ;MAX NUMBER OF PHYSICAL LINES PER LOGICAL LINE
;
;UNDEFINED FUNCTION ENTRY
;
; UNDEFD LDX #0
; UNDEF2 LDA UNMSG,X
; JSR PRT
; INX
; CPX #UNMSG2-UNMSG
; BNE UNDEF2
; SEC
; RTS
;
; UNMSG .BYT $D,'?ADVANCED FUNCTION NOT AVAILABLE',$D
; UNMSG2
;
;RETURN ADDRESS OF 6526
;
.,E500 A2 00 LDX #$00 IOBASE LDX #<D1PRA
.,E502 A0 DC LDY #$DC LDY #>D1PRA
.,E504 60 RTS RTS
;
;RETURN MAX ROWS,COLS OF SCREEN
;
.,E505 A2 28 LDX #$28 SCRORG LDX #LLEN
.,E507 A0 19 LDY #$19 LDY #NLINES
.,E509 60 RTS RTS
;
;READ/PLOT CURSOR POSITION
;
.,E50A B0 07 BCS $E513 PLOT BCS PLOT10
.,E50C 86 D6 STX $D6 STX TBLX
.,E50E 84 D3 STY $D3 STY PNTR
.,E510 20 6C E5 JSR $E56C JSR STUPT
.,E513 A6 D6 LDX $D6 PLOT10 LDX TBLX
.,E515 A4 D3 LDY $D3 LDY PNTR
.,E517 60 RTS RTS
;INITIALIZE I/O
;
CINT
;
; ESTABLISH SCREEN MEMORY
;
.,E518 20 A0 E5 JSR $E5A0 JSR PANIC ;SET UP VIC
;
.,E51B A9 00 LDA #$00 LDA #0 ;MAKE SURE WE'RE IN PET MODE
.,E51D 8D 91 02 STA $0291 STA MODE
.,E520 85 CF STA $CF STA BLNON ;WE DONT HAVE A GOOD CHAR FROM THE SCREEN YET
.,E522 A9 48 LDA #$48 LDA #<SHFLOG ;SET SHIFT LOGIC INDIRECTS
.,E524 8D 8F 02 STA $028F STA KEYLOG
.,E527 A9 EB LDA #$EB LDA #>SHFLOG
.,E529 8D 90 02 STA $0290 STA KEYLOG+1
.,E52C A9 0A LDA #$0A LDA #10
.,E52E 8D 89 02 STA $0289 STA XMAX ;MAXIMUM TYPE AHEAD BUFFER SIZE
.,E531 8D 8C 02 STA $028C STA DELAY
.,E534 A9 0E LDA #$0E LDA #$E ;INIT COLOR TO LIGHT BLUE<<<<<<<<<<
.,E536 8D 86 02 STA $0286 STA COLOR
.,E539 A9 04 LDA #$04 LDA #4
.,E53B 8D 8B 02 STA $028B STA KOUNT ;DELAY BETWEEN KEY REPEATS
.,E53E A9 0C LDA #$0C LDA #$C
.,E540 85 CD STA $CD STA BLNCT
.,E542 85 CC STA $CC STA BLNSW
.,E544 AD 88 02 LDA $0288 CLSR LDA HIBASE ;FILL HI BYTE PTR TABLE
.,E547 09 80 ORA #$80 ORA #$80
.,E549 A8 TAY TAY
.,E54A A9 00 LDA #$00 LDA #0
.,E54C AA TAX TAX
.,E54D 94 D9 STY $D9,X LPS1 STY LDTB1,X
.,E54F 18 CLC CLC
.,E550 69 28 ADC #$28 ADC #LLEN
.,E552 90 01 BCC $E555 BCC LPS2
.,E554 C8 INY INY ;CARRY BUMP HI BYTE
.,E555 E8 INX LPS2 INX
.,E556 E0 1A CPX #$1A CPX #NLINES+1 ;DONE # OF LINES?
.,E558 D0 F3 BNE $E54D BNE LPS1 ;NO...
.,E55A A9 FF LDA #$FF LDA #$FF ;TAG END OF LINE TABLE
.,E55C 95 D9 STA $D9,X STA LDTB1,X
.,E55E A2 18 LDX #$18 LDX #NLINES-1 ;CLEAR FROM THE BOTTOM LINE UP
.,E560 20 FF E9 JSR $E9FF CLEAR1 JSR CLRLN ;SEE SCROLL ROUTINES
.,E563 CA DEX DEX
.,E564 10 FA BPL $E560 BPL CLEAR1
;HOME FUNCTION
;
.,E566 A0 00 LDY #$00 NXTD LDY #0
.,E568 84 D3 STY $D3 STY PNTR ;LEFT COLUMN
.,E56A 84 D6 STY $D6 STY TBLX ;TOP LINE
;
;MOVE CURSOR TO TBLX,PNTR
;
STUPT
.,E56C A6 D6 LDX $D6 LDX TBLX ;GET CURENT LINE INDEX
.,E56E A5 D3 LDA $D3 LDA PNTR ;GET CHARACTER POINTER
.,E570 B4 D9 LDY $D9,X FNDSTR LDY LDTB1,X ;FIND BEGINING OF LINE
.,E572 30 08 BMI $E57C BMI STOK ;BRANCH IF START FOUND
.,E574 18 CLC CLC
.,E575 69 28 ADC #$28 ADC #LLEN ;ADJUST POINTER
.,E577 85 D3 STA $D3 STA PNTR
.,E579 CA DEX DEX
.,E57A 10 F4 BPL $E570 BPL FNDSTR
;
.,E57C 20 F0 E9 JSR $E9F0 STOK JSR SETPNT ;SET UP PNT INDIRECT 901227-03**********
;
.,E57F A9 27 LDA #$27 LDA #LLEN-1
.,E581 E8 INX INX
.,E582 B4 D9 LDY $D9,X FNDEND LDY LDTB1,X
.,E584 30 06 BMI $E58C BMI STDONE
.,E586 18 CLC CLC
.,E587 69 28 ADC #$28 ADC #LLEN
.,E589 E8 INX INX
.,E58A 10 F6 BPL $E582 BPL FNDEND
STDONE
.,E58C 85 D5 STA $D5 STA LNMX
.,E58E 4C 24 EA JMP $EA24 JMP SCOLOR ;MAKE COLOR POINTER FOLLOW 901227-03**********
; THIS IS A PATCH FOR INPUT LOGIC 901227-03**********
; FIXES INPUT"XXXXXXX-40-XXXXX";A$ PROBLEM
;
.,E591 E4 C9 CPX $C9 FINPUT CPX LSXP ;CHECK IF ON SAME LINE
.,E593 F0 03 BEQ $E598 BEQ FINPUX ;YES..RETURN TO SEND
.,E595 4C ED E6 JMP $E6ED JMP FINDST ;CHECK IF WE WRAPPED DOWN...
.,E598 60 RTS FINPUX RTS
.,E599 EA NOP NOP ;KEEP THE SPACE THE SAME...
;PANIC NMI ENTRY
;
.,E59A 20 A0 E5 JSR $E5A0 VPAN JSR PANIC ;FIX VIC SCREEN
.,E59D 4C 66 E5 JMP $E566 JMP NXTD ;HOME CURSOR
.,E5A0 A9 03 LDA #$03 PANIC LDA #3 ;RESET DEFAULT I/O
.,E5A2 85 9A STA $9A STA DFLTO
.,E5A4 A9 00 LDA #$00 LDA #0
.,E5A6 85 99 STA $99 STA DFLTN
;INIT VIC
;
.,E5A8 A2 2F LDX #$2F INITV LDX #47 ;LOAD ALL VIC REGS ***
.,E5AA BD B8 EC LDA $ECB8,X PX4 LDA TVIC-1,X
.,E5AD 9D FF CF STA $CFFF,X STA VICREG-1,X
.,E5B0 CA DEX DEX
.,E5B1 D0 F7 BNE $E5AA BNE PX4
.,E5B3 60 RTS RTS
;
;REMOVE CHARACTER FROM QUEUE
;
.,E5B4 AC 77 02 LDY $0277 LP2 LDY KEYD
.,E5B7 A2 00 LDX #$00 LDX #0
.,E5B9 BD 78 02 LDA $0278,X LP1 LDA KEYD+1,X
.,E5BC 9D 77 02 STA $0277,X STA KEYD,X
.,E5BF E8 INX INX
.,E5C0 E4 C6 CPX $C6 CPX NDX
.,E5C2 D0 F5 BNE $E5B9 BNE LP1
.,E5C4 C6 C6 DEC $C6 DEC NDX
.,E5C6 98 TYA TYA
.,E5C7 58 CLI CLI
.,E5C8 18 CLC CLC ;GOOD RETURN
.,E5C9 60 RTS RTS
;
.,E5CA 20 16 E7 JSR $E716 LOOP4 JSR PRT
LOOP3
.,E5CD A5 C6 LDA $C6 LDA NDX
.,E5CF 85 CC STA $CC STA BLNSW
.,E5D1 8D 92 02 STA $0292 STA AUTODN ;TURN ON AUTO SCROLL DOWN
.,E5D4 F0 F7 BEQ $E5CD BEQ LOOP3
.,E5D6 78 SEI SEI
.,E5D7 A5 CF LDA $CF LDA BLNON
.,E5D9 F0 0C BEQ $E5E7 BEQ LP21
.,E5DB A5 CE LDA $CE LDA GDBLN
.,E5DD AE 87 02 LDX $0287 LDX GDCOL ;RESTORE ORIGINAL COLOR
.,E5E0 A0 00 LDY #$00 LDY #0
.,E5E2 84 CF STY $CF STY BLNON
.,E5E4 20 13 EA JSR $EA13 JSR DSPP
.,E5E7 20 B4 E5 JSR $E5B4 LP21 JSR LP2
.,E5EA C9 83 CMP #$83 CMP #$83 ;RUN KEY?
.,E5EC D0 10 BNE $E5FE BNE LP22
.,E5EE A2 09 LDX #$09 LDX #9
.,E5F0 78 SEI SEI
.,E5F1 86 C6 STX $C6 STX NDX
.,E5F3 BD E6 EC LDA $ECE6,X LP23 LDA RUNTB-1,X
.,E5F6 9D 76 02 STA $0276,X STA KEYD-1,X
.,E5F9 CA DEX DEX
.,E5FA D0 F7 BNE $E5F3 BNE LP23
.,E5FC F0 CF BEQ $E5CD BEQ LOOP3
.,E5FE C9 0D CMP #$0D LP22 CMP #$D
.,E600 D0 C8 BNE $E5CA BNE LOOP4
.,E602 A4 D5 LDY $D5 LDY LNMX
.,E604 84 D0 STY $D0 STY CRSW
.,E606 B1 D1 LDA ($D1),Y CLP5 LDA (PNT)Y
.,E608 C9 20 CMP #$20 CMP #'
.,E60A D0 03 BNE $E60F BNE CLP6
.,E60C 88 DEY DEY
.,E60D D0 F7 BNE $E606 BNE CLP5
.,E60F C8 INY CLP6 INY
.,E610 84 C8 STY $C8 STY INDX
.,E612 A0 00 LDY #$00 LDY #0
.,E614 8C 92 02 STY $0292 STY AUTODN ;TURN OFF AUTO SCROLL DOWN
.,E617 84 D3 STY $D3 STY PNTR
.,E619 84 D4 STY $D4 STY QTSW
.,E61B A5 C9 LDA $C9 LDA LSXP
.,E61D 30 1B BMI $E63A BMI LOP5
.,E61F A6 D6 LDX $D6 LDX TBLX
.,E621 20 ED E6 JSR $E6ED JSR FINDST ;FIND 1ST PHYSICAL LINE
.,E624 E4 C9 CPX $C9 CPX LSXP
.,E626 D0 12 BNE $E63A BNE LOP5
.,E628 A5 CA LDA $CA LDA LSTP
.,E62A 85 D3 STA $D3 STA PNTR
.,E62C C5 C8 CMP $C8 CMP INDX
.,E62E 90 0A BCC $E63A BCC LOP5
.,E630 B0 2B BCS $E65D BCS CLP2
;INPUT A LINE UNTIL CARRIAGE RETURN
;
.,E632 98 TYA LOOP5 TYA
.,E633 48 PHA PHA
.,E634 8A TXA TXA
.,E635 48 PHA PHA
.,E636 A5 D0 LDA $D0 LDA CRSW
.,E638 F0 93 BEQ $E5CD BEQ LOOP3
.,E63A A4 D3 LDY $D3 LOP5 LDY PNTR
.,E63C B1 D1 LDA ($D1),Y LDA (PNT)Y
NOTONE
.,E63E 85 D7 STA $D7 STA DATA
.,E640 29 3F AND #$3F LOP51 AND #$3F
.,E642 06 D7 ASL $D7 ASL DATA
.,E644 24 D7 BIT $D7 BIT DATA
.,E646 10 02 BPL $E64A BPL LOP54
.,E648 09 80 ORA #$80 ORA #$80
.,E64A 90 04 BCC $E650 LOP54 BCC LOP52
.,E64C A6 D4 LDX $D4 LDX QTSW
.,E64E D0 04 BNE $E654 BNE LOP53
.,E650 70 02 BVS $E654 LOP52 BVS LOP53
.,E652 09 40 ORA #$40 ORA #$40
.,E654 E6 D3 INC $D3 LOP53 INC PNTR
.,E656 20 84 E6 JSR $E684 JSR QTSWC
.,E659 C4 C8 CPY $C8 CPY INDX
.,E65B D0 17 BNE $E674 BNE CLP1
.,E65D A9 00 LDA #$00 CLP2 LDA #0
.,E65F 85 D0 STA $D0 STA CRSW
.,E661 A9 0D LDA #$0D LDA #$D
.,E663 A6 99 LDX $99 LDX DFLTN ;FIX GETS FROM SCREEN
.,E665 E0 03 CPX #$03 CPX #3 ;IS IT THE SCREEN?
.,E667 F0 06 BEQ $E66F BEQ CLP2A
.,E669 A6 9A LDX $9A LDX DFLTO
.,E66B E0 03 CPX #$03 CPX #3
.,E66D F0 03 BEQ $E672 BEQ CLP21
.,E66F 20 16 E7 JSR $E716 CLP2A JSR PRT
.,E672 A9 0D LDA #$0D CLP21 LDA #$D
.,E674 85 D7 STA $D7 CLP1 STA DATA
.,E676 68 PLA PLA
.,E677 AA TAX TAX
.,E678 68 PLA PLA
.,E679 A8 TAY TAY
.,E67A A5 D7 LDA $D7 LDA DATA
.,E67C C9 DE CMP #$DE CMP #$DE ;IS IT <PI> ?
.,E67E D0 02 BNE $E682 BNE CLP7
.,E680 A9 FF LDA #$FF LDA #$FF
.,E682 18 CLC CLP7 CLC
.,E683 60 RTS RTS
.,E684 C9 22 CMP #$22 QTSWC CMP #$22
.,E686 D0 08 BNE $E690 BNE QTSWL
.,E688 A5 D4 LDA $D4 LDA QTSW
.,E68A 49 01 EOR #$01 EOR #$1
.,E68C 85 D4 STA $D4 STA QTSW
.,E68E A9 22 LDA #$22 LDA #$22
.,E690 60 RTS QTSWL RTS
.,E691 09 40 ORA #$40 NXT33 ORA #$40
.,E693 A6 C7 LDX $C7 NXT3 LDX RVS
.,E695 F0 02 BEQ $E699 BEQ NVS
.,E697 09 80 ORA #$80 NC3 ORA #$80
.,E699 A6 D8 LDX $D8 NVS LDX INSRT
.,E69B F0 02 BEQ $E69F BEQ NVS1
.,E69D C6 D8 DEC $D8 DEC INSRT
.,E69F AE 86 02 LDX $0286 NVS1 LDX COLOR PUT COLOR ON SCREEN
.,E6A2 20 13 EA JSR $EA13 JSR DSPP
.,E6A5 20 B6 E6 JSR $E6B6 JSR WLOGIC ;CHECK FOR WRAPAROUND
.,E6A8 68 PLA LOOP2 PLA
.,E6A9 A8 TAY TAY
.,E6AA A5 D8 LDA $D8 LDA INSRT
.,E6AC F0 02 BEQ $E6B0 BEQ LOP2
.,E6AE 46 D4 LSR $D4 LSR QTSW
.,E6B0 68 PLA LOP2 PLA
.,E6B1 AA TAX TAX
.,E6B2 68 PLA PLA
.,E6B3 18 CLC CLC ;GOOD RETURN
.,E6B4 58 CLI CLI
.,E6B5 60 RTS RTS
WLOGIC
.,E6B6 20 B3 E8 JSR $E8B3 JSR CHKDWN ;MAYBE WE SHOULD WE INCREMENT TBLX
.,E6B9 E6 D3 INC $D3 INC PNTR ;BUMP CHARCTER POINTER
.,E6BB A5 D5 LDA $D5 LDA LNMX ;
.,E6BD C5 D3 CMP $D3 CMP PNTR ;IF LNMX IS LESS THAN PNTR
.,E6BF B0 3F BCS $E700 BCS WLGRTS ;BRANCH IF LNMX>=PNTR
.,E6C1 C9 4F CMP #$4F CMP #MAXCHR-1 ;PAST MAX CHARACTERS
.,E6C3 F0 32 BEQ $E6F7 BEQ WLOG10 ;BRANCH IF SO
.,E6C5 AD 92 02 LDA $0292 LDA AUTODN ;SHOULD WE AUTO SCROLL DOWN?
.,E6C8 F0 03 BEQ $E6CD BEQ WLOG20 ;BRANCH IF NOT
.,E6CA 4C 67 E9 JMP $E967 JMP BMT1 ;ELSE DECIDE WHICH WAY TO SCROLL
WLOG20
.,E6CD A6 D6 LDX $D6 LDX TBLX ;SEE IF WE SHOULD SCROLL DOWN
.,E6CF E0 19 CPX #$19 CPX #NLINES
.,E6D1 90 07 BCC $E6DA BCC WLOG30 ;BRANCH IF NOT
.,E6D3 20 EA E8 JSR $E8EA JSR SCROL ;ELSE DO THE SCROL UP
.,E6D6 C6 D6 DEC $D6 DEC TBLX ;AND ADJUST CURENT LINE#
.,E6D8 A6 D6 LDX $D6 LDX TBLX
.,E6DA 16 D9 ASL $D9,X WLOG30 ASL LDTB1,X ;WRAP THE LINE
.,E6DC 56 D9 LSR $D9,X LSR LDTB1,X
.,E6DE E8 INX INX ;INDEX TO NEXT LLINE
.,E6DF B5 D9 LDA $D9,X LDA LDTB1,X ;GET HIGH ORDER BYTE OF ADDRESS
.,E6E1 09 80 ORA #$80 ORA #$80 ;MAKE IT A NON-CONTINUATION LINE
.,E6E3 95 D9 STA $D9,X STA LDTB1,X ;AND PUT IT BACK
.,E6E5 CA DEX DEX ;GET BACK TO CURRENT LINE
.,E6E6 A5 D5 LDA $D5 LDA LNMX ;CONTINUE THE BYTES TAKEN OUT
.,E6E8 18 CLC CLC
.,E6E9 69 28 ADC #$28 ADC #LLEN
.,E6EB 85 D5 STA $D5 STA LNMX
FINDST
.,E6ED B5 D9 LDA $D9,X LDA LDTB1,X ;IS THIS THE FIRST LINE?
.,E6EF 30 03 BMI $E6F4 BMI FINX ;BRANCH IF SO
.,E6F1 CA DEX DEX ;ELSE BACKUP 1
.,E6F2 D0 F9 BNE $E6ED BNE FINDST
FINX
.,E6F4 4C F0 E9 JMP $E9F0 JMP SETPNT ;MAKE SURE PNT IS RIGHT
.,E6F7 C6 D6 DEC $D6 WLOG10 DEC TBLX
.,E6F9 20 7C E8 JSR $E87C JSR NXLN
.,E6FC A9 00 LDA #$00 LDA #0
.,E6FE 85 D3 STA $D3 STA PNTR ;POINT TO FIRST BYTE
.,E700 60 RTS WLGRTS RTS
.,E701 A6 D6 LDX $D6 BKLN LDX TBLX
.,E703 D0 06 BNE $E70B BNE BKLN1
.,E705 86 D3 STX $D3 STX PNTR
.,E707 68 PLA PLA
.,E708 68 PLA PLA
.,E709 D0 9D BNE $E6A8 BNE LOOP2
;
.,E70B CA DEX BKLN1 DEX
.,E70C 86 D6 STX $D6 STX TBLX
.,E70E 20 6C E5 JSR $E56C JSR STUPT
.,E711 A4 D5 LDY $D5 LDY LNMX
.,E713 84 D3 STY $D3 STY PNTR
.,E715 60 RTS RTS
;PRINT ROUTINE
;
.,E716 48 PHA PRT PHA
.,E717 85 D7 STA $D7 STA DATA
.,E719 8A TXA TXA
.,E71A 48 PHA PHA
.,E71B 98 TYA TYA
.,E71C 48 PHA PHA
.,E71D A9 00 LDA #$00 LDA #0
.,E71F 85 D0 STA $D0 STA CRSW
.,E721 A4 D3 LDY $D3 LDY PNTR
.,E723 A5 D7 LDA $D7 LDA DATA
.,E725 10 03 BPL $E72A BPL *+5
.,E727 4C D4 E7 JMP $E7D4 JMP NXTX
.,E72A C9 0D CMP #$0D CMP #$D
.,E72C D0 03 BNE $E731 BNE NJT1
.,E72E 4C 91 E8 JMP $E891 JMP NXT1
.,E731 C9 20 CMP #$20 NJT1 CMP #'
.,E733 90 10 BCC $E745 BCC NTCN
.,E735 C9 60 CMP #$60 CMP #$60 ;LOWER CASE?
.,E737 90 04 BCC $E73D BCC NJT8 ;NO...
.,E739 29 DF AND #$DF AND #$DF ;YES...MAKE SCREEN LOWER
.,E73B D0 02 BNE $E73F BNE NJT9 ;ALWAYS
.,E73D 29 3F AND #$3F NJT8 AND #$3F
.,E73F 20 84 E6 JSR $E684 NJT9 JSR QTSWC
.,E742 4C 93 E6 JMP $E693 JMP NXT3
.,E745 A6 D8 LDX $D8 NTCN LDX INSRT
.,E747 F0 03 BEQ $E74C BEQ CNC3X
.,E749 4C 97 E6 JMP $E697 JMP NC3
.,E74C C9 14 CMP #$14 CNC3X CMP #$14
.,E74E D0 2E BNE $E77E BNE NTCN1
.,E750 98 TYA TYA
.,E751 D0 06 BNE $E759 BNE BAK1UP
.,E753 20 01 E7 JSR $E701 JSR BKLN
.,E756 4C 73 E7 JMP $E773 JMP BK2
.,E759 20 A1 E8 JSR $E8A1 BAK1UP JSR CHKBAK ;SHOULD WE DEC TBLX
.,E75C 88 DEY DEY
.,E75D 84 D3 STY $D3 STY PNTR
.,E75F 20 24 EA JSR $EA24 BK1 JSR SCOLOR ;FIX COLOR PTRS
.,E762 C8 INY BK15 INY
.,E763 B1 D1 LDA ($D1),Y LDA (PNT)Y
.,E765 88 DEY DEY
.,E766 91 D1 STA ($D1),Y STA (PNT)Y
.,E768 C8 INY INY
.,E769 B1 F3 LDA ($F3),Y LDA (USER)Y
.,E76B 88 DEY DEY
.,E76C 91 F3 STA ($F3),Y STA (USER)Y
.,E76E C8 INY INY
.,E76F C4 D5 CPY $D5 CPY LNMX
.,E771 D0 EF BNE $E762 BNE BK15
.,E773 A9 20 LDA #$20 BK2 LDA #'
.,E775 91 D1 STA ($D1),Y STA (PNT)Y
.,E777 AD 86 02 LDA $0286 LDA COLOR
.,E77A 91 F3 STA ($F3),Y STA (USER)Y
.,E77C 10 4D BPL $E7CB BPL JPL3
.,E77E A6 D4 LDX $D4 NTCN1 LDX QTSW
.,E780 F0 03 BEQ $E785 BEQ NC3W
.,E782 4C 97 E6 JMP $E697 CNC3 JMP NC3
.,E785 C9 12 CMP #$12 NC3W CMP #$12
.,E787 D0 02 BNE $E78B BNE NC1
.,E789 85 C7 STA $C7 STA RVS
.,E78B C9 13 CMP #$13 NC1 CMP #$13
.,E78D D0 03 BNE $E792 BNE NC2
.,E78F 20 66 E5 JSR $E566 JSR NXTD
.,E792 C9 1D CMP #$1D NC2 CMP #$1D
.,E794 D0 17 BNE $E7AD BNE NCX2
.,E796 C8 INY INY
.,E797 20 B3 E8 JSR $E8B3 JSR CHKDWN
.,E79A 84 D3 STY $D3 STY PNTR
.,E79C 88 DEY DEY
.,E79D C4 D5 CPY $D5 CPY LNMX
.,E79F 90 09 BCC $E7AA BCC NCZ2
.,E7A1 C6 D6 DEC $D6 DEC TBLX
.,E7A3 20 7C E8 JSR $E87C JSR NXLN
.,E7A6 A0 00 LDY #$00 LDY #0
.,E7A8 84 D3 STY $D3 JPL4 STY PNTR
.,E7AA 4C A8 E6 JMP $E6A8 NCZ2 JMP LOOP2
.,E7AD C9 11 CMP #$11 NCX2 CMP #$11
.,E7AF D0 1D BNE $E7CE BNE COLR1
.,E7B1 18 CLC CLC
.,E7B2 98 TYA TYA
.,E7B3 69 28 ADC #$28 ADC #LLEN
.,E7B5 A8 TAY TAY
.,E7B6 E6 D6 INC $D6 INC TBLX
.,E7B8 C5 D5 CMP $D5 CMP LNMX
.,E7BA 90 EC BCC $E7A8 BCC JPL4
.,E7BC F0 EA BEQ $E7A8 BEQ JPL4
.,E7BE C6 D6 DEC $D6 DEC TBLX
.,E7C0 E9 28 SBC #$28 CURS10 SBC #LLEN
.,E7C2 90 04 BCC $E7C8 BCC GOTDWN
.,E7C4 85 D3 STA $D3 STA PNTR
.,E7C6 D0 F8 BNE $E7C0 BNE CURS10
.,E7C8 20 7C E8 JSR $E87C GOTDWN JSR NXLN
.,E7CB 4C A8 E6 JMP $E6A8 JPL3 JMP LOOP2
.,E7CE 20 CB E8 JSR $E8CB COLR1 JSR CHKCOL ;CHECK FOR A COLOR
.,E7D1 4C 44 EC JMP $EC44 JMP LOWER ;WAS JMP LOOP2
;CHECK COLOR
;
;SHIFTED KEYS
;
NXTX
KEEPIT
.,E7D4 29 7F AND #$7F AND #$7F
.,E7D6 C9 7F CMP #$7F CMP #$7F
.,E7D8 D0 02 BNE $E7DC BNE NXTX1
.,E7DA A9 5E LDA #$5E LDA #$5E
NXTX1
NXTXA
.,E7DC C9 20 CMP #$20 CMP #$20 ;IS IT A FUNCTION KEY
.,E7DE 90 03 BCC $E7E3 BCC UHUH
.,E7E0 4C 91 E6 JMP $E691 JMP NXT33
UHUH
.,E7E3 C9 0D CMP #$0D CMP #$D
.,E7E5 D0 03 BNE $E7EA BNE UP5
.,E7E7 4C 91 E8 JMP $E891 JMP NXT1
.,E7EA A6 D4 LDX $D4 UP5 LDX QTSW
.,E7EC D0 3F BNE $E82D BNE UP6
.,E7EE C9 14 CMP #$14 CMP #$14
.,E7F0 D0 37 BNE $E829 BNE UP9
.,E7F2 A4 D5 LDY $D5 LDY LNMX
.,E7F4 B1 D1 LDA ($D1),Y LDA (PNT)Y
.,E7F6 C9 20 CMP #$20 CMP #'
.,E7F8 D0 04 BNE $E7FE BNE INS3
.,E7FA C4 D3 CPY $D3 CPY PNTR
.,E7FC D0 07 BNE $E805 BNE INS1
.,E7FE C0 4F CPY #$4F INS3 CPY #MAXCHR-1
.,E800 F0 24 BEQ $E826 BEQ INSEXT ;EXIT IF LINE TOO LONG
.,E802 20 65 E9 JSR $E965 JSR NEWLIN ;SCROLL DOWN 1
.,E805 A4 D5 LDY $D5 INS1 LDY LNMX
.,E807 20 24 EA JSR $EA24 JSR SCOLOR
.,E80A 88 DEY INS2 DEY
.,E80B B1 D1 LDA ($D1),Y LDA (PNT)Y
.,E80D C8 INY INY
.,E80E 91 D1 STA ($D1),Y STA (PNT)Y
.,E810 88 DEY DEY
.,E811 B1 F3 LDA ($F3),Y LDA (USER)Y
.,E813 C8 INY INY
.,E814 91 F3 STA ($F3),Y STA (USER)Y
.,E816 88 DEY DEY
.,E817 C4 D3 CPY $D3 CPY PNTR
.,E819 D0 EF BNE $E80A BNE INS2
.,E81B A9 20 LDA #$20 LDA #$20
.,E81D 91 D1 STA ($D1),Y STA (PNT)Y
.,E81F AD 86 02 LDA $0286 LDA COLOR
.,E822 91 F3 STA ($F3),Y STA (USER)Y
.,E824 E6 D8 INC $D8 INC INSRT
.,E826 4C A8 E6 JMP $E6A8 INSEXT JMP LOOP2
.,E829 A6 D8 LDX $D8 UP9 LDX INSRT
.,E82B F0 05 BEQ $E832 BEQ UP2
.,E82D 09 40 ORA #$40 UP6 ORA #$40
.,E82F 4C 97 E6 JMP $E697 JMP NC3
.,E832 C9 11 CMP #$11 UP2 CMP #$11
.,E834 D0 16 BNE $E84C BNE NXT2
.,E836 A6 D6 LDX $D6 LDX TBLX
.,E838 F0 37 BEQ $E871 BEQ JPL2
.,E83A C6 D6 DEC $D6 DEC TBLX
.,E83C A5 D3 LDA $D3 LDA PNTR
.,E83E 38 SEC SEC
.,E83F E9 28 SBC #$28 SBC #LLEN
.,E841 90 04 BCC $E847 BCC UPALIN
.,E843 85 D3 STA $D3 STA PNTR
.,E845 10 2A BPL $E871 BPL JPL2
.,E847 20 6C E5 JSR $E56C UPALIN JSR STUPT
.,E84A D0 25 BNE $E871 BNE JPL2
.,E84C C9 12 CMP #$12 NXT2 CMP #$12
.,E84E D0 04 BNE $E854 BNE NXT6
.,E850 A9 00 LDA #$00 LDA #0
.,E852 85 C7 STA $C7 STA RVS
.,E854 C9 1D CMP #$1D NXT6 CMP #$1D
.,E856 D0 12 BNE $E86A BNE NXT61
.,E858 98 TYA TYA
.,E859 F0 09 BEQ $E864 BEQ BAKBAK
.,E85B 20 A1 E8 JSR $E8A1 JSR CHKBAK
.,E85E 88 DEY DEY
.,E85F 84 D3 STY $D3 STY PNTR
.,E861 4C A8 E6 JMP $E6A8 JMP LOOP2
.,E864 20 01 E7 JSR $E701 BAKBAK JSR BKLN
.,E867 4C A8 E6 JMP $E6A8 JMP LOOP2
.,E86A C9 13 CMP #$13 NXT61 CMP #$13
.,E86C D0 06 BNE $E874 BNE SCCL
.,E86E 20 44 E5 JSR $E544 JSR CLSR
.,E871 4C A8 E6 JMP $E6A8 JPL2 JMP LOOP2
SCCL
.,E874 09 80 ORA #$80 ORA #$80 ;MAKE IT UPPER CASE
.,E876 20 CB E8 JSR $E8CB JSR CHKCOL ;TRY FOR COLOR
.,E879 4C 4F EC JMP $EC4F JMP UPPER ;WAS JMP LOOP2
;
.,E87C 46 C9 LSR $C9 NXLN LSR LSXP
.,E87E A6 D6 LDX $D6 LDX TBLX
.,E880 E8 INX NXLN2 INX
.,E881 E0 19 CPX #$19 CPX #NLINES ;OFF BOTTOM?
.,E883 D0 03 BNE $E888 BNE NXLN1 ;NO...
.,E885 20 EA E8 JSR $E8EA JSR SCROL ;YES...SCROLL
.,E888 B5 D9 LDA $D9,X NXLN1 LDA LDTB1,X ;DOUBLE LINE?
.,E88A 10 F4 BPL $E880 BPL NXLN2 ;YES...SCROLL AGAIN
.,E88C 86 D6 STX $D6 STX TBLX
.,E88E 4C 6C E5 JMP $E56C JMP STUPT
NXT1
.,E891 A2 00 LDX #$00 LDX #0
.,E893 86 D8 STX $D8 STX INSRT
.,E895 86 C7 STX $C7 STX RVS
.,E897 86 D4 STX $D4 STX QTSW
.,E899 86 D3 STX $D3 STX PNTR
.,E89B 20 7C E8 JSR $E87C JSR NXLN
.,E89E 4C A8 E6 JMP $E6A8 JPL5 JMP LOOP2
;
;
; CHECK FOR A DECREMENT TBLX
;
.,E8A1 A2 02 LDX #$02 CHKBAK LDX #NWRAP
.,E8A3 A9 00 LDA #$00 LDA #0
.,E8A5 C5 D3 CMP $D3 CHKLUP CMP PNTR
.,E8A7 F0 07 BEQ $E8B0 BEQ BACK
.,E8A9 18 CLC CLC
.,E8AA 69 28 ADC #$28 ADC #LLEN
.,E8AC CA DEX DEX
.,E8AD D0 F6 BNE $E8A5 BNE CHKLUP
.,E8AF 60 RTS RTS
;
.,E8B0 C6 D6 DEC $D6 BACK DEC TBLX
.,E8B2 60 RTS RTS
;
; CHECK FOR INCREMENT TBLX
;
.,E8B3 A2 02 LDX #$02 CHKDWN LDX #NWRAP
.,E8B5 A9 27 LDA #$27 LDA #LLEN-1
.,E8B7 C5 D3 CMP $D3 DWNCHK CMP PNTR
.,E8B9 F0 07 BEQ $E8C2 BEQ DNLINE
.,E8BB 18 CLC CLC
.,E8BC 69 28 ADC #$28 ADC #LLEN
.,E8BE CA DEX DEX
.,E8BF D0 F6 BNE $E8B7 BNE DWNCHK
.,E8C1 60 RTS RTS
;
.,E8C2 A6 D6 LDX $D6 DNLINE LDX TBLX
.,E8C4 E0 19 CPX #$19 CPX #NLINES
.,E8C6 F0 02 BEQ $E8CA BEQ DWNBYE
.,E8C8 E6 D6 INC $D6 INC TBLX
;
.,E8CA 60 RTS DWNBYE RTS
CHKCOL
.,E8CB A2 0F LDX #$0F LDX #15 ;THERE'S 15 COLORS
.,E8CD DD DA E8 CMP $E8DA,X CHK1A CMP COLTAB,X
.,E8D0 F0 04 BEQ $E8D6 BEQ CHK1B
.,E8D2 CA DEX DEX
.,E8D3 10 F8 BPL $E8CD BPL CHK1A
.,E8D5 60 RTS RTS
;
CHK1B
.,E8D6 8E 86 02 STX $0286 STX COLOR ;CHANGE THE COLOR
.,E8D9 60 RTS RTS
COLTAB
;BLK,WHT,RED,CYAN,MAGENTA,GRN,BLUE,YELLOW
.:E8DA 90 05 1C 9F 9C 1E 1F 9E .BYT $90,$05,$1C,$9F,$9C,$1E,$1F,$9E
.:E8E2 81 95 96 97 98 99 9A 9B .BYT $81,$95,$96,$97,$98,$99,$9A,$9B
.END
;.LIB CONKAT (JAPAN CONVERSION TABLES)
.LIB EDITOR.2
;SCREEN SCROLL ROUTINE
;
.,E8EA A5 AC LDA $AC SCROL LDA SAL
.,E8EC 48 PHA PHA
.,E8ED A5 AD LDA $AD LDA SAH
.,E8EF 48 PHA PHA
.,E8F0 A5 AE LDA $AE LDA EAL
.,E8F2 48 PHA PHA
.,E8F3 A5 AF LDA $AF LDA EAH
.,E8F5 48 PHA PHA
;
; S C R O L L U P
;
.,E8F6 A2 FF LDX #$FF SCRO0 LDX #$FF
.,E8F8 C6 D6 DEC $D6 DEC TBLX
.,E8FA C6 C9 DEC $C9 DEC LSXP
.,E8FC CE A5 02 DEC $02A5 DEC LINTMP
.,E8FF E8 INX SCR10 INX ;GOTO NEXT LINE
.,E900 20 F0 E9 JSR $E9F0 JSR SETPNT ;POINT TO 'TO' LINE
.,E903 E0 18 CPX #$18 CPX #NLINES-1 ;DONE?
.,E905 B0 0C BCS $E913 BCS SCR41 ;BRANCH IF SO
;
.,E907 BD F1 EC LDA $ECF1,X LDA LDTB2+1,X ;SETUP FROM PNTR
.,E90A 85 AC STA $AC STA SAL
.,E90C B5 DA LDA $DA,X LDA LDTB1+1,X
.,E90E 20 C8 E9 JSR $E9C8 JSR SCRLIN ;SCROLL THIS LINE UP1
.,E911 30 EC BMI $E8FF BMI SCR10
;
SCR41
.,E913 20 FF E9 JSR $E9FF JSR CLRLN
;
.,E916 A2 00 LDX #$00 LDX #0 ;SCROLL HI BYTE POINTERS
.,E918 B5 D9 LDA $D9,X SCRL5 LDA LDTB1,X
.,E91A 29 7F AND #$7F AND #$7F
.,E91C B4 DA LDY $DA,X LDY LDTB1+1,X
.,E91E 10 02 BPL $E922 BPL SCRL3
.,E920 09 80 ORA #$80 ORA #$80
.,E922 95 D9 STA $D9,X SCRL3 STA LDTB1,X
.,E924 E8 INX INX
.,E925 E0 18 CPX #$18 CPX #NLINES-1
.,E927 D0 EF BNE $E918 BNE SCRL5
;
.,E929 A5 F1 LDA $F1 LDA LDTB1+NLINES-1
.,E92B 09 80 ORA #$80 ORA #$80
.,E92D 85 F1 STA $F1 STA LDTB1+NLINES-1
.,E92F A5 D9 LDA $D9 LDA LDTB1 ;DOUBLE LINE?
.,E931 10 C3 BPL $E8F6 BPL SCRO0 ;YES...SCROLL AGAIN
;
.,E933 E6 D6 INC $D6 INC TBLX
.,E935 EE A5 02 INC $02A5 INC LINTMP
.,E938 A9 7F LDA #$7F LDA #$7F ;CHECK FOR CONTROL KEY
.,E93A 8D 00 DC STA $DC00 STA COLM ;DROP LINE 2 ON PORT B
.,E93D AD 01 DC LDA $DC01 LDA ROWS
.,E940 C9 FB CMP #$FB CMP #$FB ;SLOW SCROLL KEY?(CONTROL)
.,E942 08 PHP PHP ;SAVE STATUS. RESTORE PORT B
.,E943 A9 7F LDA #$7F LDA #$7F ;FOR STOP KEY CHECK
.,E945 8D 00 DC STA $DC00 STA COLM
.,E948 28 PLP PLP
.,E949 D0 0B BNE $E956 BNE MLP42
;
.,E94B A0 00 LDY #$00 LDY #0
.,E94D EA NOP MLP4 NOP ;DELAY
.,E94E CA DEX DEX
.,E94F D0 FC BNE $E94D BNE MLP4
.,E951 88 DEY DEY
.,E952 D0 F9 BNE $E94D BNE MLP4
.,E954 84 C6 STY $C6 STY NDX ;CLEAR KEY QUEUE BUFFER