1706
|
1 *
|
|
2 *
|
|
3 * Table to drive command line parser. The routines to process individual
|
|
4 * options are also in this file.
|
|
5 *
|
|
6 * Three global symbols:
|
|
7 * PTable: options table
|
|
8 * DefFormat: Set up Default format (VEF)
|
|
9 * Help: Give usage message.
|
|
10 *
|
|
11 *
|
|
12 ifp1
|
1912
|
13 use os9defs.d
|
1706
|
14 endc
|
|
15
|
|
16 StdOut equ 1
|
|
17 StdErr equ 2
|
|
18
|
|
19 psect view_table_a,0,0,0,0,0
|
|
20
|
|
21
|
|
22 * Options parsing table.
|
|
23 * Each entry: null-terminated option string,
|
|
24 * one-byte option code,
|
|
25 * Lbra instruction to subroutine to process that option.
|
|
26 * The subroutine is called with the option code in register A, and
|
|
27 * X points to the first byte on the command line after the option
|
|
28 * (for use in parsing arguments to options).
|
|
29 * This simplifies the handling of format codes, in particular.
|
|
30 *
|
|
31 * In order to prevent incorrect matches, longer options should occur
|
|
32 * earlier in the table, since the matching code will match the first
|
|
33 * legal option that matches the first part of the given option.
|
|
34 * i.e. if "opt" occurs before "opt1", then "opt1" will never get
|
|
35 * a match
|
|
36 *
|
|
37 PTable:
|
|
38 fcc "formats" -formats
|
|
39 fcb 0,0
|
|
40 lbra ShowFormats
|
|
41 fcc "savemge" -savemge
|
|
42 fcb 0,MGEFormat
|
|
43 lbra SetSave
|
|
44 fcc "save640" -save640
|
|
45 fcb 0,MGE640Format
|
|
46 lbra SetSave
|
|
47 fcc "savevef" -savevef
|
|
48 fcb 0,VEFFormat
|
|
49 lbra SetSave
|
|
50 fcc "savecm3" -savecm3
|
|
51 fcb 0,CM3Format
|
|
52 lbra SetSave
|
|
53 fcc "signal" -signal
|
|
54 fcb 0,0
|
|
55 lbra SetSignal
|
|
56 fcc "nobuff" -nobuff forces a very small buffer
|
|
57 fcb 0,0
|
|
58 lbra NoBuff
|
|
59 fcc "save" -save (VEF Squashed)
|
|
60 fcb 0,VEFSqFormat
|
|
61 lbra SetSave
|
|
62 fcc "small" -small
|
|
63 fcb 0,0
|
|
64 lbra SetSize
|
|
65 fcc "large" -large
|
|
66 fcb 0,1
|
|
67 lbra SetSize
|
|
68 fcc "huge" -huge
|
|
69 fcb 0,2
|
|
70 lbra SetSize
|
|
71 fcc "sml" -sml
|
|
72 fcb 0,0
|
|
73 lbra SetSize
|
|
74 fcc "big" -big
|
|
75 fcb 0,1
|
|
76 lbra SetSize
|
|
77 fcc "lrg" -lrg
|
|
78 fcb 0,1
|
|
79 lbra SetSize
|
|
80 fcc "maxcmp" -maxcmp
|
|
81 fcb 0,MAXCMPFormat
|
|
82 lbra SetMAXCMP
|
|
83 fcc "pixcmp" -pixcmp
|
|
84 fcb 0,MAXCMPFormat
|
|
85 lbra SetMAXCMP
|
|
86 fcc "artcmp" -artcmp
|
|
87 fcb 0,ARTCMPFormat
|
|
88 lbra SetMAXCMP
|
|
89 fcc "pix256" -pix256 (DS69B 256x256 format)
|
|
90 fcb 0,PIX256Format
|
|
91 lbra SetFormat
|
|
92 fcc "pix128" -pix128 (DS69B 128x128 format)
|
|
93 fcb 0,PIX128Format
|
|
94 lbra SetFormat
|
|
95 fcc "pix" -pix (Note: _must_ occur after pix256 & pix128)
|
|
96 fcb 0,PIXFormat
|
|
97 lbra SetFormat
|
|
98 fcc "vef" -vef
|
|
99 fcb 0,1
|
|
100 lbra SetVF only 1 picture VEF format.
|
|
101 fcc "vf2" -vf2 option
|
|
102 fcb 0,2
|
|
103 lbra SetVF
|
|
104 fcc "vf3" -vf3 option
|
|
105 fcb 0,3
|
|
106 lbra SetVF
|
|
107 fcc "vf4" -vf4 option
|
|
108 fcb 0,4
|
|
109 lbra SetVF
|
|
110 fcc "vf5" -vf5 option
|
|
111 fcb 0,5
|
|
112 lbra SetVF
|
|
113 fcc "vf6" -vf6
|
|
114 fcb 0,6
|
|
115 lbra SetVF
|
|
116 fcc "vf7" -vf7
|
|
117 fcb 0,7
|
|
118 lbra SetVF
|
|
119 fcc "vf8" -vf8
|
|
120 fcb 0,8
|
|
121 lbra SetVF
|
|
122 fcc "vf9" -vf9
|
|
123 fcb 0,9
|
|
124 lbra SetVF
|
|
125 fcc "mge" -mge option
|
|
126 fcb 0,MGEFormat
|
|
127 lbra SetFormat
|
|
128 fcc "cm3" -cm3 option
|
|
129 fcb 0,CM3Format
|
|
130 lbra SetFormat
|
|
131 fcc "640" -640 option
|
|
132 fcb 0,MGE640Format
|
|
133 lbra SetFormat
|
|
134 fcc "clp" -clp option
|
|
135 fcb 0,CLPFormat
|
|
136 lbra SetFormat
|
|
137 fcc "pub" -pub option (Home Publisher ClipArt format)
|
|
138 fcb 0,PUBFormat
|
|
139 lbra SetFormat
|
|
140 fcc "img" -img option
|
|
141 fcb 0,IMGFormat
|
|
142 lbra SetFormat
|
|
143 fcc "rat" -rat option
|
|
144 fcb 0,RATFormat
|
|
145 lbra SetFormat
|
|
146 fcc "art" -art option
|
|
147 fcb 0,ARTFormat
|
|
148 lbra SetFormat
|
|
149 fcc "bin" -bin same as -max
|
|
150 fcb 0,MAXFormat
|
|
151 lbra SetFormat
|
|
152 fcc "max" -max option
|
|
153 fcb 0,MAXFormat
|
|
154 lbra SetFormat
|
|
155 fcc "p00" -p00 option
|
|
156 fcb 0,P00Format
|
|
157 lbra SetFormat
|
|
158 fcc "p01" -p01 option
|
|
159 fcb 0,P01Format
|
|
160 lbra SetFormat
|
|
161 fcc "p10" -p10 option
|
|
162 fcb 0,P10Format
|
|
163 lbra SetFormat
|
|
164 fcc "p11" -p11 option
|
|
165 fcb 0,P11Format
|
|
166 lbra SetFormat
|
|
167 fcc "p20" -p20 option
|
|
168 fcb 0,P20Format
|
|
169 lbra SetFormat
|
|
170 fcc "p21" -p21 option
|
|
171 fcb 0,P21Format
|
|
172 lbra SetFormat
|
|
173 fcc "p30" -p30 option
|
|
174 fcb 0,P30Format
|
|
175 lbra SetFormat
|
|
176 fcc "p31" -p31 option
|
|
177 fcb 0,P31Format
|
|
178 lbra SetFormat
|
|
179 fcc "p40" -p40 option
|
|
180 fcb 0,P40Format
|
|
181 lbra SetFormat
|
|
182 fcc "p41" -p41 option
|
|
183 fcb 0,P41Format
|
|
184 lbra SetFormat
|
|
185 fcc "rle" -rle option
|
|
186 fcb 0,RLEFormat
|
|
187 lbra SetFormat
|
|
188 fcc "mac" -mac option
|
|
189 fcb 0,MACFormat
|
|
190 lbra SetFormat
|
|
191 fcc "mcp" -mcp option
|
|
192 fcb 0,MACFormat
|
|
193 lbra SetFormat
|
|
194 fcc "gifbw" -gifbw option
|
|
195 fcb 0,GIFBWFormat
|
|
196 lbra SetGIF
|
|
197 fcc "bwgif" -bwgif option
|
|
198 fcb 0,GIFBWFormat
|
|
199 lbra SetGIF
|
|
200 fcc "gbw" -gbw option
|
|
201 fcb 0,GIFBWFormat
|
|
202 lbra SetGIF
|
|
203 fcc "gif" -gif option
|
|
204 fcb 0,GIFFormat
|
|
205 lbra SetGIF
|
|
206 fcc "stp" -stp is synonym for -st, for MultiVue
|
|
207 fcb 0,STFormat
|
|
208 lbra SetFormat
|
|
209 fcc "st" -st option
|
|
210 fcb 0,STFormat
|
|
211 lbra SetFormat
|
|
212 fcc "t" -t# Set screen to this type.
|
|
213 fcb 0,0
|
|
214 lbra Settype
|
|
215 fcc "s" -s Use same screen
|
|
216 fcb 0,0
|
|
217 lbra Setsame
|
|
218 fcc "c" -c Enable color cycling
|
|
219 fcb 0,0
|
|
220 lbra Setcycle
|
|
221 fcc "f" -f Fit on one screen
|
|
222 fcb 0,0 Now is a synonym for -small
|
|
223 lbra SetSize
|
|
224 fcc "y" -y# Skip this many lines at top.
|
|
225 fcb 0,0
|
|
226 lbra Setskip
|
|
227 fcc "x" -x# Skip this many columns at left
|
|
228 fcb 0,0
|
|
229 lbra Setcols
|
|
230 fcc "help" -help Give help message
|
|
231 fcb 0,0
|
|
232 lbra Help
|
|
233 fcc "h" -h Give help message
|
|
234 fcb 0,0
|
|
235 lbra Help
|
|
236 fcc "?" -? Give help message
|
|
237 fcb 0,0
|
|
238 lbra Help
|
|
239 fcc "q" -q# Quit after this many seconds
|
|
240 fcb 0,0
|
|
241 lbra Quit
|
|
242 * Additional options here
|
|
243 fcb 0
|
|
244
|
|
245 Help:
|
|
246 pshs x
|
|
247 leax Usage,pcr
|
|
248 lbsr O_Write
|
|
249 ldb #1
|
|
250 os9 F$Exit
|
|
251 puls x,pc
|
|
252
|
|
253 ShowFormats
|
|
254 pshs x
|
|
255 leax Formats,pcr -formats exits after message.
|
|
256 lbsr O_Write
|
|
257 ldb #1
|
|
258 os9 F$Exit
|
|
259 puls x,pc
|
|
260
|
|
261
|
|
262 ***********************
|
|
263 *
|
|
264 * Subroutines to process specific options
|
|
265 *
|
|
266 ***********************
|
|
267 *
|
|
268 * Default Format sets VEF format.
|
|
269 *
|
|
270 DefFormat:
|
|
271 tst <format If format already set, ignore.
|
|
272 bne SetVEF1
|
|
273 lda #1 One-picture VEF is default.
|
|
274 lbsr SetVF
|
|
275 SetVEF1
|
|
276 rts
|
|
277
|
|
278 * -t option
|
|
279 *
|
|
280 Settype
|
|
281 lbsr Getnum Get argument, check for validity
|
|
282 cmpb #5
|
|
283 blo Settype1
|
|
284 cmpb #8
|
|
285 bhi Settype1
|
|
286
|
|
287 lda <type Has it already been set?
|
|
288 cmpa #5
|
|
289 blo Settype0
|
|
290 cmpa #8
|
|
291 bls Settype1
|
|
292 Settype0
|
|
293 stb <type All okay, set it.
|
|
294 Settype1
|
|
295 rts
|
|
296
|
|
297 * -s option
|
|
298 *
|
|
299 Setsame
|
|
300 lda #$FF
|
|
301 sta <Samescreen
|
|
302 rts
|
|
303
|
|
304 * Size options
|
|
305 *
|
|
306 SetSize
|
|
307 tst <Size
|
|
308 bpl SetSize1 If Size is >=0, then it's already been set.
|
|
309 sta <Size
|
|
310 SetSize1
|
|
311 rts
|
|
312
|
|
313 * -c option
|
|
314 Setcycle
|
|
315 lda #$FF
|
|
316 sta <cycle
|
|
317 rts
|
|
318
|
|
319 * -y option
|
|
320 Setskip
|
|
321 lbsr Getnum
|
|
322 pshs d
|
|
323 ldd <Skiplines
|
|
324 bpl noskip
|
|
325 ldd ,s
|
|
326 std <Skiplines
|
|
327 noskip
|
|
328 puls d,pc
|
|
329
|
|
330 * -x option
|
|
331 Setcols
|
|
332 lbsr Getnum
|
|
333 pshs d
|
|
334 ldd <Skipcols
|
|
335 bpl nocols
|
|
336 ldd ,s
|
|
337 std <Skipcols
|
|
338 nocols
|
|
339 puls d,pc
|
|
340
|
|
341 * -q option
|
|
342 Quit
|
|
343 lbsr Getnum
|
|
344 lda #60 Multiply by 60 ticks/second.
|
|
345 mul
|
|
346 std <MaxTime
|
|
347 rts
|
|
348
|
|
349 * -nobuff option
|
|
350 NoBuff
|
|
351 ldd #16 16 bytes of buffer.
|
|
352 std <MaxBuff
|
|
353 rts
|
|
354
|
|
355 * Handle format options
|
|
356 * On entry, A holds the format code
|
|
357 SetFormat
|
|
358 tst <format
|
|
359 bne SetForm1
|
|
360 sta <format
|
|
361 SetForm1
|
|
362 rts
|
|
363
|
|
364 * Set signal PID and value
|
|
365 SetSignal
|
|
366 lbsr Getnum
|
|
367 stb <SigPID
|
|
368 lbsr Getnum
|
|
369 stb <SigOut
|
|
370 rts
|
|
371
|
|
372 endsect
|