-
Notifications
You must be signed in to change notification settings - Fork 84
/
basic.src
5229 lines (4786 loc) · 63.4 KB
/
basic.src
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
.nam C64 Console BASIC 2.2 (C)1982,1990 CBM
.subttl Copyright (C) 1982,1990 Commodore Business Machines, Inc.
.forml 60
; ***********************************************************************
; * // *
; * CCCCCCC // 666666 444 444 *
; * CCC CCC // 666 444 444 *
; * CCC // 666 444 444 *
; * CCC // 6666666666 4444444444 *
; * CCC // 666 666 444 *
; * CCC CCC // 666 666 444 *
; * CCCCCCC // 6666666 444 *
; * // *
; * *
; * CCCCCC OOOOOO NNN NN SSSSSSS OOOOOO LLL EEEEEEE *
; * CCC CCC OOO OOO NNNN NN SSS SSS OOO OOO LLL EEE *
; * CCC OOO OOO NNNNN NN SSS OOO OOO LLL EEE *
; * CCC OOO OOO NNN NN NN SSSSSSS OOO OOO LLL EEEEEE *
; * CCC OOO OOO NNN NNNN SSS OOO OOO LLL EEE *
; * CCC CCC OOO OOO NNN NNN SSS SSS OOO OOO LLL EEE *
; * CCCCCC OOOOOO NNN NN SSSSSSS OOOOOO LLLLLLL EEEEEEE *
; * *
; * *
; * B A S I C 2 . 2 *
; * *
; * *
; * COPYRIGHT (C)1990 BY COMMODORE BUSINESS MACHINES, INC. *
; * *
; * A L L R I G H T S R E S E R V E D *
; * *
; ***********************************************************************
; ***********************************************************************
; * *
; * THIS LISTING CONTAINS CONFIDENTIAL AND PROPRIETARY INFORMATION OF *
; * CBM, INC. REPRODUCTION, DISSEMINATION OR DISCLOSURE TO OTHERS *
; * WITHOUT EXPRESS WRITTEN PERMISSION IS PROHIBITED. THIS SOFTWARE *
; * IS INTENDED FOR USE IN SYSTEMS MANUFACTURED ONLY BY COMMODORE. *
; * *
; * INFORMATION IN THIS LISTING WILL CHANGE WITHOUT NOTICE. *
; * *
; * NO RESPONSIBILITY IS ASSUMED FOR THE RELIABILITY OF THIS SOFTWARE. *
; * *
; ***********************************************************************
.page
; Adapted from the following C64 BASIC files by Fred Bowen on 900516,
; as contained in C64C ROM (CBM part numbers 901226-01 and 251913-01):
;
; .include DISCLAIM
; .include DECLARE
; .include TOKENS1
; .include TOKENS2
; .include CODE1
; .include CODE2
; .include CODE3
; .include CODE4
; .include CODE5
; .include CODE6
; .include CODE7
; .include CODE8
; .include CODE9
; .include CODE10
; .include CODE11
; .include CODE12
; .include CODE13
; .include CODE14
; .include CODE15
; .include CODE16
; .include CODE17
; .include CODE18
; .include CODE19
; .include CODE20
; .include CODE21
; .include CODE22
; .include CODE23
; .include CODE24
; .include CODE25
; .include CODE26
; .include TRIG
; .include INIT
;
; The only change being the initialization of IMAIN indirect vector,
; to point to the Game Console display code contained in the Kernel ROM.
.page
.subttl DECLARE
addprc = 1
romloc = $a000 ;vic-40 basic rom
linlen = 40 ;vic screen size
buflen = 89 ;vic buffer
bufpag = 2
buf = 512
stkend = 507
clmwid = 10 ;print window 10 chars
pi = 255
numlev = 23
strsiz = 3
lf = 10 ;line feed
cr = 13 ;carriage return
*=*+3 ;6510 register area
adray1 *=*+2 ;convert float->integer
adray2 *=*+2 ;convert integer->float
integr
charac *=*+1
endchr *=*+1
trmpos *=*+1
verck *=*+1
count *=*+1
dimflg *=*+1
valtyp *=*+1
intflg *=*+1
garbfl
dores *=*+1
subflg *=*+1
inpflg *=*+1
domask
tansgn *=*+1
channl *=*+1
poker
linnum *=*+2
temppt *=*+1
lastpt *=*+2
tempst *=*+9
index
index1 *=*+2
index2 *=*+2
resho *=*+1
resmoh *=*+1
addend
resmo *=*+1
reslo *=*+1
*=*+1
txttab *=*+2
vartab *=*+2
arytab *=*+2
strend *=*+2
fretop *=*+2
frespc *=*+2
memsiz *=*+2
curlin *=*+2
oldlin *=*+2
oldtxt *=*+2
datlin *=*+2
datptr *=*+2
inpptr *=*+2
varnam *=*+2
fdecpt
varpnt *=*+2
lstpnt
andmsk
forpnt *=*+2
eormsk =forpnt+1
vartxt
opptr *=*+2
opmask *=*+1
grbpnt
tempf3
defpnt *=*+2
dscpnt *=*+2
*=*+1
four6 *=*+1
jmper *=*+1
size *=*+1
oldov *=*+1
tempf1 *=*+1
arypnt
highds *=*+2
hightr *=*+2
tempf2
*=*+1
deccnt
lowds *=*+2
grbtop
dptflg
lowtr *=*+1
expsgn *=*+1
tenexp =lowds+1
epsgn =lowtr+1
dsctmp
fac
facexp *=*+1
facho *=*+1
facmoh *=*+1
indice
facmo *=*+1
faclo *=*+1
facsgn *=*+1
degree
sgnflg *=*+1
bits *=*+1
argexp *=*+1
argho *=*+1
argmoh *=*+1
argmo *=*+1
arglo *=*+1
argsgn *=*+1
strngi
arisgn *=*+1
facov *=*+1
bufptr
strng2
polypt
curtol
fbufpt *=*+2
chrget *=*+6
chrgot *=*+1
txtptr *=*+6
qnum *=*+10
chrrts *=*+1
rndx *=*+5
* = $00FF
lofbuf *=*+1
fbuffr *=*+1
strng1 =arisgn
* = $0300 ;basic indirects
ierror *=*+2 ;indirect error (output error in .x)
imain *=*+2 ;indirect main (system direct loop)
icrnch *=*+2 ;indirect crunch (tokenization routine)
iqplop *=*+2 ;indirect list (char list)
igone *=*+2 ;indirect gone (char dispatch)
ieval *=*+2 ;indirect eval (symbol evaluation)
; sys 6502 regs
sareg *=*+1 ;.a reg
sxreg *=*+1 ;.x reg
syreg *=*+1 ;.y reg
spreg *=*+1 ;.p reg
usrpok *=*+3 ;user function dispatch
* = $0300+20 ;system indirects follow
;.end
.page
.subttl TOKENS1
* = romloc
.word init ;c000 hard reset
.word panic ;c000 soft reset
.byte 'CBMBASIC'
stmdsp .word end-1
.word for-1
.word next-1
.word data-1
.word inputn-1
.word input-1
.word dim-1
.word read-1
.word let-1
.word goto-1
.word run-1
.word if-1
.word restor-1
.word gosub-1
.word return-1
.word rem-1
.word stop-1
.word ongoto-1
.word fnwait-1
.word cload-1
.word csave-1
.word cverf-1
.word def-1
.word poke-1
.word printn-1
.word print-1
.word cont-1
.word list-1
.word clear-1
.word cmd-1
.word csys-1
.word copen-1
.word cclos-1
.word get-1
.word scrath-1
fundsp .word sgn
.word int
.word abs
usrloc .word usrpok
.word fre
.word pos
.word sqr
.word rnd
.word log
.word exp
.word cos
.word sin
.word tan
.word atn
.word peek
.word len
.word strd
.word val
.word asc
.word chrd
.word leftd
.word rightd
.word midd
optab .byte 121
.word faddt-1
.byte 121
.word fsubt-1
.byte 123
.word fmultt-1
.byte 123
.word fdivt-1
.byte 127
.word fpwrt-1
.byte 80
.word andop-1
.byte 70
.word orop-1
negtab .byte 125
.word negop-1
nottab .byte 90
.word notop-1
ptdorl .byte 100
.word dorel-1
reslst .byte 'EN',$C4
endtk =@200
.byte 'FO',$D2
fortk =@201
.byte 'NEX',$D4
.byte 'DAT',$C1
datatk =@203
.byte 'INPUT',$A3
.byte 'INPU',$D4
.byte 'DI',$CD
.byte 'REA',$C4
.byte 'LE',$D4
.byte 'GOT',$CF
gototk =@211
.byte 'RU',$CE
.byte 'I',$C6
.byte 'RESTOR',$C5
.byte 'GOSU',$C2
gosutk =@215
.byte 'RETUR',$CE
.byte 'RE',$CD
remtk =@217
.byte 'STO',$D0
.byte 'O',$CE
.byte 'WAI',$D4
.byte 'LOA',$C4
.byte 'SAV',$C5
.byte 'VERIF',$D9
.byte 'DE',$C6
.byte 'POK',$C5
.byte 'PRINT',$A3
.byte 'PRIN',$D4
printk =@231
.byte 'CON',$D4
.byte 'LIS',$D4
.byte 'CL',$D2
.byte 'CM',$C4
.byte 'SY',$D3
.byte 'OPE',$CE
.byte 'CLOS',$C5
.byte 'GE',$D4
.byte 'NE',$D7
scratk =@242
;.end
.page
.subttl TOKENS2
.byte 'TAB',$A8
tabtk =@243
.byte 'T',$CF
totk =@244
.byte 'F',$CE
fntk =@245
.byte 'SPC',$A8
spctk =@246
.byte 'THE',$CE
thentk =@247
.byte 'NO',$D4
nottk =@250
.byte 'STE',$D0
steptk =@251
.byte $AB
plustk =@252
.byte $AD
minutk =@253
.byte $AA
.byte $AF
.byte $DE
.byte 'AN',$C4
.byte 'O',$D2
.byte 190
greatk =@261
.byte $BD
equltk =@262
.byte 188
lesstk =@263
.byte 'SG',$CE
onefun =@264
.byte 'IN',$D4
.byte 'AB',$D3
.byte 'US',$D2
.byte 'FR',$C5
.byte 'PO',$D3
.byte 'SQ',$D2
.byte 'RN',$C4
.byte 'LO',$C7
.byte 'EX',$D0
.byte 'CO',$D3
.byte 'SI',$CE
.byte 'TA',$CE
.byte 'AT',$CE
.byte 'PEE',$CB
.byte 'LE',$CE
.byte 'STR',$A4
.byte 'VA',$CC
.byte 'AS',$C3
.byte 'CHR',$A4
lasnum =@307
.byte 'LEFT',$A4
.byte 'RIGHT',$A4
.byte 'MID',$A4
.byte 'G',$CF
gotk =@313
.byte 0
.page
.subttl MESSAGES
err01 .byte 'TOO MANY FILE',$D3
err02 .byte 'FILE OPE',$CE
err03 .byte 'FILE NOT OPE',$CE
err04 .byte 'FILE NOT FOUN',$C4
err05 .byte 'DEVICE NOT PRESEN',$D4
err06 .byte 'NOT INPUT FIL',$C5
err07 .byte 'NOT OUTPUT FIL',$C5
err08 .byte 'MISSING FILE NAM',$C5
err09 .byte 'ILLEGAL DEVICE NUMBE',$D2
err10 .byte 'NEXT WITHOUT FO',$D2
errnf =10
err11 .byte 'SYNTA',$D8
errsn =11
err12 .byte 'RETURN WITHOUT GOSU',$C2
errrg =12
err13 .byte 'OUT OF DAT',$C1
errod =13
err14 .byte 'ILLEGAL QUANTIT',$D9
errfc =14
err15 .byte 'OVERFLO',$D7
errov =15
err16 .byte 'OUT OF MEMOR',$D9
errom =16
err17 .byte 'UNDEF',$27,'D STATEMEN',$D4
errus =17
err18 .byte 'BAD SUBSCRIP',$D4
errbs =18
err19 .byte 'REDIM',$27,'D ARRA',$D9
errdd =19
err20 .byte 'DIVISION BY ZER',$CF
errdvo =20
err21 .byte 'ILLEGAL DIREC',$D4
errid =21
err22 .byte 'TYPE MISMATC',$C8
errtm =22
err23 .byte 'STRING TOO LON',$C7
errls =23
err24 .byte 'FILE DAT',$C1
errbd =24
err25 .byte 'FORMULA TOO COMPLE',$D8
errst =25
err26 .byte 'CAN',$27,'T CONTINU',$C5
errcn =26
err27 .byte 'UNDEF',$27,'D FUNCTIO',$CE
erruf =27
err28 .byte 'VERIF',$D9
ervfy =28
err29 .byte 'LOA',$C4
erload =29
.page
; table to translate error message # to address of string containing message
errtab .word err01
.word err02
.word err03
.word err04
.word err05
.word err06
.word err07
.word err08
.word err09
.word err10
.word err11
.word err12
.word err13
.word err14
.word err15
.word err16
.word err17
.word err18
.word err19
.word err20
.word err21
.word err22
.word err23
.word err24
.word err25
.word err26
.word err27
.word err28
.word err29
.word err30
okmsg .byte cr,'OK',cr,0
err .byte ' ERROR',0 ;add a space for vic-40 screen
intxt .byte ' IN ',0
reddy .byte cr,lf,'READY.',cr,lf,0
brktxt .byte cr,lf
err30 .byte 'BREAK',0,$A0 ;shifted space
erbrk =30
.page
forsiz =@22
fndfor tsx
inx
inx
inx
inx
ffloop lda 257,x
cmp #fortk
bne ffrts
lda forpnt+1
bne cmpfor
lda 258,x
sta forpnt
lda 259,x
sta forpnt+1
cmpfor cmp 259,x
bne addfrs
lda forpnt
cmp 258,x
beq ffrts
addfrs txa
clc
adc #forsiz
tax
bne ffloop
ffrts rts
bltu jsr reason
sta strend
sty strend+1
bltuc sec
lda hightr
sbc lowtr
sta index
tay
lda hightr+1
sbc lowtr+1
tax
inx
tya
beq decblt
lda hightr
sec
sbc index
sta hightr
bcs blt1
dec hightr+1
sec
blt1 lda highds
sbc index
sta highds
bcs moren1
dec highds+1
bcc moren1
bltlp lda (hightr),y
sta (highds),y
moren1 dey
bne bltlp
lda (hightr),y
sta (highds),y
decblt dec hightr+1
dec highds+1
dex
bne moren1
rts
getstk asl a
adc #numlev+numlev+16
bcs omerr
sta index
tsx
cpx index
bcc omerr
rts
reason cpy fretop+1
bcc rearts
bne trymor
cmp fretop
bcc rearts
trymor pha
ldx #8+addprc
tya
reasav pha
lda highds-1,x
dex
bpl reasav
jsr garba2
ldx #248-addprc
reasto pla
sta highds+8+addprc,x
inx
bmi reasto
pla
tay
pla
cpy fretop+1
bcc rearts
bne omerr
cmp fretop
bcs omerr
rearts rts
;.end
.page
.subttl CODE1
omerr ldx #errom
error jmp (ierror)
nerrox txa
asl a
tax
lda errtab-2,x
sta index1
lda errtab-1,x
sta index1+1
jsr clschn
lda #0
sta channl
errcrd jsr crdo
jsr outqst
ldy #0
geterr lda (index1),y
pha
and #127
jsr outdo
iny
pla
bpl geterr
jsr stkini
lda #<err
ldy #>err
errfin jsr strout
ldy curlin+1
iny
beq readyx
jsr inprt
readyx lda #<reddy
ldy #>reddy
jsr strout
lda #$80 ;direct messages on
jsr setmsg ;from kernal
main jmp (imain)
nmain jsr inlin
stx txtptr
sty txtptr+1
jsr chrget
tax
beq main
ldx #255
stx curlin+1
bcc main1
jsr crunch
jmp gone
main1 jsr linget
jsr crunch
sty count
jsr fndlin
bcc nodel
ldy #1
lda (lowtr),y
sta index1+1
lda vartab
sta index1
lda lowtr+1
sta index2+1
lda lowtr
dey
sbc (lowtr),y
clc
adc vartab
sta vartab
sta index2
lda vartab+1
adc #255
sta vartab+1
sbc lowtr+1
tax
sec
lda lowtr
sbc vartab
tay
bcs qdect1
inx
dec index2+1
qdect1 clc
adc index1
bcc mloop
dec index1+1
clc
mloop lda (index1),y
sta (index2),y
iny
bne mloop
inc index1+1
inc index2+1
dex
bne mloop
nodel jsr runc
jsr lnkprg
lda buf
beq main
clc
lda vartab
sta hightr
adc count
sta highds
ldy vartab+1
sty hightr+1
bcc nodelc
iny
nodelc sty highds+1
jsr bltu
lda linnum
ldy linnum+1
sta buf-2
sty buf-1
lda strend
ldy strend+1
sta vartab
sty vartab+1
ldy count
dey
stolop lda buf-4,y
sta (lowtr),y
dey
bpl stolop
fini jsr runc
jsr lnkprg
jmp main
lnkprg lda txttab
ldy txttab+1
sta index
sty index+1
clc
chead ldy #1
lda (index),y
beq lnkrts
ldy #4
czloop iny
lda (index),y
bne czloop
iny
tya
adc index
tax
ldy #0
sta (index),y
lda index+1
adc #0
iny
sta (index),y
stx index
sta index+1
bcc chead
lnkrts rts
; function gets a line one character at a time from the input channel and
; builds it in the input buffer.
inlin ldx #0
inlinc jsr inchr
cmp #13 ;a carriage return?
beq finin1 ;yes...done build
sta buf,x ;put it away
inx
cpx #buflen ;max character line?
bcc inlinc ;no...o.k.
ldx #errls ;string too long error
jmp error
finin1 jmp fininl
;.end
.page
.subttl CODE2
bufofs = @1000
crunch jmp (icrnch)
ncrnch ldx txtptr
ldy #4
sty dores
kloop lda bufofs,x
bpl cmpspc
cmp #pi
beq stuffh
inx
bne kloop
cmpspc cmp #' '
beq stuffh
sta endchr
cmp #34
beq strng
bit dores
bvs stuffh
cmp #'?'
bne kloop1
lda #printk
bne stuffh
kloop1 cmp #'0'
bcc mustcr
cmp #60
bcc stuffh
mustcr sty bufptr
ldy #0
sty count
dey
stx txtptr
dex
reser iny
inx
rescon lda bufofs,x
sec
sbc reslst,y
beq reser
cmp #128
bne nthis
ora count
getbpt ldy bufptr
stuffh inx
iny
sta buf-5,y
lda buf-5,y
beq crdone
sec
sbc #':'
beq colis
cmp #datatk-$3a
bne nodatt
colis sta dores
nodatt sec
sbc #remtk-$3a
bne kloop
sta endchr
str1 lda bufofs,x
beq stuffh
cmp endchr
beq stuffh
strng iny
sta buf-5,y
inx
bne str1
nthis ldx txtptr
inc count
nthis1 iny
lda reslst-1,y
bpl nthis1
lda reslst,y
bne rescon
lda bufofs,x
bpl getbpt
crdone sta buf-3,y
dec txtptr+1
zz1 = buf-1
lda #<zz1
sta txtptr
rts
fndlin lda txttab
ldx txttab+1
fndlnc ldy #1
sta lowtr
stx lowtr+1
lda (lowtr),y
beq flinrt
iny
iny
lda linnum+1
cmp (lowtr),y
bcc flnrts
beq fndlo1
dey
bne affrts
fndlo1 lda linnum
dey
cmp (lowtr),y
bcc flnrts
beq flnrts
affrts dey
lda (lowtr),y
tax
dey
lda (lowtr),y
bcs fndlnc
flinrt clc
flnrts rts
scrath bne flnrts
scrtch lda #0
tay
sta (txttab),y
iny
sta (txttab),y
lda txttab
clc
adc #2
sta vartab
lda txttab+1
adc #0
sta vartab+1
runc jsr stxtpt
lda #0
clear bne stkrts
clearc jsr ccall ;moved for v2 orig for rs-232
cleart lda memsiz ;entry for open & close memsiz changes
ldy memsiz+1
sta fretop
sty fretop+1
lda vartab
ldy vartab+1
sta arytab
sty arytab+1
sta strend
sty strend+1
fload jsr restor
stkini ldx #tempst
stx temppt
pla
tay
pla
ldx #stkend-257
txs
pha
tya
pha
lda #0
sta oldtxt+1
sta subflg
stkrts rts
stxtpt clc
lda txttab
adc #255
sta txtptr
lda txttab+1
adc #255
sta txtptr+1
rts
;.end
.page
.subttl CODE3
list bcc golst
beq golst