chiark / gitweb /
Initial revision
[ssr] / StraySrc / Libraries / Sapphire / sail / _sh / ctrl
1 ;
2 ; ctrl.sh
3 ;
4 ; Control flow handling
5 ;
6 ; © 1995 Straylight
7 ;
8
9 ;----- Overview -------------------------------------------------------------
10 ;
11 ; Functions provided:
12 ;
13 ;  ctrl_let
14 ;  ctrl_timeEq
15 ;  ctrl_for
16 ;  ctrl_next
17 ;  ctrl_repeat
18 ;  ctrl_until
19 ;  ctrl_while
20 ;  ctrl_endwhile
21 ;  ctrl_gosub
22 ;  ctrl_return
23 ;  ctrl_if
24 ;  ctrl_else
25 ;  ctrl_goto
26 ;  ctrl_case
27 ;  ctrl_when
28 ;  ctrl_otherwise
29 ;  ctrl_end
30 ;  ctrl_swap
31 ;  ctrl_ptr
32 ;  ctrl_ext
33 ;  ctrl_close
34 ;  ctrl_bput
35 ;  ctrl_findDATA
36 ;  ctrl_read
37 ;  ctrl_restore
38 ;  ctrl_sys
39 ;  ctrl_setUpRegs
40 ;  ctrl_resolveRegs
41 ;  ctrl_fn
42 ;  ctrl_equals
43 ;  ctrl_proc
44 ;  ctrl_endproc
45 ;  ctrl_data
46 ;  ctrl_def
47 ;  ctrl_local
48 ;  ctrl_leftS
49 ;  ctrl_midS
50 ;  ctrl_rightS
51 ;  ctrl_dim
52 ;  ctrl_store
53 ;  ctrl_load
54 ;  ctrl_compare
55
56                 [       :LNOT::DEF:ctrl__dfn
57                 GBLL    ctrl__dfn
58
59 ; --- ctrl_let ---
60
61                 IMPORT  ctrl_let
62
63 ; --- ctrl_timeEq ---
64
65                 IMPORT  ctrl_timeEq
66
67 ; --- ctrl_for ---
68
69                 IMPORT  ctrl_for
70
71 ; --- ctrl_next ---
72
73                 IMPORT  ctrl_next
74
75 ; --- ctrl_repeat ---
76
77                 IMPORT  ctrl_repeat
78
79 ; --- ctrl_until ---
80
81                 IMPORT  ctrl_until
82
83 ; --- ctrl_while ---
84
85                 IMPORT  ctrl_while
86
87 ; --- ctrl_endwhile ---
88
89                 IMPORT  ctrl_endwhile
90
91 ; --- ctrl_gosub ---
92
93                 IMPORT  ctrl_gosub
94
95 ; --- ctrl_return ---
96
97                 IMPORT  ctrl_return
98
99 ; --- ctrl_if ---
100
101                 IMPORT  ctrl_if
102
103 ; --- ctrl_else ---
104
105                 IMPORT  ctrl_else
106
107 ; --- ctrl_goto ---
108
109                 IMPORT  ctrl_goto
110
111 ; --- ctrl_case ---
112
113                 IMPORT  ctrl_case
114
115 ; --- ctrl_when ---
116
117                 IMPORT  ctrl_when
118
119 ; --- ctrl_otherwise ---
120
121                 IMPORT  ctrl_otherwise
122
123 ; --- ctrl_end ---
124
125                 IMPORT  ctrl_end
126
127 ; --- ctrl_swap ---
128
129                 IMPORT  ctrl_swap
130
131 ; --- ctrl_ptr ---
132
133                 IMPORT  ctrl_ptr
134
135 ; --- ctrl_ext ---
136
137                 IMPORT  ctrl_ext
138
139 ; --- ctrl_close ---
140
141                 IMPORT  ctrl_close
142
143 ; --- ctrl_bput ---
144
145                 IMPORT  ctrl_bput
146
147 ; --- ctrl__findDATA ---
148 ;
149 ; On entry:     All the normal things
150 ;
151 ; On exit:      R0 == *address* in file of next DATA
152 ;
153 ; Use:          Sets the internal data pointer to the first DATA statement
154 ;               fromthe current position.
155
156                 IMPORT  ctrl_findDATA
157
158 ; --- ctrl_read ---
159
160                 IMPORT  ctrl_read
161
162 ; --- ctrl_restore ---
163
164                 IMPORT  ctrl_restore
165
166 ; --- ctrl_sys ---
167
168                 IMPORT  ctrl_sys
169
170 ; --- ctrl_setUpRegs ---
171 ;
172 ; On entry:     R7-R10 == position info
173 ;
174 ; On exit:      R0-R8 set up for sys call
175 ;               R9,R10 == rvalue of first parameter
176 ;               On the stack:
177 ;                 new position info, R7-R12
178 ;                 place to stracc free
179 ;
180 ; Use:          Sets up all the registers as required by a SYS or SYSCALL
181 ;               command.
182
183                 IMPORT  ctrl_setUpRegs
184
185 ; --- ctrl_resolveRegs ---
186 ;
187 ; On entry:     R0 == pointer to register block
188 ;
189 ; On exit:      CS if flags were required, CC otherwise
190 ;
191 ; Use:          Resolves the registers returned from a SYS or SYSCALL
192 ;               into the appropriate variables.  The code assumes that
193 ;               we have possibly just read a TO command, and goes on
194 ;               from there.
195
196                 IMPORT  ctrl_resolveRegs
197
198 ; --- FN ---
199 ;
200 ; OK, maybe it shouldn't be here.  I don't really care.
201 ;
202 ; Hack warning: This is a hack.  We unwind express_read's stack and stuff
203 ;               them away somewhere completely different.
204
205                 IMPORT  ctrl_fn
206
207 ; --- = ---
208
209                 IMPORT  ctrl_equals
210
211 ; --- PROC ---
212
213                 IMPORT  ctrl_proc
214
215 ; --- ENDPROC ---
216
217                 IMPORT  ctrl_endproc
218
219 ; --- DATA ---
220
221                 IMPORT  ctrl_data
222
223 ; --- DEF  ---
224
225                 IMPORT  ctrl_def
226
227 ; --- LOCAL ---
228
229                 IMPORT  ctrl_local
230
231 ; --- ctrl_leftS ---
232
233                 IMPORT  ctrl_leftS
234
235 ; --- ctrl_midS ---
236
237                 IMPORT  ctrl_midS
238
239 ; --- ctrl_rightS ---
240
241                 IMPORT  ctrl_rightS
242
243 ; --- ctrl_dim ---
244
245                 IMPORT  ctrl_dim
246
247 ; --- ctrl_store ---
248 ;
249 ; On entry:     R0,R1 == lvalue to store in
250 ;               R2,R3 == rvalue to write
251 ;
252 ;               If bit 31 of R1 is set, then for strings only, the old
253 ;               string is NOT removed from the stracc. This is
254 ;               so that variables can be restored after a procedure.
255 ;
256 ; On exit:      --
257 ;
258 ; Use:          Stores an rvalue into an lvalue.
259
260                 IMPORT  ctrl_store
261
262 ; --- ctrl_load ---
263 ;
264 ; On entry:     R0,R1 == lvalue to read
265 ;
266 ; On exit:      R2,R3 == rvalue read from lvalue
267 ;
268 ; Use:          Loads the current value of the given lvalue.
269
270                 IMPORT  ctrl_load
271
272 ; --- ctrl_compare ---
273 ;
274 ; On entry:     R0,R1 == thing to compare
275 ;               R2,R3 == thing to compare the other thing with
276 ;
277 ; On exit:      The flags indicate the result of the comparison
278 ;
279 ; Use:          Compares two things.  Note that R3 contains the dominant
280 ;               type. If it is comparing strings, the string in R0,R1
281 ;               will be removed from stracc.
282
283                 IMPORT  ctrl_compare
284
285                 ]
286
287 ;----- That's all, folks ----------------------------------------------------
288
289                 END