-
Notifications
You must be signed in to change notification settings - Fork 9
/
ccgmsterm.s
7432 lines (7422 loc) · 97 KB
/
ccgmsterm.s
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
;
; CCGMS Term (6502 assembly source for Commodore 64)
; Copyright (C) Craig Smith, 1986-1988, 2016
; All rights reserved.
;
; Resurrected and released to world September 5, 2016.
; Permission is granted to modify and distribute this work under
; the terms of the BSD 3-clause license.
; See the LICENSE.txt file for details.
;
; Version 5.5/5.5+ (ported to build with ca65)
;
; This file contains combined source from the original SEQ files (named
; 5a.gs,5b.gs,5c.gs and 5d.gs) in CBM Assembler 64 format and chained
; together using .FIL directives because the entire source could not
; fit into a C64's memory using the CBM editor. The encoding of this
; file has been converted to ASCII (with lowercase labels), and strings
; containing the PETSCII left arrow character ($5F) have been changed
; to its numeric code so modern or cross-platform assemblers do not
; treat it as '_'.
;
; This source can be compiled using the ca65 portable 6502 compiler.
; Except for the conversion to ASCII and the addition of feature
; and conditional directives (.feature/.if/.endif), the format of
; this file remains compatible with CBM Assembler 64.
; (The .feature directives below enable this compatibility.)
;
.feature labels_without_colons
.feature loose_string_term
.ifndef historical
historical = 0 ; define to 1 to make this source produce an exact image of
;ccgms term 5.5, bug per bug. ;setting it to zero fixes the bdpal bug,
;removes internal padding between ;the punter code and ccgms code, and
;disabled the 'script kiddie' protection ;(see 'decode' routine)
.endif
; MODERN = feature enabled only modern build, not historical
.define MODERN .not(historical)
;
; Conditional compilation symbols:
;
toward24 = MODERN ; Enable "Toward 2400" new modem chrout/chkin/nmi routines by George Hug
xmodfix = MODERN ; Enable XModem last char fix
nohayes12 = MODERN ; Don't downgrade to 1200 baud to send commands on Hayes modems
autocrlf = MODERN ; ASCII converts CR to CR/LF
v55plus = 1 ; Enable the bug fix and minor changes made in 5.5+
hack24 = 0 ; Enable 2400 baud hack from alwyz (superceded by toward24 fix)
swiftlib = MODERN ; Experimental/unfinished
.if historical
.feature pc_assignment
.endif
ccgms = 1
;.opt err ;no list!!!
modreg = $dd01
datdir = $dd03
rdtim = $ffde
frmevl = $ad9e
outnum = $bdcd
nmivec = $0318
status = $90
modemln= $05
modem = $02
secadr = $03
setlfs = $ffba
setnam = $ffbd
open = $ffc0
chkin = $ffc6
chkout = $ffc9
chrin = $ffcf
chrout = $ffd2
getin = $ffe4
close = $ffc3
clrchn = $ffcc
clall = $ffe7
readst = $ffb7
plot = $fff0
listen = $ffb1
second = $ff93
talk = $ffb4
tksa = $ff96
unlsn = $ffae
untlk = $ffab
acptr = $ffa5
ciout = $ffa8
numfil = $98
locat = $fb
nlocat = $fd
xmobuf = $fd
inpbuf = $0200
backgr = $d021
border = $d020
textcl = 646
clcode = $e8da
scrtop = 648
line = 214
column = 211
llen = 213
qmode = 212
imode = 216
bcolor = 0
tcolor = 15
cursor = 95 ;cursor "_"
left = $9d
cursfl = $fe
buffst = $b2
bufptr = $b0
grasfl = $0313
duplex = $12
tempch = $05
tempcl = $06
mulfil = $c200
rinput = $cf00
routpt = $ce00
.if swiftlib
slReceiveBuf = rinput
slSendBuf = routpt
.endif
bufend = routpt
mulcnt = 2047
mulfln = 2046
mlsall = 2045
mulskp = 2044
max = $02
begpos = $07
endpos = $ac
bufflg = $0b
buffl2 = $0c
buffoc = $10
pnt10 = $0200
pnt11 = $028d
pnt12 = $029b
pnt13 = $029c
pnt14 = $02a1
.if historical
pbuf = $1000 ; else defined later, right before 'start'
;there was no good reason for this arbitrary location, and it made us set
;the pc to leave a gap for it.
.endif
pbuf2 = $0400 ; when this buffer was moved to screen memory, the gap where
;it was used to be wasn't closed, leaving the area at label 'garbage'
xmoscn = pbuf2
can = 24
ack = 6
nak = 21
eot = 4
soh = 1
cpmeof = 26
;
;Commodore Color Graphics
;Manipulation System Terminal
;by Craig Smith
;
;version 2016 -- sep 2016
;version 5.5+ -- feb 1988
;version 5.5 -- jan 1988
;version 5.0 -- jan 1988
;version 4.5 -- may 1987
;version 4.1 -- oct 1986
;version 4.0 -- date unknown
; mods by greg pfoutz,w/permission
;version 3.0 -- aug 1985
;
.if historical
*=$0801
.else
.org $0801
.endif
.byt $0d,$08,$0a,00,$9e,$32,$30
.byt $36,$33,20,$39,00,00,00
jmp start
;
punter ; source code $0812
;referenced by old $c000 addresses
;*=$0812 ;pxxxxx
p49152 lda #$00
.byt $2c
p49155 lda #$03
.byt $2c
p49158 lda #$06
.byt $2c
p49161 lda #$09
.byt $2c
p49164 lda #$0c
.byt $2c
p49167 lda #$0f
nop
p49170 jmp pnt23
p49173 jmp pnt109
pnt23 sta $62
tsx
stx pbuf+28
lda #<pnttab
clc
adc $62
sta pntjmp+1
lda #>pnttab
adc #$00
sta pntjmp+2
pntjmp jmp pnttab
pnttab jmp pnt28
jmp pnt87
jmp pnt84
jmp pnt95
jmp pnt99
jmp pnt110
pnt27 .byt 'goobadacks/bsyn'
pnt28 sta pbuf+5
lda #$00
sta pbuf
sta pbuf+1
sta pbuf+2
pnt29 lda #$00
sta pbuf+6
sta pbuf+7
pnt30 jsr pnt114
jsr pnt38
lda $96
bne pnt35
lda pbuf+1
sta pbuf
lda pbuf+2
sta pbuf+1
lda pnt10
sta pbuf+2
lda #$00
sta pbuf+4
lda #$01
sta pbuf+3
pnt31 lda pbuf+5
bit pbuf+3
beq pnt33
ldy pbuf+4
ldx #$00
pnt32 lda pbuf,x
cmp pnt27,y
bne pnt33
iny
inx
cpx #$03
bne pnt32
jmp pnt34
pnt33 asl pbuf+3
lda pbuf+4
clc
adc #$03
sta pbuf+4
cmp #$0f
bne pnt31
jmp pnt111
pnt34 lda #$ff
sta pbuf+6
sta pbuf+7
jmp pnt30
pnt35 inc pbuf+6
bne pnt36
inc pbuf+7
pnt36 lda pbuf+7
ora pbuf+6
beq pnt37
lda pbuf+6
cmp #$07
lda pbuf+7
cmp #$14
bcc pnt30
lda #$01
sta $96
jmp pnt101
pnt37 lda #$00
sta $96
rts
nop
pnt38
.if swiftlib
lda swiftout
beq pnt38c
tya
pha
jsr slGetByte
bcs pnt38a
ldy #0
cpx #0
bne pnt38b
pnt38a
lda #0
ldy #2
pnt38b
sty $96
sta pnt10
pla
tay
rts
pnt38c
.endif
jmp pnt122
nop
nop
pnt39 cmp pnt13
beq pnt40
ldy pnt13
lda ($f7),y
pha
inc pnt13
lda #$00
sta $96
pla
sta pnt10
pla
tay
jmp pnt41
pnt40 lda #$02
sta $96
lda #$00
sta pnt10
pla
tay
pnt41 pha
lda #$03
sta $ba
pla
rts
pnt42 ldx #modemln
jsr chkout
ldx #$00
pnt43 lda pnt27,y
jsr chrout
iny
inx
cpx #$03
bne pnt43
jmp pnt118
pnt44 sta pbuf+8
lda #$00
sta pbuf+11
pnt45 lda #$02
sta $62
ldy pbuf+8
jsr pnt42
pnt46 lda #$04
jsr pnt28
lda $96
beq pnt47
dec $62
bne pnt46
jmp pnt45
pnt47 ldy #$09
jsr pnt42
lda pbuf+13
beq pnt48
lda pbuf+8
beq pnt50
pnt48 lda pbuf2+4
sta pbuf+9
sta pbuf+23
jsr pnt65
lda $96
cmp #$01
beq pnt49
cmp #$02
beq pnt47
cmp #$04
beq pnt49
cmp #$08
beq pnt47
pnt49 rts
pnt50 lda #$10
jsr pnt28
lda $96
bne pnt47
lda #$0a
sta pbuf+9
pnt51 ldy #$0c
jsr pnt42
lda #$08
jsr pnt28
lda $96
beq pnt52
dec pbuf+9
bne pnt51
pnt52 rts
pnt53 lda #$01
sta pbuf+11
pnt54 lda pbuf+30
beq pnt55
ldy #$00
jsr pnt42
pnt55 lda #$0b
jsr pnt28
lda $96
bne pnt54
lda #$00
sta pbuf+30
lda pbuf+4
cmp #$00
bne pnt59
lda pbuf+13
bne pnt61
inc pbuf+25
bne pnt56
inc pbuf+26
pnt56 jsr pnt79
ldy #$05
iny
lda ($64),y
cmp #$ff
bne pnt57
lda #$01
sta pbuf+13
lda pbuf+22
eor #$01
sta pbuf+22
jsr pnt79
jsr pnt77
jmp pnt58
pnt57 jsr pnt74
pnt58 lda #'-'
.byt $2c
pnt59 lda #':'
jsr pnt107
ldy #$06
jsr pnt42
lda #$08
jsr pnt28
lda $96
bne pnt58
jsr pnt79
ldy #$04
lda ($64),y
sta pbuf+9
jsr pnt80
ldx #modemln
jsr chkout
ldy #$00
pnt60 lda ($64),y
jsr pnt123
iny
cpy pbuf+9
bne pnt60
jsr clrchn
lda #$00
rts
pnt61 lda #'*'
jsr pnt107
ldy #$06
jsr pnt42
lda #$08
jsr pnt28
lda $96
bne pnt61
lda #$0a
sta pbuf+9
pnt62 ldy #$0c
jsr pnt42
lda #$10
jsr pnt28
lda $96
beq pnt63
dec pbuf+9
bne pnt62
pnt63 lda #$03
sta pbuf+9
pnt64 ldy #$09
jsr pnt42
lda #$00
jsr pnt28
dec pbuf+9
bne pnt64
lda #$01
rts
pnt65 ldy #$00
pnt66 lda #$00
sta pbuf+6
sta pbuf+7
pnt67 jsr pnt114
jsr pnt38
lda $96
bne pnt70
lda pnt10
sta pbuf2,y
cpy #$03
bcs pnt68
sta pbuf,y
cpy #$02
bne pnt68
lda pbuf
cmp #$41
bne pnt68
lda pbuf+1
cmp #$43
bne pnt68
lda pbuf+2
cmp #$4b
beq pnt69
pnt68 iny
cpy pbuf+9
bne pnt66
lda #$01
sta $96
rts
pnt69 lda #$ff
sta pbuf+6
sta pbuf+7
jmp pnt67
pnt70 inc pbuf+6
bne pnt71
inc pbuf+7
pnt71 lda pbuf+6
ora pbuf+7
beq pnt73
lda pbuf+6
cmp #$06
lda pbuf+7
cmp #$10
bne pnt67
lda #$02
sta $96
cpy #$00
beq pnt72
lda #$04
sta $96
pnt72 jmp pnt101
pnt73 lda #$08
sta $96
rts
pnt74 lda pbuf+22
eor #$01
sta pbuf+22
jsr pnt79
ldy #$05
lda pbuf+25
clc
adc #$01
sta ($64),y
iny
lda pbuf+26
adc #$00
sta ($64),y
ldx #$02
jsr chkin
ldy #$07
pnt75 jsr chrin
sta ($64),y
iny
jsr readst
bne pnt76
cpy pbuf+24
bne pnt75
tya
pha
jmp pnt78
pnt76 tya
pha
ldy #$05
iny
lda #$ff
sta ($64),y
jmp pnt78
pnt77 pha
pnt78 jsr clrchn
jsr pnt109
jsr pnt103
jsr pnt109
ldy #$04
lda ($64),y
sta pbuf+9
jsr pnt80
pla
ldy #$04
sta ($64),y
jsr pnt81
rts
pnt79 lda #<pbuf2
sta $64
lda pbuf+22
clc
adc #>pbuf2
sta $65
rts
pnt80 lda #<pbuf2
sta $64
lda pbuf+22
eor #$01
clc
adc #>pbuf2
sta $65
rts
pnt81 lda #$00
sta pbuf+18
sta pbuf+19
sta pbuf+20
sta pbuf+21
ldy #$04
pnt82 lda pbuf+18
clc
adc ($64),y
sta pbuf+18
bcc pnt83
inc pbuf+19
pnt83 lda pbuf+20
eor ($64),y
sta pbuf+20
lda pbuf+21
rol a
rol pbuf+20
rol pbuf+21
iny
cpy pbuf+9
bne pnt82
ldy #$00
lda pbuf+18
sta ($64),y
iny
lda pbuf+19
sta ($64),y
iny
lda pbuf+20
sta ($64),y
iny
lda pbuf+21
sta ($64),y
rts
pnt84 lda #$00
sta pbuf+13
sta pbuf+12
sta pbuf+29
lda #$01
sta pbuf+22
lda #$ff
sta pbuf+25
sta pbuf+26
jsr pnt80
ldy #$04
lda #$07
sta ($64),y
jsr pnt79
ldy #$05
lda #$00
sta ($64),y
iny
sta ($64),y
pnt85 jsr pnt53
beq pnt85
pnt86 lda #$00
sta pnt10
rts
pnt87 lda #$01
sta pbuf+25
lda #$00
sta pbuf+26
sta pbuf+13
sta pbuf+22
sta pbuf2+5
sta pbuf2+6
sta pbuf+12
lda #$07
sta pbuf2+4
lda #$00
pnt88 jsr pnt44
lda pbuf+13
bne pnt86
jsr pnt93
bne pnt92
jsr clrchn
lda pbuf+9
cmp #$07
beq pnt90
ldx #$02
jsr chkout
ldy #$07
pnt89 lda pbuf2,y
jsr chrout
iny
cpy pbuf+9
bne pnt89
jsr clrchn
pnt90 lda pbuf2+6
cmp #$ff
bne pnt91
lda #$01
sta pbuf+13
lda #'*'
.byt $2c
pnt91 lda #'-'
jsr goobad
jsr pnt109
lda #$00
jmp pnt88
pnt92 jsr clrchn
lda #':'
jsr goobad
lda pbuf+23
sta pbuf2+4
lda #$03
jmp pnt88
pnt93 lda pbuf2
sta pbuf+14
lda pbuf2+1
sta pbuf+15
lda pbuf2+2
sta pbuf+16
lda pbuf2+3
sta pbuf+17
jsr pnt79
lda pbuf+23
sta pbuf+9
jsr pnt81
lda pbuf2
cmp pbuf+14
bne pnt94
lda pbuf2+1
cmp pbuf+15
bne pnt94
lda pbuf2+2
cmp pbuf+16
bne pnt94
lda pbuf2+3
cmp pbuf+17
bne pnt94
lda #$00
rts
pnt94 lda #$01
rts
pnt95 lda #$00
sta pbuf+25
sta pbuf+26
sta pbuf+13
sta pbuf+22
sta pbuf+12
lda #$07
clc
adc #$01
sta pbuf2+4
lda #$00
pnt96 jsr pnt44
lda pbuf+13
bne pnt98
jsr pnt93
bne pnt97
lda pbuf2+7
sta pbuf+27
lda #$01
sta pbuf+13
lda #$00
jmp pnt96
pnt97 lda pbuf+23
sta pbuf2+4
lda #$03
jmp pnt96
pnt98 lda #$00
sta pnt10
rts
pnt99 lda #$00
sta pbuf+13
sta pbuf+12
lda #$01
sta pbuf+22
sta pbuf+29
lda #$ff
sta pbuf+25
sta pbuf+26
jsr pnt80
ldy #$04
lda #$07
clc
adc #$01
sta ($64),y
jsr pnt79
ldy #$05
lda #$ff
sta ($64),y
iny
sta ($64),y
ldy #$07
lda pbuf+27
sta ($64),y
lda #$01
sta pbuf+30
pnt100 jsr pnt53
beq pnt100
lda #$00
sta pnt10
rts
pnt101 inc pbuf+12
lda pbuf+12
cmp #$03
bcc pnt102
lda #$00
sta pbuf+12
lda pbuf+11
beq pnt103
bne pnt106
pnt102 lda pbuf+11
beq pnt106
pnt103 ldx #$00
pnt104 ldy #$00
pnt105 iny
bne pnt105
inx
cpx #$78
bne pnt104
pnt106 rts
pnt107 pha
lda pbuf+25
ora pbuf+26
beq pnt108
lda pbuf+29
bne pnt108
pla
jsr goobad
pha
pnt108 pla
rts
pnt109 jsr $ef7e
lda pnt14
cmp #$80
beq pnt109
cmp #$92
beq pnt109
rts
pnt110 rts
pnt111 ldx #$00
pnt112 lda pbuf2,x
cmp #$0d
bne pnt113
inx
cpx #$03
bcc pnt112
jmp pnt120
pnt113 jmp pnt29
pnt114 lda pnt11
cmp #$02
bne pnt116
pnt115 pla
tsx
cpx pbuf+28
bne pnt115
pnt116 lda #$01
sta pnt10
pnt117 rts
brk
pnt118 jsr clrchn
pnt119 lda $dd01
and #$00 ;and #$10 for carrier
beq pnt117 ;check and abort
pnt120 tsx
cpx pbuf+28
beq pnt121
pla
sec
bcs pnt120
pnt121 lda #$80
sta pnt10
jsr clrchn
rts
pnt122 tya
pha
jsr pnt119
lda pnt12
jmp pnt39
pnt123 pha
jsr pnt119
pla
jmp chrout
brk
ptrtxt .byt 13,13,5,'NEW Punter ',00
upltxt .byt 'Up',00
dowtxt .byt 'Down',00
lodtxt .byt 'load.',13,00
flntxt .byt 'Enter filename: ',00
xfrmed .byt 13,158,32,32,0
xfrtxt .byt 'loading: ',159,0
xf2txt .byt 13,5,' (','Press C= to abort.)',13,13,00
abrtxt .byt 'Aborted.',13,00
mrgtxt .byt 153,32,'Good Blocks: ',5,'000',5,' - '
.byt 153,'Bad Blocks: ',5,'000',13,0
gfxtxt .byt 153,'Graphics',00
asctxt .byt 159,'ASCII',00
rdytxt .byt ' Terminal Ready.',155,13,13,00
dsctxt .byt 13,5,'Disconnected.',13,13,0
drtype .byt 'd','s','p','u','r'
drtyp2 .byt 'e','e','r','s','e'
drtyp3 .byt 'l','q','g','r','l'
drform .byt 158,2,157,157,5,6,32,159,14,153,32,63,32,0
;the following was garbage memory in the gap between the punter
;source at *=$0812 and the main ccgms source (originally *=$1020).
;the last 32 bytes, from $1000-$101f, were pbuf, a buffer used by
;punter. the rest of it used to be pbuf2, a larger punter buffer,
;but it was moved to screen memory so download progress would be
;more entertaining and the gap at its former location never closed..
;apparently the cbm assembler left uninitialized memory when
;you reset the pc by using *=addr rather than filling with zeroes.
;the following bytes are what happened to be there in the ccgms
;term 5.5 that was distributed, and i've reproduced those bytes here
;so this source will assemble to produce that image exactly.
.if historical
garbage .byt $bd,$80
.byt $08,$c9,$20,$f0,$04,$e8,$4c,$f6,$0e,$8e,$6e,$08,$a9,$00,$8d,$5a
.byt $08,$b0,$03,$4c,$a1,$15,$a2,$19,$a0,$02,$b9,$08,$09,$d1,$08,$d0
.byt $16,$88,$10,$f6,$8a,$0a,$aa,$bd,$11,$20,$85,$08,$bd,$12,$20,$85
.byt $09,$ad,$74,$08,$6c,$08,$00,$a5,$08,$18,$69,$03,$85,$08,$90,$02
.byt $e6,$09,$ca,$10,$d3,$4c,$a1,$15,$a9,$01,$2c,$a9,$03,$2c,$a9,$02
.byt $8d,$65,$08,$a0,$00,$8c,$5a,$08,$a8,$c0,$03,$d0,$01,$88,$8c,$7a
.byt $08,$20,$d1,$15,$b0,$08,$ae,$6a,$08,$a9,$07,$4c,$c8,$15,$8c,$7a
.byt $08,$ae,$69,$08,$20,$bc,$16,$ce,$57,$08,$30,$35,$f0,$03,$4c,$2b
.byt $10,$a9,$01,$8d,$71,$08,$c9,$01,$d0,$09,$ac,$65,$08,$8c,$7a,$08
.byt $4c,$95,$0f,$ac,$7a,$08,$ad,$71,$08,$ae,$69,$08,$20,$68,$1b,$a0
.byt $00,$8c,$5a,$08,$ac,$7a,$08,$c0,$03,$d0,$59,$ce,$7a,$08,$4c,$03
.byt $10,$a9,$04,$8d,$71,$08,$ae,$65,$08,$e0,$03,$d0,$0c,$ad,$6c,$08
.byt $ac,$5a,$08,$20,$90,$28,$ee,$5a,$08,$ad,$6d,$08,$ac,$5a,$08,$20
.byt $90,$28,$ee,$5a,$08,$ae,$65,$08,$e0,$02,$d0,$0c,$ad,$6c,$08,$ac
.byt $5a,$08,$20,$90,$28,$ee,$5a,$08,$ad,$75,$08,$29,$09,$d0,$97,$e0
.byt $01,$d0,$05,$ad,$6c,$08,$d0,$8e,$a9,$00,$aa,$ac,$7a,$08,$8d,$5a
.byt $08,$20,$68,$1b,$20,$35,$16,$b0,$03,$4c,$cb,$15,$bd,$80,$08,$e8
.byt $8e,$6e,$08,$ec,$77,$08,$f0,$05,$90,$03,$4c,$9c,$15,$c9,$2c,$d0
.byt $e3
;end of garbage
*=$1020 ; skip original punter buffers
.else ; !historical
pbuf .byt 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.endif ; historical
;start of terminal program
start
;undocumented opcodes to obscure program transfer to the 'decode'
;routine and then to 'stadec'.
.if historical
.byt $af,$f1,$e4,$ab,$ff,$18,$8b,>dummyb,$44,$4c,$48,$a9,<dummyb,$7a
.byt $48,$a9,<decode,$8f,$ff,$02,$3c,$78,$40,$a9,>decode,$8f,$00
.byt $02,$e2,$41,$6c,$ff,$02
dummyb .byt 0
.endif
stadec
sei
.if historical
lda #<disnmi
sta nmivec
lda #>disnmi
sta nmivec+1
.endif
cld
ldx #$ff
txs
lda #$2f
sta $00
lda #$37
sta $01
lda #1
sta 204
lda #bcolor ;settup
sta backgr
sta border
lda #tcolor
sta textcl
lda #$80
sta 650 ;rpt
lda #$0e
sta $d418
lda #$00
sta locat
lda #$e0 ;clear secondary
sta locat+1 ;screens
lda #$20
ldy #$00
erasl1
sta (locat),y
iny
bne erasl1
inc locat+1
bne erasl1
cli
lda $ba ;current dev#
cmp #$08
bcc stodev
cmp #$0c
bcc stodv2
stodev lda #$08
stodv2 sta diskdv
cmp #$08
beq stodv3
jsr drvchk
bmi stodev
stodv3
lda #<endprg ;set buffer start
sta buffst
lda #>endprg
sta buffst+1
lda newbuf ;init. buffer
sta bufptr ;& open rs232
lda newbuf+1
sta bufptr+1
.if toward24
jsr rssetup
.endif
.if swiftlib