-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathcode15.src
149 lines (133 loc) · 2.23 KB
/
code15.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
.page
.subttl 'code15'
;
; strini gets string space for the creation of a string,
; and creates a descriptor for it in dsctmp
;
strini
ldx facmo ;get facmo to store in dscpnt
ldy facmo+1
stx dscpnt ;retain the descriptor pointer
sty dscpnt+1
strspa
jsr getspa ;get string space
stx dsctmp+1 ;save location
sty dsctmp+2
sta dsctmp ;save length
rts ;done
; the str function takes a number and gives a string with
; the characters the output of the number would have given.
;
strd
jsr chknum ;arg has to be numeric
ldy #0
jsr foutc ;do it's output
pla
pla
timstr
lda #<lofbuf
ldy #>lofbuf ;fall thru to strlit
; strlt2 takes the string literal whose first character is pointed
; to by (xreg)+1 and builds a descriptor for it. the descriptor is
; initially built in 'dsctmp', but 'putnew' transfers it into a
; temporary, and leaves a pointer at the temporary in facmo & lo.
; the characters other than zero that terminates the string
; should be set up in 'charac' and 'endchr'. if the terminator
; is a quote, the quote is skipped over. leading quotes should
; be skipped before jsr. on return, the character after the string
; literal is pointed to by (strng2).
strlit
ldx #'"' ;assume string ends on quote
stx charac
stx endchr
strlt2
sta strng1 ;save pointer to string
sty strng1+1
sta dsctmp+1 ;in case no strcpy
sty dsctmp+2
ldy #255 ;initialize character count
strget
iny
jsr indst1
beq strfi1
cmp charac
beq strfin
cmp endchr
bne strget
strfin
cmp #'"'
beq strfi2
strfi1
clc
strfi2
sty dsctmp
tya
adc strng1
sta strng2
ldx strng1+1
bcc strst2
inx
strst2
stx strng2+1
tya
jsr strini
ldx strng1
ldy strng1+1
jsr movstr
putnew
ldx temppt
cpx #tempst+strsiz+strsiz+strsiz
bne putnw1
ldx #errst
jmp error
putnw1
lda dsctmp
sta 0,x
lda dsctmp+1
sta 1,x
lda dsctmp+2
sta 2,x
ldy #0
stx facmo
sty facmo+1
sty facov
dey
sty valtyp
stx lastpt
inx
inx
inx
stx temppt
rts
cat
lda faclo
pha
lda facmo
pha
jsr eval
jsr chkstr
pla
sta strng1
pla
sta strng1+1
ldy #0
jsr indst1
sta syntmp
jsr indfmo
clc
adc syntmp
bcc sizeok
jmp errlen
sizeok
jsr strini
jsr movins
lda dscpnt
ldy dscpnt+1
jsr fretmp
jsr movdo
lda strng1
ldy strng1+1
jsr fretmp
jsr putnew
jmp tstop
;.end