-
Notifications
You must be signed in to change notification settings - Fork 82
/
exten2.src
176 lines (159 loc) · 2.34 KB
/
exten2.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
.page
.subttl 'extensions-2 01/18/84'
do
ldy #1
do05
lda txtptr,y ;save current pointers for stack entry
sta tmptxt,y
lda curlin,y
sta tmplin,y
dey
bpl do05
jsr chrgot ;look for 'while' or 'until'
beq doyes ;unconditional
cmp #untltk
beq do10
cmp #whiltk
bne snrjmp
;
; here for 'while'
;
jsr frmjmp
lda facexp
bne doyes ;conditional evaluated true
dono
jsr chrgot
jmp fnd010 ;advance to end of block, do rts
;
; here for 'until'
;
do10
jsr frmjmp
lda facexp
bne dono
doyes
ldy #5
jsr getstk
dey
lda tmptxt+1
sta (tos),y
dey
lda tmptxt
sta (tos),y
dey
lda tmplin+1
sta (tos),y
dey
lda tmplin
sta (tos),y
dey
lda #dotk
sta (tos),y
rts
exit
jsr popdgo ;pop do entry off stack
jsr chrgot
beq fnd010
snrjmp
jmp snerr
; find end of current block
;
fndend
jsr chrget
fnd010
beq fnd50 ;end of statement
cmp #looptk
beq fnd60 ;a hit!
cmp #'"' ;quote
beq fnd40
cmp #dotk
bne fndend ;keep looking
jsr fndend ;recursivly
jmp dono ;do a chrgot,go to fnd010
fnd40
jsr chrget ;look for next quote
beq fnd50 ;end of statement will do
cmp #'"'
bne fnd40
beq fndend
fnd50
cmp #':' ;end of line or end of stmt?
beq fndend ;just stmt, keep going
bit runmod ;direct mode?
bpl fnderr ;yes, so not found
ldy #2
jsr indtxt ;end of text?
beq fnderr ;'fraid so
iny ;y=3
jsr indtxt ;update pointers
sta curlin
iny
jsr indtxt
sta curlin+1
tya
clc
adc txtptr
sta txtptr
bcc fndend
inc txtptr+1
bne fndend
fnd60
jmp data ;read to end of statement,rts
loop
beq popngo ;no conditionals, just do it
cmp #whiltk
beq loop10
cmp #untltk
bne snrjmp
;
; here for 'until'
;
jsr frmjmp
lda facexp
beq popngo ;false, do it again!
popdgo ;pop, but don't go
lda #dotk
sta srchtk
jsr search
bne poperr ;branch if not found
jsr movfnd
ldy #5
jmp rlsstk
fnderr
ldx #errlnf
.byte $2c
poperr
ldx #errlwd ;loop without do
jmp error
;
; here for 'while'
;
loop10
jsr frmjmp
beq popdgo ;false, exit
popngo
jsr popdgo
dey
lda (fndpnt),y ;restore pointers
sta txtptr+1
dey
lda (fndpnt),y
sta txtptr
dey
lda (fndpnt),y
jsr retpat ;(** 01/18/84 fixes 'loop' to a direct mode 'do')
lda (fndpnt),y
sta curlin
jmp do
frmjmp
jsr chrget
jmp frmevl
tron ;trace mode on
lda #$ff
.byte $2c
troff ;trace mode off
lda #0
sta trcflg
rts
;.end
;01/18/84 patch to reset 'runmod' after 'loop' ends a direct 'do'