1 | /*
|
---|
2 | =============================================================================
|
---|
3 | libdsp.c -- MIDAS librarian display
|
---|
4 | Version 64 -- 1988-11-17 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #define DEBUGRE 0
|
---|
9 | #define DEBUGWE 0
|
---|
10 |
|
---|
11 | #include "stddefs.h"
|
---|
12 | #include "biosdefs.h"
|
---|
13 | #include "curpak.h"
|
---|
14 | #include "memory.h"
|
---|
15 | #include "stdio.h"
|
---|
16 | #include "errno.h"
|
---|
17 |
|
---|
18 | #include "ascii.h"
|
---|
19 | #include "charset.h"
|
---|
20 | #include "fpu.h"
|
---|
21 | #include "hwdefs.h"
|
---|
22 | #include "vsdd.h"
|
---|
23 | #include "vsddsw.h"
|
---|
24 | #include "vsddvars.h"
|
---|
25 | #include "graphdef.h"
|
---|
26 | #include "charset.h"
|
---|
27 | #include "fields.h"
|
---|
28 |
|
---|
29 | #include "midas.h"
|
---|
30 | #include "asgdsp.h"
|
---|
31 | #include "instdsp.h"
|
---|
32 | #include "libdsp.h"
|
---|
33 | #include "wsdsp.h"
|
---|
34 |
|
---|
35 | #if (DEBUGRE|DEBUGWE)
|
---|
36 | extern short debugsw;
|
---|
37 | #endif
|
---|
38 |
|
---|
39 | #if DEBUGRE
|
---|
40 | short debugre = 1;
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #if DEBUGWE
|
---|
44 | short debugwe = 1;
|
---|
45 | #endif
|
---|
46 |
|
---|
47 | extern int16_t lcancel(int16_t lct);
|
---|
48 |
|
---|
49 | extern int32_t ptsizer(void);
|
---|
50 | extern int32_t scsizer(void);
|
---|
51 | extern int32_t sqsizer(void);
|
---|
52 |
|
---|
53 | /* |
---|
54 |
|
---|
55 | */
|
---|
56 |
|
---|
57 | /* things defined elsewhere */
|
---|
58 |
|
---|
59 | extern void (*point)(int16_t x, int16_t y, int16_t pen);
|
---|
60 |
|
---|
61 | extern void clrlsel(void);
|
---|
62 | extern void _clsvol(void);
|
---|
63 | extern void setgc(int16_t xv, int16_t yv);
|
---|
64 |
|
---|
65 | extern int16_t _bpbin;
|
---|
66 |
|
---|
67 | extern int16_t chtime;
|
---|
68 | extern int16_t cmtype;
|
---|
69 | extern int16_t cvtime;
|
---|
70 | extern int16_t cxval;
|
---|
71 | extern int16_t cyval;
|
---|
72 | extern int16_t sgcsw;
|
---|
73 | extern int16_t stccol;
|
---|
74 | extern int16_t stcrow;
|
---|
75 | extern int16_t submenu;
|
---|
76 | extern int16_t thcwval;
|
---|
77 | extern int16_t tvcwval;
|
---|
78 |
|
---|
79 | extern uint16_t *obj0, *obj2;
|
---|
80 |
|
---|
81 | extern int8_t *ldbxlb0[];
|
---|
82 | extern int8_t vtlin1[], vtlin2[], vtlin3[];
|
---|
83 |
|
---|
84 | extern int16_t ldbox[][8];
|
---|
85 | extern struct instdef idefs[];
|
---|
86 |
|
---|
87 | extern struct bpb *_thebpb;
|
---|
88 |
|
---|
89 | /* |
---|
90 |
|
---|
91 | */
|
---|
92 |
|
---|
93 | extern uint16_t *librob; /* display object pointer */
|
---|
94 |
|
---|
95 | extern int16_t catin; /* catalog read in flag */
|
---|
96 | extern int16_t lrasw; /* append (TRUE) / replace (FALSE) score */
|
---|
97 | extern int16_t lorchl; /* hi (TRUE) / lo (FALSE) orchestra */
|
---|
98 | extern int16_t ldrow; /* fetch select row */
|
---|
99 | extern int16_t ldslot; /* fetch select slot */
|
---|
100 | extern int16_t lselsw; /* fetch select switch */
|
---|
101 | extern int16_t ldkind; /* fetch file type */
|
---|
102 | extern int16_t lstrsw; /* store state switch */
|
---|
103 | extern int16_t lasgsw; /* assignments store switch */
|
---|
104 | extern int16_t lksel; /* librarian key slot selector */
|
---|
105 | extern int16_t lorchsw; /* hi orchestra (21 - 40) store switch */
|
---|
106 | extern int16_t lorclsw; /* lo orchestra (01 - 20) store switch */
|
---|
107 | extern int16_t lpatsw; /* patch store switch */
|
---|
108 | extern int16_t lscrsw; /* score store switch */
|
---|
109 | extern int16_t lseqsw; /* sequence store switch */
|
---|
110 | extern int16_t ltunsw; /* tunings store switch */
|
---|
111 | extern int16_t lwavsw; /* waveshapes store switch */
|
---|
112 | extern int16_t ldelsw; /* delete switch */
|
---|
113 | extern int16_t lderrsw; /* error message displayed switch */
|
---|
114 | extern int16_t ldidsiz; /* getcat() did showsiz() switch */
|
---|
115 | extern int16_t lmwtype; /* librarian message window type */
|
---|
116 | extern int16_t ltagged; /* load tag update in progress flag */
|
---|
117 | extern int16_t ndisp; /* display number currently up */
|
---|
118 |
|
---|
119 | extern int32_t lcsum; /* library checksum */
|
---|
120 | extern int32_t ndbytes; /* bytes needed for storage */
|
---|
121 |
|
---|
122 | extern int8_t *lmln22; /* message window line 22 */
|
---|
123 | extern int8_t *lmln23; /* message window line 23 */
|
---|
124 | extern int8_t *lmln24; /* message window line 24 */
|
---|
125 |
|
---|
126 | extern int8_t ldfile[9]; /* file name field */
|
---|
127 | extern int8_t ldcmnt[38]; /* comment field */
|
---|
128 | extern int8_t ldmsg1[65]; /* messsage build area 1 */
|
---|
129 | extern int8_t ldmsg2[65]; /* messsage build area 2 */
|
---|
130 | extern int8_t ldmsg3[65]; /* messsage build area 3 */
|
---|
131 | extern int8_t errbuf[65]; /* error message build area */
|
---|
132 |
|
---|
133 | extern struct octent *ldoct; /* object control table pointer */
|
---|
134 |
|
---|
135 | extern struct mlibhdr ldhead; /* library header */
|
---|
136 |
|
---|
137 | /* forward references */
|
---|
138 |
|
---|
139 | void ldpoint(int16_t x, int16_t y, int16_t pen);
|
---|
140 | void ldswin(int16_t n);
|
---|
141 |
|
---|
142 | extern int16_t dspace(int16_t which);
|
---|
143 | extern int16_t infield(int16_t row, int16_t col, struct fet *fetp);
|
---|
144 | extern int16_t wrt_asg(int16_t slot);
|
---|
145 | extern int16_t wrt_orc(int16_t slot, int16_t lorh);
|
---|
146 | extern int16_t wrt_pat(int16_t slot);
|
---|
147 | extern int16_t wrt_scr(int16_t slot);
|
---|
148 | extern int16_t wrt_seq(int16_t slot);
|
---|
149 | extern int16_t wrt_tun(int16_t slot);
|
---|
150 | extern int16_t wrt_wav(int16_t slot);
|
---|
151 | extern void arcurs(uint16_t icolor);
|
---|
152 | extern void dswap(void);
|
---|
153 | extern void itcini(uint16_t color);
|
---|
154 | extern void itcpos(int16_t row, int16_t col);
|
---|
155 | extern void ldermsg(int8_t *p1, int8_t *p2, int8_t *p3, uint16_t p4, uint16_t p5);
|
---|
156 | extern void nospace(int8_t *et);
|
---|
157 | extern void postio(void);
|
---|
158 | extern void preio(void);
|
---|
159 | extern void savefc(int16_t kind);
|
---|
160 | extern void ttcini(uint16_t color);
|
---|
161 | extern void vsndpal(int16_t pp[16][3]);
|
---|
162 |
|
---|
163 | /* |
---|
164 |
|
---|
165 | */
|
---|
166 |
|
---|
167 | int8_t *ftypes[][3] = { /* file types (must match libdsp.h) */
|
---|
168 |
|
---|
169 | {"ASG", "Assignmnt", "Assignmnt"}, /* FT_ASG */
|
---|
170 | {"ORL", "Orchestra", "Orchestra"}, /* FT_ORL */
|
---|
171 | {"ORH", "Orchestra", "Orchestra"}, /* FT_ORH */
|
---|
172 | {"SCR", " Score", "Score"}, /* FT_SCR */
|
---|
173 | {"TUN", " Tuning", "Tuning"}, /* FT_TUN */
|
---|
174 | {"WAV", "Waveshape", "Waveshape"}, /* FT_WAV */
|
---|
175 | {"ORC", "Orchestra", "Orchestra"}, /* FT_ORC */
|
---|
176 | {"PAT", " Patch", "Patch"}, /* FT_PAT */
|
---|
177 | {"SEQ", " Sequence", "Sequence"} /* FT_SEQ */
|
---|
178 | };
|
---|
179 |
|
---|
180 | int8_t ld_em1[] = "No files stored on disk";
|
---|
181 | int8_t ld_em2[] = " by this operation";
|
---|
182 |
|
---|
183 | int16_t lbrpal[16][3] = { /* librarian color palette */
|
---|
184 |
|
---|
185 | {0, 0, 0}, /* 0 */
|
---|
186 | {3, 3, 3}, /* 1 */
|
---|
187 | {1, 0, 0}, /* 2 */
|
---|
188 | {1, 1, 0}, /* 3 */
|
---|
189 | {2, 1, 0}, /* 4 (was 2, 2, 0) */
|
---|
190 | {1, 1, 0}, /* 5 */
|
---|
191 | {2, 1, 0}, /* 6 (was 2, 2, 0) */
|
---|
192 | {1, 0, 0}, /* 7 */
|
---|
193 | {0, 1, 1}, /* 8 (was 0, 1, 0) */
|
---|
194 | {1, 0, 0}, /* 9 */
|
---|
195 | {1, 1, 0}, /* 10 */
|
---|
196 | {2, 2, 2}, /* 11 */
|
---|
197 | {2, 3, 3}, /* 12 */
|
---|
198 | {3, 3, 0}, /* 13 */
|
---|
199 | {3, 0, 0}, /* 14 */
|
---|
200 | {0, 0, 0} /* 15 */
|
---|
201 | };
|
---|
202 |
|
---|
203 | /* |
---|
204 |
|
---|
205 | */
|
---|
206 |
|
---|
207 | /*
|
---|
208 | =============================================================================
|
---|
209 | ftkind() -- return the file type for a given file catalog slot
|
---|
210 |
|
---|
211 | ns = catalog slot index
|
---|
212 | -1 returned on error (returns 1..NFTYPES for a good type)
|
---|
213 | =============================================================================
|
---|
214 | */
|
---|
215 |
|
---|
216 | int16_t ftkind(int16_t ns)
|
---|
217 | {
|
---|
218 | register int16_t i;
|
---|
219 |
|
---|
220 | for (i = 0; i < NFTYPES; i++)
|
---|
221 | if (0 EQ memcmpu(filecat[ns].fcextn, ftypes[i][0], 3))
|
---|
222 | return(++i);
|
---|
223 |
|
---|
224 | return(-1);
|
---|
225 | }
|
---|
226 |
|
---|
227 | /*
|
---|
228 | =============================================================================
|
---|
229 | fctstr() -- return a string showing the file catalog entry type
|
---|
230 |
|
---|
231 | ns = catalog slot index
|
---|
232 | just = 0: right justify string, 1: left justify string
|
---|
233 | =============================================================================
|
---|
234 | */
|
---|
235 |
|
---|
236 | int8_t *fctstr(int16_t ns, int16_t just)
|
---|
237 | {
|
---|
238 | static int8_t fcbad[11];
|
---|
239 | register int16_t i;
|
---|
240 |
|
---|
241 | for (i = 0; i < NFTYPES; i++)
|
---|
242 | if (0 EQ memcmpu(filecat[ns].fcextn, ftypes[i][0], 3))
|
---|
243 | return(ftypes[i][just ? 2 : 1]);
|
---|
244 |
|
---|
245 | sprintf(fcbad, "?? %3.3s ??", filecat[ns].fcextn);
|
---|
246 | return(fcbad);
|
---|
247 | }
|
---|
248 |
|
---|
249 | /* |
---|
250 |
|
---|
251 | */
|
---|
252 |
|
---|
253 | /*
|
---|
254 | =============================================================================
|
---|
255 | ocslot() -- determine if a slot is occupied
|
---|
256 | =============================================================================
|
---|
257 | */
|
---|
258 |
|
---|
259 | int16_t ocslot(int16_t slot)
|
---|
260 | {
|
---|
261 | if (memcmp(filecat[slot].fcsize, "000", 3)
|
---|
262 | AND (0 NE filecat[slot].fcsize[0]))
|
---|
263 | return(TRUE);
|
---|
264 | else
|
---|
265 | return(FALSE);
|
---|
266 | }
|
---|
267 |
|
---|
268 | /*
|
---|
269 | =============================================================================
|
---|
270 | ldline() -- determine which catalog line the cursor is on, if any
|
---|
271 | =============================================================================
|
---|
272 | */
|
---|
273 |
|
---|
274 | int16_t ldline(int16_t cy)
|
---|
275 | {
|
---|
276 | if (cy > 292)
|
---|
277 | return(0);
|
---|
278 |
|
---|
279 | if (cy < 14)
|
---|
280 | return(0);
|
---|
281 |
|
---|
282 | return(cy / 14);
|
---|
283 | }
|
---|
284 |
|
---|
285 | /* |
---|
286 |
|
---|
287 | */
|
---|
288 |
|
---|
289 | /*
|
---|
290 | =============================================================================
|
---|
291 | lin2slt() -- determine which slot a line corresponds to, if any
|
---|
292 |
|
---|
293 | -1 returned on error (0..FCMAX-1 returned for a good slot)
|
---|
294 | =============================================================================
|
---|
295 | */
|
---|
296 |
|
---|
297 | int16_t lin2slt(int16_t line)
|
---|
298 | {
|
---|
299 | register int16_t slot, row;
|
---|
300 |
|
---|
301 | row = 0;
|
---|
302 |
|
---|
303 | for (slot = 0; slot < FCMAX; slot++)
|
---|
304 | if (ocslot(slot))
|
---|
305 | if (++row EQ line)
|
---|
306 | return(slot);
|
---|
307 |
|
---|
308 | return(-1);
|
---|
309 | }
|
---|
310 |
|
---|
311 | /*
|
---|
312 | =============================================================================
|
---|
313 | exp_c() -- expand a 4 bit color to 16 bits
|
---|
314 | =============================================================================
|
---|
315 | */
|
---|
316 |
|
---|
317 | uint16_t exp_c(uint16_t c)
|
---|
318 | {
|
---|
319 | c &= 0x000F; /* use low 4 bits as the basis */
|
---|
320 | c |= c << 4; /* turn them into 8 bits */
|
---|
321 | c |= c << 8; /* make it a full 16 bits */
|
---|
322 |
|
---|
323 | return(c);
|
---|
324 | }
|
---|
325 |
|
---|
326 | /* |
---|
327 |
|
---|
328 | */
|
---|
329 |
|
---|
330 | /*
|
---|
331 | =============================================================================
|
---|
332 | ldwmsg() -- display a message in the message window
|
---|
333 | =============================================================================
|
---|
334 | */
|
---|
335 |
|
---|
336 | void ldwmsg(int8_t *line1, int8_t *line2, int8_t *line3, uint16_t fgcolor, uint16_t bgcolor)
|
---|
337 | {
|
---|
338 | lderrsw = FALSE; /* clear error switch */
|
---|
339 | lmwtype = 2; /* message type */
|
---|
340 | submenu = FALSE;
|
---|
341 |
|
---|
342 | if (ndisp NE 0)
|
---|
343 | return;
|
---|
344 |
|
---|
345 | bgcolor = exp_c(bgcolor); /* expand background color */
|
---|
346 | fgcolor = exp_c(fgcolor); /* expand foreground color */
|
---|
347 |
|
---|
348 | if (v_regs[5] & 0x0180)
|
---|
349 | vbank(0);
|
---|
350 |
|
---|
351 | /* clear the window */
|
---|
352 |
|
---|
353 | vbfill4(librob, 128, ldbox[10][0], ldbox[10][1],
|
---|
354 | ldbox[10][2], ldbox[10][3], bgcolor);
|
---|
355 |
|
---|
356 | if ((int8_t *)NULL NE line1)
|
---|
357 | tsplot4(librob, 64, fgcolor, ldbox[10][6], ldbox[10][7],
|
---|
358 | line1, 14);
|
---|
359 |
|
---|
360 | if ((int8_t *)NULL NE line2)
|
---|
361 | tsplot4(librob, 64, fgcolor, (ldbox[10][6] + 1), ldbox[10][7],
|
---|
362 | line2, 14);
|
---|
363 |
|
---|
364 | if ((int8_t *)NULL NE line3)
|
---|
365 | tsplot4(librob, 64, fgcolor, (ldbox[10][6] + 2), ldbox[10][7],
|
---|
366 | line3, 14);
|
---|
367 | }
|
---|
368 |
|
---|
369 | /* |
---|
370 |
|
---|
371 | */
|
---|
372 |
|
---|
373 | /*
|
---|
374 | =============================================================================
|
---|
375 | chksum() -- checksum an area of memory
|
---|
376 | =============================================================================
|
---|
377 | */
|
---|
378 |
|
---|
379 | int32_t chksum(int8_t *area, int32_t len)
|
---|
380 | {
|
---|
381 | register int32_t cs, i;
|
---|
382 |
|
---|
383 | cs = 0L;
|
---|
384 |
|
---|
385 | for (i = 0; i < len; i++)
|
---|
386 | cs += 0x000000FFL & *area++;
|
---|
387 |
|
---|
388 | return(cs);
|
---|
389 | }
|
---|
390 |
|
---|
391 | /*
|
---|
392 | =============================================================================
|
---|
393 | makelh() -- make a library header
|
---|
394 | =============================================================================
|
---|
395 | */
|
---|
396 |
|
---|
397 | void makelh(int16_t kind)
|
---|
398 | {
|
---|
399 | memset(ldhead.l_csum, '?', 8); /* checksum */
|
---|
400 | memcpy(ldhead.l_name, ldfile, 8); /* file name */
|
---|
401 | memcpy(ldhead.l_type, ftypes[kind - 1][0], 3); /* file type */
|
---|
402 | memcpy(ldhead.l_cmnt, ldcmnt, 37); /* comment */
|
---|
403 |
|
---|
404 | lcsum = chksum(ldhead.l_name, (int32_t)(LH_LEN - 8));
|
---|
405 | }
|
---|
406 |
|
---|
407 | /* |
---|
408 |
|
---|
409 | */
|
---|
410 |
|
---|
411 | /*
|
---|
412 | =============================================================================
|
---|
413 | ldbusy() -- put up a "Busy" message
|
---|
414 | =============================================================================
|
---|
415 | */
|
---|
416 |
|
---|
417 | void ldbusy(int8_t *msg)
|
---|
418 | {
|
---|
419 | if (ndisp NE 0)
|
---|
420 | return;
|
---|
421 |
|
---|
422 | ldwmsg((int8_t *)NULL, " Busy - Please stand by", msg,
|
---|
423 | ldbox[10][4], ldbox[10][5]);
|
---|
424 | }
|
---|
425 |
|
---|
426 | /*
|
---|
427 | =============================================================================
|
---|
428 | noslot() -- complain about not finding a slot we expected
|
---|
429 | =============================================================================
|
---|
430 | */
|
---|
431 |
|
---|
432 | void noslot(int16_t fctype)
|
---|
433 | {
|
---|
434 | sprintf(ldmsg1, " the %s file,", ftypes[fctype - 1][2]);
|
---|
435 |
|
---|
436 | ldermsg("Can't find a slot for",
|
---|
437 | ldmsg1, " and one was expected", LD_EMCF, LD_EMCB);
|
---|
438 | }
|
---|
439 |
|
---|
440 | /* |
---|
441 |
|
---|
442 | */
|
---|
443 |
|
---|
444 | /*
|
---|
445 | =============================================================================
|
---|
446 | wr_ec() -- write with error checking
|
---|
447 | =============================================================================
|
---|
448 | */
|
---|
449 |
|
---|
450 | int16_t wr_ec(FILE *fp, int8_t *from, int32_t len)
|
---|
451 | {
|
---|
452 | register int32_t count;
|
---|
453 | register int8_t c;
|
---|
454 | for (count = 0; count < len; count++) {
|
---|
455 |
|
---|
456 | errno = 0;
|
---|
457 | c = *from++;
|
---|
458 |
|
---|
459 | if (EOF EQ putc(c, fp)) {
|
---|
460 |
|
---|
461 | sprintf(errbuf, "errno = %d", errno);
|
---|
462 |
|
---|
463 | ldermsg("Disk may be full",
|
---|
464 | errbuf, (int8_t *)NULL, LD_EMCF, LD_EMCB);
|
---|
465 |
|
---|
466 | fclose(fp);
|
---|
467 | postio(); /* restore LCD backlight */
|
---|
468 | return(FAILURE);
|
---|
469 | }
|
---|
470 |
|
---|
471 | #if DEBUGWE
|
---|
472 | if (debugsw AND debugwe)
|
---|
473 | printf(" %02.2X", 0x00FF & c);
|
---|
474 | #endif
|
---|
475 | }
|
---|
476 |
|
---|
477 | return(SUCCESS);
|
---|
478 | }
|
---|
479 |
|
---|
480 | /* |
---|
481 |
|
---|
482 | */
|
---|
483 |
|
---|
484 | /*
|
---|
485 | =============================================================================
|
---|
486 | rd_ec() -- read with error checking
|
---|
487 | =============================================================================
|
---|
488 | */
|
---|
489 |
|
---|
490 | int16_t rd_ec(FILE *fp, int8_t *to, int32_t len)
|
---|
491 | {
|
---|
492 | register int32_t count;
|
---|
493 | register int16_t c;
|
---|
494 |
|
---|
495 | for (count = 0; count < len; count++) {
|
---|
496 |
|
---|
497 | errno = 0;
|
---|
498 |
|
---|
499 | if (EOF EQ (c = getc(fp))) {
|
---|
500 |
|
---|
501 | sprintf(errbuf, "errno = %d", errno);
|
---|
502 |
|
---|
503 | ldermsg("Unexpected EOF",
|
---|
504 | errbuf, (int8_t *)NULL, LD_EMCF, LD_EMCB);
|
---|
505 |
|
---|
506 | fclose(fp);
|
---|
507 | postio(); /* restore LCD backlight */
|
---|
508 | return(FAILURE);
|
---|
509 |
|
---|
510 | } else {
|
---|
511 |
|
---|
512 | *to++ = c;
|
---|
513 |
|
---|
514 | #if DEBUGRE
|
---|
515 | if (debugsw AND debugre)
|
---|
516 | printf(" %02.2X", 0x00FF & c);
|
---|
517 | #endif
|
---|
518 | }
|
---|
519 | }
|
---|
520 |
|
---|
521 | return(SUCCESS);
|
---|
522 | }
|
---|
523 |
|
---|
524 | /* |
---|
525 |
|
---|
526 | */
|
---|
527 |
|
---|
528 | /*
|
---|
529 | =============================================================================
|
---|
530 | srchcat() -- search the file catalog
|
---|
531 |
|
---|
532 | returns -1 on 'not found', slot 0..FCMAX-1 if found
|
---|
533 | =============================================================================
|
---|
534 | */
|
---|
535 |
|
---|
536 | int16_t srchcat(int8_t extn[])
|
---|
537 | {
|
---|
538 | register int16_t fcslot;
|
---|
539 |
|
---|
540 | for (fcslot = 0; fcslot < FCMAX; fcslot++) {
|
---|
541 |
|
---|
542 | if (ocslot(fcslot))
|
---|
543 | if (0 EQ (memcmp(filecat[fcslot].fcname, ldfile, 8))
|
---|
544 | AND (0 EQ memcmpu(filecat[fcslot].fcextn, extn, 3)))
|
---|
545 | return(fcslot);
|
---|
546 | }
|
---|
547 |
|
---|
548 | return(-1);
|
---|
549 | }
|
---|
550 |
|
---|
551 | /*
|
---|
552 | =============================================================================
|
---|
553 | clrcat() -- clear the file catalog
|
---|
554 | =============================================================================
|
---|
555 | */
|
---|
556 |
|
---|
557 | void clrcat(void)
|
---|
558 | {
|
---|
559 | register int16_t i;
|
---|
560 | int8_t fcebuf[1 + sizeof (struct fcat)];
|
---|
561 |
|
---|
562 | for (i = 0; i < FCMAX; i++) {
|
---|
563 |
|
---|
564 | sprintf(fcebuf, "000 Empty-%02.2d ??? %-37.37s%c%c",
|
---|
565 | i, "1234567890123456789012345678901234567",
|
---|
566 | A_CR, A_LF);
|
---|
567 |
|
---|
568 | memcpy(&filecat[i], fcebuf, sizeof (struct fcat));
|
---|
569 | }
|
---|
570 | }
|
---|
571 |
|
---|
572 | /* |
---|
573 |
|
---|
574 | */
|
---|
575 |
|
---|
576 | /*
|
---|
577 | =============================================================================
|
---|
578 | clreq() -- return number of clusters needed for a file
|
---|
579 |
|
---|
580 | Assumes the BPB pointer is valid.
|
---|
581 | =============================================================================
|
---|
582 | */
|
---|
583 |
|
---|
584 | int16_t clreq(int32_t bytes)
|
---|
585 | {
|
---|
586 | register int16_t rclusts;
|
---|
587 | register int32_t clmask;
|
---|
588 |
|
---|
589 | clmask = _thebpb->clsizb - 1;
|
---|
590 |
|
---|
591 | rclusts = (bytes / _thebpb->clsizb)
|
---|
592 | + ((bytes & clmask) ? 1 : 0);
|
---|
593 |
|
---|
594 | return(rclusts);
|
---|
595 | }
|
---|
596 |
|
---|
597 | /* |
---|
598 |
|
---|
599 | */
|
---|
600 |
|
---|
601 | /*
|
---|
602 | =============================================================================
|
---|
603 | spacerq() -- return space required for storing a file
|
---|
604 | =============================================================================
|
---|
605 | */
|
---|
606 |
|
---|
607 | int16_t spacerq(int16_t kind)
|
---|
608 | {
|
---|
609 | register int16_t howmuch;
|
---|
610 | register int32_t k;
|
---|
611 |
|
---|
612 | k = 0L;
|
---|
613 |
|
---|
614 | switch (kind) {
|
---|
615 |
|
---|
616 | case FT_ASG: /* Assignment file */
|
---|
617 |
|
---|
618 | k = (sizeof (struct asgent) * (int32_t)NASGLIB) + LH_LEN;
|
---|
619 | break;
|
---|
620 |
|
---|
621 | case FT_ORL:
|
---|
622 | case FT_ORH:
|
---|
623 | case FT_ORC:
|
---|
624 |
|
---|
625 | k = ((OR_LEN1 + (2 * OR_LEN2)) * (int32_t)NINORC) + LH_LEN;
|
---|
626 | break;
|
---|
627 |
|
---|
628 | case FT_PAT: /* Patch file */
|
---|
629 |
|
---|
630 | k = ptsizer() + LH_LEN;
|
---|
631 | break;
|
---|
632 |
|
---|
633 | case FT_SCR: /* Score file */
|
---|
634 |
|
---|
635 | k = scsizer() + LH_LEN;
|
---|
636 | break;
|
---|
637 |
|
---|
638 | case FT_SEQ: /* Sequence file */
|
---|
639 |
|
---|
640 | k = sqsizer() + LH_LEN;
|
---|
641 | break;
|
---|
642 |
|
---|
643 | case FT_TUN: /* Tuning file */
|
---|
644 |
|
---|
645 | k = (NTUNSLIB * 256L) + (NTUNSLIB * 32L) + LH_LEN;
|
---|
646 | break;
|
---|
647 |
|
---|
648 | case FT_WAV: /* Waveshape file */
|
---|
649 |
|
---|
650 | k = ((int32_t)NUMWAVS * OR_LEN2) + LH_LEN;
|
---|
651 | break;
|
---|
652 |
|
---|
653 | default:
|
---|
654 |
|
---|
655 | k = 0L;
|
---|
656 | break;
|
---|
657 | }
|
---|
658 | /* |
---|
659 |
|
---|
660 | */
|
---|
661 | howmuch = k ? clreq(k) : -1;
|
---|
662 | ndbytes = k;
|
---|
663 | return(howmuch);
|
---|
664 | }
|
---|
665 |
|
---|
666 | /* |
---|
667 |
|
---|
668 | */
|
---|
669 |
|
---|
670 | /*
|
---|
671 | =============================================================================
|
---|
672 | ckstor() -- check for storage type selection
|
---|
673 | =============================================================================
|
---|
674 | */
|
---|
675 |
|
---|
676 | int16_t ckstor(void)
|
---|
677 | {
|
---|
678 | if (lasgsw) /* assignments */
|
---|
679 | return(SUCCESS);
|
---|
680 |
|
---|
681 | if (lorchsw) /* hi orch */
|
---|
682 | return(SUCCESS);
|
---|
683 |
|
---|
684 | if (lorclsw) /* lo orch */
|
---|
685 | return(SUCCESS);
|
---|
686 |
|
---|
687 | if (lpatsw) /* patches */
|
---|
688 | return(SUCCESS);
|
---|
689 |
|
---|
690 | if (lscrsw) /* score */
|
---|
691 | return(SUCCESS);
|
---|
692 |
|
---|
693 | if (lseqsw) /* sequences */
|
---|
694 | return(SUCCESS);
|
---|
695 |
|
---|
696 | if (ltunsw) /* tunings */
|
---|
697 | return(SUCCESS);
|
---|
698 |
|
---|
699 | if (lwavsw) /* waveshapes */
|
---|
700 | return(SUCCESS);
|
---|
701 |
|
---|
702 | return(FAILURE);
|
---|
703 | }
|
---|
704 |
|
---|
705 | /* |
---|
706 |
|
---|
707 | */
|
---|
708 |
|
---|
709 | /*
|
---|
710 | =============================================================================
|
---|
711 | ckdups() -- check for duplicate file type entries in the file catalog
|
---|
712 | =============================================================================
|
---|
713 | */
|
---|
714 |
|
---|
715 | int16_t ckdups(void)
|
---|
716 | {
|
---|
717 | if (lasgsw)
|
---|
718 | if (-1 NE srchcat("asg"))
|
---|
719 | return(FT_ASG);
|
---|
720 |
|
---|
721 | if (lorchsw)
|
---|
722 | if (-1 NE srchcat("orh"))
|
---|
723 | return(FT_ORH);
|
---|
724 |
|
---|
725 | if (lorclsw)
|
---|
726 | if (-1 NE srchcat("orl"))
|
---|
727 | return(FT_ORL);
|
---|
728 |
|
---|
729 | if (lorchsw OR lorclsw)
|
---|
730 | if (-1 NE srchcat("orc"))
|
---|
731 | return(FT_ORC);
|
---|
732 |
|
---|
733 | if (lpatsw)
|
---|
734 | if (-1 NE srchcat("pat"))
|
---|
735 | return(FT_PAT);
|
---|
736 |
|
---|
737 | if (lscrsw)
|
---|
738 | if (-1 NE srchcat("scr"))
|
---|
739 | return(FT_SCR);
|
---|
740 |
|
---|
741 | if (lseqsw)
|
---|
742 | if (-1 NE srchcat("seq"))
|
---|
743 | return(FT_SEQ);
|
---|
744 |
|
---|
745 | if (ltunsw)
|
---|
746 | if (-1 NE srchcat("tun"))
|
---|
747 | return(FT_TUN);
|
---|
748 |
|
---|
749 | if (lwavsw)
|
---|
750 | if (-1 NE srchcat("wav"))
|
---|
751 | return(FT_WAV);
|
---|
752 | return(0);
|
---|
753 | }
|
---|
754 |
|
---|
755 | /* |
---|
756 |
|
---|
757 | */
|
---|
758 |
|
---|
759 | /*
|
---|
760 | =============================================================================
|
---|
761 | showsiz() -- display disk capacity and usage
|
---|
762 |
|
---|
763 | Forces the disk to be read to get the BPB and FAT.
|
---|
764 | =============================================================================
|
---|
765 | */
|
---|
766 |
|
---|
767 | int16_t showsiz(void)
|
---|
768 | {
|
---|
769 | register int16_t dcap, drem, dused;
|
---|
770 |
|
---|
771 | _bpbin = FALSE; /* force disk to be read */
|
---|
772 |
|
---|
773 | dcap = dspace(0);
|
---|
774 |
|
---|
775 | if (dcap EQ -1) {
|
---|
776 |
|
---|
777 | ldermsg("Disk not ready ?",
|
---|
778 | (int8_t *)NULL, (int8_t *)NULL,
|
---|
779 | LD_EMCF, LD_EMCB);
|
---|
780 |
|
---|
781 | return(FAILURE);
|
---|
782 | }
|
---|
783 |
|
---|
784 | drem = dspace(1);
|
---|
785 | dused = dcap - drem;
|
---|
786 |
|
---|
787 | sprintf(ldmsg1, "Microdisk capacity %4u blocks", dcap);
|
---|
788 | sprintf(ldmsg2, "This disk consumes %4u blocks", dused);
|
---|
789 | sprintf(ldmsg3, "Available space is %4u blocks", drem);
|
---|
790 |
|
---|
791 | ldwmsg(ldmsg1, ldmsg2, ldmsg3, ldbox[10][4], ldbox[10][5]);
|
---|
792 | return(SUCCESS);
|
---|
793 | }
|
---|
794 |
|
---|
795 | /* |
---|
796 |
|
---|
797 | */
|
---|
798 |
|
---|
799 | /*
|
---|
800 | =============================================================================
|
---|
801 | getcat() -- get the file catalog from disk
|
---|
802 | =============================================================================
|
---|
803 | */
|
---|
804 |
|
---|
805 | int16_t getcat(int16_t msgsw)
|
---|
806 | {
|
---|
807 | register FILE *fp;
|
---|
808 | int16_t rc, fesize;
|
---|
809 |
|
---|
810 | ldidsiz = FALSE; /* we didn't show the size (yet) */
|
---|
811 | _bpbin = FALSE; /* guarantee we read the directory */
|
---|
812 | catin = FALSE; /* catalog not valid */
|
---|
813 |
|
---|
814 | errno = 0;
|
---|
815 | preio(); /* kill LCD backlight */
|
---|
816 | fp = fopenb(CATNAME, "r"); /* open the catalog file */
|
---|
817 |
|
---|
818 | if (NULL EQ fp) {
|
---|
819 |
|
---|
820 | clrcat();
|
---|
821 | catin = TRUE;
|
---|
822 |
|
---|
823 | if (msgsw) { /* see if we show the message */
|
---|
824 |
|
---|
825 | showsiz();
|
---|
826 | ldidsiz = TRUE; /* showed the size */
|
---|
827 | }
|
---|
828 |
|
---|
829 | return(SUCCESS); /* no catalog is OK, too */
|
---|
830 | }
|
---|
831 |
|
---|
832 | fesize = sizeof(struct fcat);
|
---|
833 | memset(filecat, 0, sizeof (struct fcat) * FCMAX);
|
---|
834 |
|
---|
835 | /* |
---|
836 |
|
---|
837 | */
|
---|
838 | errno = 0;
|
---|
839 | rc = fread(filecat, fesize, FCMAX, fp);
|
---|
840 |
|
---|
841 | if (rc NE FCMAX) {
|
---|
842 |
|
---|
843 | if (rc) {
|
---|
844 |
|
---|
845 | sprintf(ldmsg1, " fread returned %d", rc);
|
---|
846 | sprintf(ldmsg2, " errno = %d, fesize=%d",
|
---|
847 | errno, fesize);
|
---|
848 |
|
---|
849 | ldermsg("Unable to read catalog",
|
---|
850 | ldmsg1, ldmsg2, LD_EMCF, LD_EMCB);
|
---|
851 |
|
---|
852 | catin = FALSE;
|
---|
853 |
|
---|
854 | } else {
|
---|
855 |
|
---|
856 | ldermsg("File catalog is NULL",
|
---|
857 | (int8_t *)NULL, (int8_t *)NULL,
|
---|
858 | LD_EMCF, LD_EMCB);
|
---|
859 |
|
---|
860 | clrcat();
|
---|
861 | catin = TRUE;
|
---|
862 | }
|
---|
863 |
|
---|
864 | fclose(fp);
|
---|
865 | postio(); /* restore LCD backlight */
|
---|
866 | return(FAILURE);
|
---|
867 | }
|
---|
868 |
|
---|
869 | catin = TRUE;
|
---|
870 | fclose(fp);
|
---|
871 | postio(); /* restore LCD backlight */
|
---|
872 | return(SUCCESS);
|
---|
873 | }
|
---|
874 |
|
---|
875 | /* |
---|
876 |
|
---|
877 | */
|
---|
878 |
|
---|
879 | /*
|
---|
880 | =============================================================================
|
---|
881 | putcat() -- write the updated catalog on disk
|
---|
882 | =============================================================================
|
---|
883 | */
|
---|
884 |
|
---|
885 | int16_t putcat(void)
|
---|
886 | {
|
---|
887 | register FILE *fp;
|
---|
888 | register int16_t i, rc, fesize;
|
---|
889 |
|
---|
890 | for (i = 0; i < FCMAX; i++) { /* clean up the catalog */
|
---|
891 |
|
---|
892 | filecat[i].fceol[0] = A_CR;
|
---|
893 | filecat[i].fceol[1] = A_LF;
|
---|
894 | }
|
---|
895 |
|
---|
896 | errno = 0;
|
---|
897 | preio(); /* kill LCD backlight */
|
---|
898 | fp = fopenb(CATNAME, "w"); /* open the catalog file */
|
---|
899 |
|
---|
900 | if (NULL EQ fp) {
|
---|
901 |
|
---|
902 | sprintf(ldmsg2, " errno = %d", errno);
|
---|
903 |
|
---|
904 | ldermsg("Unable to open catalog",
|
---|
905 | (int8_t *)NULL, ldmsg2, LD_EMCF, LD_EMCB);
|
---|
906 |
|
---|
907 | return(FAILURE);
|
---|
908 | }
|
---|
909 |
|
---|
910 | fesize = sizeof (struct fcat);
|
---|
911 |
|
---|
912 | /* |
---|
913 |
|
---|
914 | */
|
---|
915 | errno = 0;
|
---|
916 | rc = fwrite(filecat, fesize, FCMAX, fp);
|
---|
917 |
|
---|
918 | if (rc NE FCMAX) {
|
---|
919 |
|
---|
920 | if (rc) {
|
---|
921 |
|
---|
922 | sprintf(ldmsg1, " fwrite returned %d", rc);
|
---|
923 | sprintf(ldmsg2, " errno = %d, fesize=%d",
|
---|
924 | errno, fesize);
|
---|
925 |
|
---|
926 | ldermsg("Can't write catalog",
|
---|
927 | ldmsg1, ldmsg2, LD_EMCF, LD_EMCB);
|
---|
928 |
|
---|
929 | } else {
|
---|
930 |
|
---|
931 | sprintf(ldmsg2, " errno = %d", errno);
|
---|
932 |
|
---|
933 | ldermsg("Disk may be full",
|
---|
934 | (int8_t *)NULL, ldmsg2,
|
---|
935 | LD_EMCF, LD_EMCB);
|
---|
936 | }
|
---|
937 |
|
---|
938 | fclose(fp);
|
---|
939 | postio(); /* restore LCD backlight */
|
---|
940 | return(FAILURE);
|
---|
941 | }
|
---|
942 |
|
---|
943 | fclose(fp);
|
---|
944 | postio(); /* restore LCD backlight */
|
---|
945 | return(SUCCESS);
|
---|
946 | }
|
---|
947 |
|
---|
948 | /* |
---|
949 |
|
---|
950 | */
|
---|
951 |
|
---|
952 | /*
|
---|
953 | =============================================================================
|
---|
954 | dslslot() -- display a file catalog entry
|
---|
955 | =============================================================================
|
---|
956 | */
|
---|
957 |
|
---|
958 | void dslslot(int16_t slot, uint16_t fg, int16_t row)
|
---|
959 | {
|
---|
960 | register uint16_t color, chilon, chilorc;
|
---|
961 | int16_t c;
|
---|
962 | int8_t buf[40];
|
---|
963 |
|
---|
964 | if (ndisp NE 0)
|
---|
965 | return;
|
---|
966 |
|
---|
967 | color = exp_c(fg); /* foreground color */
|
---|
968 | chilon = exp_c(ldbox[1][4]);
|
---|
969 | chilorc = exp_c(HILORC);
|
---|
970 |
|
---|
971 | /* file type */
|
---|
972 |
|
---|
973 | vcputsv(librob, 64, color, ldbox[1][5], row, 1, fctstr(slot, 0), 14);
|
---|
974 |
|
---|
975 | /* load letter */
|
---|
976 |
|
---|
977 | c = filecat[slot].fcp0;
|
---|
978 | buf[0] = 0x007F & c;
|
---|
979 | buf[1] = '\0';
|
---|
980 | vcputsv(librob, 64, (c & 0x0080) ? chilorc : chilon,
|
---|
981 | ldbox[1][5], row, 11, buf, 14);
|
---|
982 |
|
---|
983 | /* file name */
|
---|
984 |
|
---|
985 | memcpy(buf, filecat[slot].fcname, 8);
|
---|
986 | buf[8] = '\0';
|
---|
987 | vcputsv(librob, 64, color, ldbox[1][5], row, 13, buf, 14);
|
---|
988 |
|
---|
989 | /* comment */
|
---|
990 |
|
---|
991 | memcpy(buf, filecat[slot].fccmnt, 37);
|
---|
992 | buf[37] = '\0';
|
---|
993 | vcputsv(librob, 64, chilon, ldbox[1][5], row, 22, buf, 14);
|
---|
994 |
|
---|
995 | /* size */
|
---|
996 |
|
---|
997 | memcpy(buf, filecat[slot].fcsize, 3);
|
---|
998 | buf[3] = '\0';
|
---|
999 | vcputsv(librob, 64, chilon, ldbox[1][5], row, 60, buf, 14);
|
---|
1000 | }
|
---|
1001 |
|
---|
1002 | /* |
---|
1003 |
|
---|
1004 | */
|
---|
1005 |
|
---|
1006 | /*
|
---|
1007 | =============================================================================
|
---|
1008 | showcat() -- display the file catalog entries
|
---|
1009 | =============================================================================
|
---|
1010 | */
|
---|
1011 |
|
---|
1012 | int16_t showcat(void)
|
---|
1013 | {
|
---|
1014 | register int16_t i, fcslot, fcrow, fcount;
|
---|
1015 | register uint16_t color;
|
---|
1016 |
|
---|
1017 | if (ndisp NE 0)
|
---|
1018 | return(FAILURE);
|
---|
1019 |
|
---|
1020 | ldswin(0); /* fix up the title */
|
---|
1021 |
|
---|
1022 | color = exp_c(ldbox[1][5]); /* background color */
|
---|
1023 |
|
---|
1024 | if (v_regs[5] & 0x0180)
|
---|
1025 | vbank(0);
|
---|
1026 |
|
---|
1027 | vbfill4(librob, 128, ldbox[1][0], ldbox[1][1],
|
---|
1028 | ldbox[1][2], ldbox[1][3], color);
|
---|
1029 |
|
---|
1030 | color = ldbox[1][4]; /* foreground color */
|
---|
1031 |
|
---|
1032 | fcrow = 1;
|
---|
1033 | fcount = 0;
|
---|
1034 |
|
---|
1035 | for (fcslot = 0; fcslot < FCMAX; fcslot++) {
|
---|
1036 |
|
---|
1037 | if (ocslot(fcslot)) {
|
---|
1038 |
|
---|
1039 | dslslot(fcslot, color, fcrow);
|
---|
1040 | fcrow++;
|
---|
1041 | fcount++;
|
---|
1042 | }
|
---|
1043 | }
|
---|
1044 |
|
---|
1045 | return(fcount);
|
---|
1046 | }
|
---|
1047 |
|
---|
1048 | /* |
---|
1049 |
|
---|
1050 | */
|
---|
1051 |
|
---|
1052 | /*
|
---|
1053 | =============================================================================
|
---|
1054 | fcindex() -- display the file catalog
|
---|
1055 | =============================================================================
|
---|
1056 | */
|
---|
1057 |
|
---|
1058 | int16_t fcindex(void)
|
---|
1059 | {
|
---|
1060 | if (NOT lderrsw)
|
---|
1061 | ldbusy(" Reading catalog");
|
---|
1062 |
|
---|
1063 | if (getcat(1)) /* get catalog, possibly display size */
|
---|
1064 | return(FAILURE);
|
---|
1065 |
|
---|
1066 | if (NOT lderrsw)
|
---|
1067 | showcat(); /* display the catalog */
|
---|
1068 |
|
---|
1069 | /* show size if getcat() didn't */
|
---|
1070 |
|
---|
1071 | if ((NOT ldidsiz) AND (NOT lderrsw))
|
---|
1072 | showsiz();
|
---|
1073 |
|
---|
1074 | return(SUCCESS);
|
---|
1075 | }
|
---|
1076 |
|
---|
1077 | /* |
---|
1078 |
|
---|
1079 | */
|
---|
1080 |
|
---|
1081 | /*
|
---|
1082 | =============================================================================
|
---|
1083 | streset() -- reset the switches after a store or an error
|
---|
1084 | =============================================================================
|
---|
1085 | */
|
---|
1086 |
|
---|
1087 | void streset(void)
|
---|
1088 | {
|
---|
1089 | lstrsw = FALSE;
|
---|
1090 |
|
---|
1091 | lasgsw = FALSE;
|
---|
1092 | lorchsw = FALSE;
|
---|
1093 | lorclsw = FALSE;
|
---|
1094 | lpatsw = FALSE;
|
---|
1095 | lscrsw = FALSE;
|
---|
1096 | lseqsw = FALSE;
|
---|
1097 | ltunsw = FALSE;
|
---|
1098 | lwavsw = FALSE;
|
---|
1099 |
|
---|
1100 | ldswin(9);
|
---|
1101 | }
|
---|
1102 |
|
---|
1103 | /*
|
---|
1104 | =============================================================================
|
---|
1105 | fcreset() -- reset the switches after a fetch or an error
|
---|
1106 | =============================================================================
|
---|
1107 | */
|
---|
1108 |
|
---|
1109 | void fcreset(void)
|
---|
1110 | {
|
---|
1111 | lselsw = FALSE;
|
---|
1112 |
|
---|
1113 | ldswin(6);
|
---|
1114 | }
|
---|
1115 |
|
---|
1116 | /* |
---|
1117 |
|
---|
1118 | */
|
---|
1119 |
|
---|
1120 | /*
|
---|
1121 | =============================================================================
|
---|
1122 | getslot() -- find a free file catalog slot
|
---|
1123 |
|
---|
1124 | returns -1 on error, slot # 0..FCMAX-1 if a slot was found
|
---|
1125 | =============================================================================
|
---|
1126 | */
|
---|
1127 |
|
---|
1128 | int16_t getslot(void)
|
---|
1129 | {
|
---|
1130 | register int16_t i;
|
---|
1131 |
|
---|
1132 | for (i = 0; i < FCMAX; i++)
|
---|
1133 | if (NOT ocslot(i))
|
---|
1134 | return(i);
|
---|
1135 |
|
---|
1136 | return(-1);
|
---|
1137 | }
|
---|
1138 |
|
---|
1139 | /*
|
---|
1140 | =============================================================================
|
---|
1141 | slotnam() -- return the file name for a slot
|
---|
1142 | =============================================================================
|
---|
1143 | */
|
---|
1144 |
|
---|
1145 | int8_t *slotnam(uint16_t slot, uint16_t kind)
|
---|
1146 | {
|
---|
1147 | static int8_t thename[13];
|
---|
1148 |
|
---|
1149 | sprintf(thename, "M7SLOT%02.2u.%-3.3s",
|
---|
1150 | slot, ftypes[kind - 1][0]);
|
---|
1151 |
|
---|
1152 | return(thename);
|
---|
1153 | }
|
---|
1154 |
|
---|
1155 | /* |
---|
1156 |
|
---|
1157 | */
|
---|
1158 |
|
---|
1159 | /*
|
---|
1160 | =============================================================================
|
---|
1161 | wrtfile() -- write a file on the disk
|
---|
1162 | =============================================================================
|
---|
1163 | */
|
---|
1164 |
|
---|
1165 | int16_t wrtfile(int16_t kind)
|
---|
1166 | {
|
---|
1167 | register int16_t slot, flspace, tkind;
|
---|
1168 | int8_t sizetmp[4];
|
---|
1169 |
|
---|
1170 | slot = getslot();
|
---|
1171 |
|
---|
1172 | if (-1 EQ slot) {
|
---|
1173 |
|
---|
1174 | noslot(kind);
|
---|
1175 | streset();
|
---|
1176 | return(FAILURE);
|
---|
1177 | }
|
---|
1178 |
|
---|
1179 | /* |
---|
1180 |
|
---|
1181 | */
|
---|
1182 |
|
---|
1183 | switch (kind) {
|
---|
1184 |
|
---|
1185 | case FT_ASG:
|
---|
1186 |
|
---|
1187 | if (wrt_asg(slot))
|
---|
1188 | return(FAILURE);
|
---|
1189 | else
|
---|
1190 | break;
|
---|
1191 |
|
---|
1192 | case FT_ORL: /* lo orch write */
|
---|
1193 |
|
---|
1194 | if (wrt_orc(slot, 0))
|
---|
1195 | return(FAILURE);
|
---|
1196 | else
|
---|
1197 | break;
|
---|
1198 |
|
---|
1199 | case FT_ORH: /* hi orch write */
|
---|
1200 |
|
---|
1201 | if (wrt_orc(slot, 1))
|
---|
1202 | return(FAILURE);
|
---|
1203 | else
|
---|
1204 | break;
|
---|
1205 |
|
---|
1206 | case FT_PAT:
|
---|
1207 |
|
---|
1208 | if (wrt_pat(slot))
|
---|
1209 | return(FAILURE);
|
---|
1210 | else
|
---|
1211 | break;
|
---|
1212 |
|
---|
1213 | case FT_SCR:
|
---|
1214 |
|
---|
1215 | if (wrt_scr(slot))
|
---|
1216 | return(FAILURE);
|
---|
1217 | else
|
---|
1218 | break;
|
---|
1219 |
|
---|
1220 | case FT_SEQ:
|
---|
1221 |
|
---|
1222 | if (wrt_seq(slot))
|
---|
1223 | return(FAILURE);
|
---|
1224 | else
|
---|
1225 | break;
|
---|
1226 |
|
---|
1227 | /* |
---|
1228 |
|
---|
1229 | */
|
---|
1230 | case FT_TUN:
|
---|
1231 |
|
---|
1232 | if (wrt_tun(slot))
|
---|
1233 | return(FAILURE);
|
---|
1234 | else
|
---|
1235 | break;
|
---|
1236 |
|
---|
1237 | case FT_WAV:
|
---|
1238 |
|
---|
1239 | if (wrt_wav(slot))
|
---|
1240 | return(FAILURE);
|
---|
1241 | else
|
---|
1242 | break;
|
---|
1243 |
|
---|
1244 | default:
|
---|
1245 |
|
---|
1246 | sprintf(ldmsg1, " kind=%d", kind);
|
---|
1247 |
|
---|
1248 | ldermsg("bad wrtfile argument:",
|
---|
1249 | ldmsg1, (int8_t *)NULL, LD_EMCF, LD_EMCB);
|
---|
1250 |
|
---|
1251 | return(FAILURE);
|
---|
1252 | }
|
---|
1253 |
|
---|
1254 | /* |
---|
1255 |
|
---|
1256 | */
|
---|
1257 |
|
---|
1258 | /* update the file catalog */
|
---|
1259 |
|
---|
1260 | if ((kind EQ FT_ORL) OR (kind EQ FT_ORH))
|
---|
1261 | tkind = FT_ORC;
|
---|
1262 | else
|
---|
1263 | tkind = kind;
|
---|
1264 |
|
---|
1265 | flspace = spacerq(kind);
|
---|
1266 |
|
---|
1267 | sprintf(sizetmp, "%03.3d", flspace); /* size */
|
---|
1268 | memcpy(filecat[slot].fcsize, sizetmp, 3);
|
---|
1269 |
|
---|
1270 | memcpy(filecat[slot].fcname, ldfile, 8); /* name */
|
---|
1271 | memcpy(filecat[slot].fcextn, ftypes[tkind - 1][0], 3); /* type */
|
---|
1272 | memcpy(filecat[slot].fccmnt, ldcmnt, 37); /* comment */
|
---|
1273 |
|
---|
1274 | savefc(kind);
|
---|
1275 |
|
---|
1276 | filecat[slot].fceol[0] = A_CR;
|
---|
1277 | filecat[slot].fceol[1] = A_LF;
|
---|
1278 |
|
---|
1279 | return(SUCCESS);
|
---|
1280 | }
|
---|
1281 |
|
---|
1282 | /* |
---|
1283 |
|
---|
1284 | */
|
---|
1285 |
|
---|
1286 | /*
|
---|
1287 | =============================================================================
|
---|
1288 | writem() -- write selected files
|
---|
1289 | =============================================================================
|
---|
1290 | */
|
---|
1291 |
|
---|
1292 | int16_t writem(void)
|
---|
1293 | {
|
---|
1294 | if (lasgsw) /* Assignments */
|
---|
1295 | if (wrtfile(FT_ASG))
|
---|
1296 | return(FAILURE);
|
---|
1297 |
|
---|
1298 | if (lorchsw) /* Hi Orch */
|
---|
1299 | if (wrtfile(FT_ORH))
|
---|
1300 | return(FAILURE);
|
---|
1301 |
|
---|
1302 | if (lorclsw) /* Lo Orch */
|
---|
1303 | if (wrtfile(FT_ORL))
|
---|
1304 | return(FAILURE);
|
---|
1305 |
|
---|
1306 | if (lpatsw) /* Patches */
|
---|
1307 | if (wrtfile(FT_PAT))
|
---|
1308 | return(FAILURE);
|
---|
1309 |
|
---|
1310 | if (lscrsw) /* Score */
|
---|
1311 | if (wrtfile(FT_SCR))
|
---|
1312 | return(FAILURE);
|
---|
1313 |
|
---|
1314 | if (lseqsw) /* Sequences */
|
---|
1315 | if (wrtfile(FT_SEQ))
|
---|
1316 | return(FAILURE);
|
---|
1317 |
|
---|
1318 | if (ltunsw) /* Tunings */
|
---|
1319 | if (wrtfile(FT_TUN))
|
---|
1320 | return(FAILURE);
|
---|
1321 |
|
---|
1322 | if (lwavsw) /* Waveshapes */
|
---|
1323 | if (wrtfile(FT_WAV))
|
---|
1324 | return(FAILURE);
|
---|
1325 |
|
---|
1326 | return(SUCCESS);
|
---|
1327 | }
|
---|
1328 |
|
---|
1329 | /* |
---|
1330 |
|
---|
1331 | */
|
---|
1332 |
|
---|
1333 | /*
|
---|
1334 | =============================================================================
|
---|
1335 | storit() -- store selected files on disk
|
---|
1336 | =============================================================================
|
---|
1337 | */
|
---|
1338 |
|
---|
1339 | int16_t storit(void)
|
---|
1340 | {
|
---|
1341 | register int16_t weneed, i, slotnd, slothv;
|
---|
1342 | int16_t rc, drem;
|
---|
1343 |
|
---|
1344 | /* make sure the file is named */
|
---|
1345 |
|
---|
1346 | if (0 EQ memcmp(ldfile, " ", 8)) {
|
---|
1347 |
|
---|
1348 | ldermsg("File must be named",
|
---|
1349 | ld_em1, ld_em2, LD_EMCF, LD_EMCB);
|
---|
1350 |
|
---|
1351 | streset();
|
---|
1352 | return(FAILURE);
|
---|
1353 | }
|
---|
1354 |
|
---|
1355 | /* make sure something was selected */
|
---|
1356 |
|
---|
1357 | if (ckstor()) {
|
---|
1358 |
|
---|
1359 | ldermsg("No file type selected",
|
---|
1360 | ld_em1, ld_em2, LD_EMCF, LD_EMCB);
|
---|
1361 |
|
---|
1362 | streset();
|
---|
1363 | return(FAILURE);
|
---|
1364 | }
|
---|
1365 |
|
---|
1366 | if (NOT lderrsw)
|
---|
1367 | ldbusy(" Storing files");
|
---|
1368 |
|
---|
1369 | if (getcat(0)) { /* get the catalog */
|
---|
1370 |
|
---|
1371 | streset();
|
---|
1372 | return(FAILURE);
|
---|
1373 | }
|
---|
1374 |
|
---|
1375 | /* find out how much space we need to store everything */
|
---|
1376 |
|
---|
1377 | drem = dspace(1);
|
---|
1378 | slotnd = 0;
|
---|
1379 | weneed = 0;
|
---|
1380 |
|
---|
1381 | /* |
---|
1382 |
|
---|
1383 | */
|
---|
1384 | if (lasgsw) {
|
---|
1385 |
|
---|
1386 | weneed += spacerq(FT_ASG);
|
---|
1387 | ++slotnd;
|
---|
1388 | }
|
---|
1389 |
|
---|
1390 | if (lorchsw) {
|
---|
1391 |
|
---|
1392 | weneed += spacerq(FT_ORH);
|
---|
1393 | ++slotnd;
|
---|
1394 | }
|
---|
1395 |
|
---|
1396 | if (lorclsw) {
|
---|
1397 |
|
---|
1398 | weneed += spacerq(FT_ORL);
|
---|
1399 | ++slotnd;
|
---|
1400 | }
|
---|
1401 |
|
---|
1402 | if (lpatsw) {
|
---|
1403 |
|
---|
1404 | weneed += spacerq(FT_PAT);
|
---|
1405 | ++slotnd;
|
---|
1406 | }
|
---|
1407 |
|
---|
1408 | if (lscrsw) {
|
---|
1409 |
|
---|
1410 | weneed += spacerq(FT_SCR);
|
---|
1411 | ++slotnd;
|
---|
1412 | }
|
---|
1413 |
|
---|
1414 | if (lseqsw) {
|
---|
1415 |
|
---|
1416 | weneed += spacerq(FT_SEQ);
|
---|
1417 | ++slotnd;
|
---|
1418 | }
|
---|
1419 |
|
---|
1420 | if (ltunsw) {
|
---|
1421 |
|
---|
1422 | weneed += spacerq(FT_TUN);
|
---|
1423 | ++slotnd;
|
---|
1424 | }
|
---|
1425 |
|
---|
1426 | if (lwavsw) {
|
---|
1427 |
|
---|
1428 | weneed += spacerq(FT_WAV);
|
---|
1429 | ++slotnd;
|
---|
1430 | }
|
---|
1431 |
|
---|
1432 | if (drem < weneed) {
|
---|
1433 |
|
---|
1434 | nospace("file");
|
---|
1435 | streset();
|
---|
1436 | return(FAILURE);
|
---|
1437 | }
|
---|
1438 |
|
---|
1439 | /* |
---|
1440 |
|
---|
1441 | */
|
---|
1442 |
|
---|
1443 | /* see if we have enough catalog space */
|
---|
1444 |
|
---|
1445 | slothv = 0;
|
---|
1446 |
|
---|
1447 | for (i = 0; i < FCMAX; i++)
|
---|
1448 | if (NOT ocslot(i))
|
---|
1449 | ++slothv;
|
---|
1450 |
|
---|
1451 | if (slothv < slotnd) {
|
---|
1452 |
|
---|
1453 | nospace("file");
|
---|
1454 | streset();
|
---|
1455 | return(FAILURE);
|
---|
1456 | }
|
---|
1457 |
|
---|
1458 | /* make sure the name is unique */
|
---|
1459 |
|
---|
1460 | if (rc = ckdups()) {
|
---|
1461 |
|
---|
1462 | sprintf(ldmsg1, "Duplicate %s", ftypes[rc - 1][2]);
|
---|
1463 | ldermsg(ldmsg1, ld_em1, ld_em2, LD_EMCF, LD_EMCB);
|
---|
1464 |
|
---|
1465 | streset();
|
---|
1466 | return(FAILURE);
|
---|
1467 | }
|
---|
1468 |
|
---|
1469 | /* |
---|
1470 |
|
---|
1471 | */
|
---|
1472 |
|
---|
1473 | /* write the files */
|
---|
1474 |
|
---|
1475 | rc = writem();
|
---|
1476 |
|
---|
1477 | if (NOT rc)
|
---|
1478 | ldbusy(" Writing catalog");
|
---|
1479 |
|
---|
1480 | if (putcat()) {
|
---|
1481 |
|
---|
1482 | _clsvol();
|
---|
1483 | streset();
|
---|
1484 | showcat();
|
---|
1485 | return(FAILURE);
|
---|
1486 | }
|
---|
1487 |
|
---|
1488 | _clsvol();
|
---|
1489 | streset();
|
---|
1490 | showcat();
|
---|
1491 |
|
---|
1492 | if (rc)
|
---|
1493 | return(FAILURE);
|
---|
1494 |
|
---|
1495 | showsiz();
|
---|
1496 | return(SUCCESS);
|
---|
1497 | }
|
---|
1498 |
|
---|
1499 | /* |
---|
1500 |
|
---|
1501 | */
|
---|
1502 |
|
---|
1503 | /*
|
---|
1504 | =============================================================================
|
---|
1505 | advlcur() -- advance the librarian display text cursor
|
---|
1506 | =============================================================================
|
---|
1507 | */
|
---|
1508 |
|
---|
1509 | void advlcur(void)
|
---|
1510 | {
|
---|
1511 | register int16_t newcol;
|
---|
1512 |
|
---|
1513 | if (infield(stcrow, stccol, curfet))
|
---|
1514 | cfetp = infetp;
|
---|
1515 | else
|
---|
1516 | return;
|
---|
1517 |
|
---|
1518 | newcol = stccol + 1;
|
---|
1519 |
|
---|
1520 | if (newcol LE cfetp->frcol)
|
---|
1521 | itcpos(stcrow, newcol);
|
---|
1522 |
|
---|
1523 | cxval = stccol * 8;
|
---|
1524 | cyval = stcrow * 14;
|
---|
1525 | }
|
---|
1526 |
|
---|
1527 | /*
|
---|
1528 | =============================================================================
|
---|
1529 | bsplcur() -- backspace the librarian display text cursor
|
---|
1530 | =============================================================================
|
---|
1531 | */
|
---|
1532 |
|
---|
1533 | void bsplcur(void)
|
---|
1534 | {
|
---|
1535 | register int16_t newcol;
|
---|
1536 |
|
---|
1537 | if (infield(stcrow, stccol, curfet))
|
---|
1538 | cfetp = infetp;
|
---|
1539 | else
|
---|
1540 | return;
|
---|
1541 |
|
---|
1542 | newcol = stccol - 1;
|
---|
1543 |
|
---|
1544 | if (newcol GE cfetp->flcol)
|
---|
1545 | itcpos(stcrow, newcol);
|
---|
1546 |
|
---|
1547 | cxval = stccol * 8;
|
---|
1548 | cyval = stcrow * 14;
|
---|
1549 | }
|
---|
1550 |
|
---|
1551 | /* |
---|
1552 |
|
---|
1553 | */
|
---|
1554 |
|
---|
1555 | /*
|
---|
1556 | =============================================================================
|
---|
1557 | ldswin() -- display a window
|
---|
1558 | =============================================================================
|
---|
1559 | */
|
---|
1560 |
|
---|
1561 | void ldswin(int16_t n)
|
---|
1562 | {
|
---|
1563 | register int16_t cx, cy;
|
---|
1564 |
|
---|
1565 | if (ndisp NE 0)
|
---|
1566 | return;
|
---|
1567 |
|
---|
1568 | if ((n EQ 10) AND (lmwtype EQ 1))
|
---|
1569 | cx = exp_c(TTBACK); /* use black for the typewriter */
|
---|
1570 | else
|
---|
1571 | cx = exp_c(ldbox[n][5]); /* expand the background color */
|
---|
1572 |
|
---|
1573 | /* first, fill the box with the background color */
|
---|
1574 |
|
---|
1575 | if (v_regs[5] & 0x0180)
|
---|
1576 | vbank(0);
|
---|
1577 |
|
---|
1578 | vbfill4(librob, 128, ldbox[n][0], ldbox[n][1], ldbox[n][2],
|
---|
1579 | ldbox[n][3], cx);
|
---|
1580 |
|
---|
1581 | /* put in the box label */
|
---|
1582 |
|
---|
1583 | tsplot4(librob, 64, ldbox[n][4], ldbox[n][6], ldbox[n][7],
|
---|
1584 | ldbxlb0[n], 14);
|
---|
1585 |
|
---|
1586 | /* |
---|
1587 |
|
---|
1588 | */
|
---|
1589 | switch (n) { /* final text - overlays above stuff */
|
---|
1590 |
|
---|
1591 | case 0: /* titles */
|
---|
1592 |
|
---|
1593 | point = ldpoint;
|
---|
1594 |
|
---|
1595 | lseg( 8, 13, 79, 13, LUNDRLN);
|
---|
1596 | lseg( 88, 13, 95, 13, LUNDRLN);
|
---|
1597 | lseg(104, 13, 167, 13, LUNDRLN);
|
---|
1598 | lseg(176, 13, 471, 13, LUNDRLN);
|
---|
1599 | lseg(480, 13, 504, 13, LUNDRLN);
|
---|
1600 |
|
---|
1601 | return;
|
---|
1602 |
|
---|
1603 | case 1: /* index area */
|
---|
1604 |
|
---|
1605 | return;
|
---|
1606 |
|
---|
1607 | case 3: /* current file name */
|
---|
1608 |
|
---|
1609 | tsplot4(librob, 64, ldbox[n][4], ldbox[n][6], ldbox[n][7],
|
---|
1610 | ldfile, 14);
|
---|
1611 | return;
|
---|
1612 |
|
---|
1613 | case 5: /* current comment field */
|
---|
1614 |
|
---|
1615 | tsplot4(librob, 64, ldbox[n][4], ldbox[n][6], ldbox[n][7],
|
---|
1616 | ldcmnt, 14);
|
---|
1617 | return;
|
---|
1618 |
|
---|
1619 | /* |
---|
1620 |
|
---|
1621 | */
|
---|
1622 |
|
---|
1623 | case 7: /* "Replace" / "Append" */
|
---|
1624 |
|
---|
1625 | if (lrasw)
|
---|
1626 | cy = exp_c(LD_SELC);
|
---|
1627 | else
|
---|
1628 | cy = ldbox[n][4];
|
---|
1629 |
|
---|
1630 | tsplot4(librob, 64, cy, ldbox[n][6], ldbox[n][7],
|
---|
1631 | "Content", 14);
|
---|
1632 |
|
---|
1633 | return;
|
---|
1634 |
|
---|
1635 | case 8: /* "Hi Orch" / "Lo Orch" */
|
---|
1636 |
|
---|
1637 | if (lselsw) {
|
---|
1638 |
|
---|
1639 | ldkind = ftkind(ldslot);
|
---|
1640 |
|
---|
1641 | if ((ldkind EQ FT_ORC) OR
|
---|
1642 | (ldkind EQ FT_ORL) OR
|
---|
1643 | (ldkind EQ FT_ORH))
|
---|
1644 | cy = exp_c(LD_SELC);
|
---|
1645 | else
|
---|
1646 | cy = ldbox[n][4];
|
---|
1647 |
|
---|
1648 | } else {
|
---|
1649 |
|
---|
1650 | cy = ldbox[n][4];
|
---|
1651 | }
|
---|
1652 |
|
---|
1653 | tsplot4(librob, 64, cy, ldbox[n][6], ldbox[n][7],
|
---|
1654 | (lorchl ? "Hi Orch" : "Lo Orch"), 14);
|
---|
1655 |
|
---|
1656 | return;
|
---|
1657 | /* |
---|
1658 |
|
---|
1659 | */
|
---|
1660 | case 9: /* "Store" status */
|
---|
1661 |
|
---|
1662 | cy = exp_c(lstrsw ? LD_SELC : ldbox[n][4]);
|
---|
1663 | tsplot4(librob, 64, cy, 22, 10, "Store", 14);
|
---|
1664 |
|
---|
1665 | cy = exp_c(lscrsw ? LD_SELC : ldbox[n][4]);
|
---|
1666 | tsplot4(librob, 64, cy, 22, 17, "Score", 14);
|
---|
1667 |
|
---|
1668 | cy = exp_c(lorchsw ? LD_SELC : ldbox[n][4]);
|
---|
1669 | tsplot4(librob, 64, cy, 22, 24, "Hi Orch", 14);
|
---|
1670 |
|
---|
1671 |
|
---|
1672 | cy = exp_c(lwavsw ? LD_SELC : ldbox[n][4]);
|
---|
1673 | tsplot4(librob, 64, cy, 23, 10, "Waves", 14);
|
---|
1674 |
|
---|
1675 | cy = exp_c(lpatsw ? LD_SELC : ldbox[n][4]);
|
---|
1676 | tsplot4(librob, 64, cy, 23, 17, "Patch", 14);
|
---|
1677 |
|
---|
1678 | cy = exp_c(lorclsw ? LD_SELC : ldbox[n][4]);
|
---|
1679 | tsplot4(librob, 64, cy, 23, 24, "Lo Orch", 14);
|
---|
1680 |
|
---|
1681 |
|
---|
1682 | cy = exp_c(lasgsw ? LD_SELC : ldbox[n][4]);
|
---|
1683 | tsplot4(librob, 64, cy, 24, 10, "Assgn", 14);
|
---|
1684 |
|
---|
1685 | cy = exp_c(lseqsw ? LD_SELC : ldbox[n][4]);
|
---|
1686 | tsplot4(librob, 64, cy, 24, 17, "Seqnc", 14);
|
---|
1687 |
|
---|
1688 | cy = exp_c(ltunsw ? LD_SELC : ldbox[n][4]);
|
---|
1689 | tsplot4(librob, 64, cy, 24, 24, "Tunings", 14);
|
---|
1690 |
|
---|
1691 | return;
|
---|
1692 |
|
---|
1693 | case 10: /* typewriter / error messages */
|
---|
1694 |
|
---|
1695 | tsplot4(librob, 64, ldbox[n][4], 22, ldbox[n][7], lmln22, 14);
|
---|
1696 | tsplot4(librob, 64, ldbox[n][4], 23, ldbox[n][7], lmln23, 14);
|
---|
1697 | tsplot4(librob, 64, ldbox[n][4], 24, ldbox[n][7], lmln24, 14);
|
---|
1698 |
|
---|
1699 | return;
|
---|
1700 | }
|
---|
1701 | }
|
---|
1702 |
|
---|
1703 | /* |
---|
1704 |
|
---|
1705 | */
|
---|
1706 |
|
---|
1707 | /*
|
---|
1708 | =============================================================================
|
---|
1709 | lwins() -- display all librarian windows
|
---|
1710 | =============================================================================
|
---|
1711 | */
|
---|
1712 |
|
---|
1713 | void lwins(void)
|
---|
1714 | {
|
---|
1715 | register int16_t i;
|
---|
1716 |
|
---|
1717 | for (i = 0; i < 11; i++)
|
---|
1718 | ldswin(i);
|
---|
1719 | }
|
---|
1720 |
|
---|
1721 | /*
|
---|
1722 | =============================================================================
|
---|
1723 | ldpoint() -- plot a point for the lseg function
|
---|
1724 | =============================================================================
|
---|
1725 | */
|
---|
1726 |
|
---|
1727 | void ldpoint(int16_t x, int16_t y, int16_t pen)
|
---|
1728 | {
|
---|
1729 | if (v_regs[5] & 0x0180)
|
---|
1730 | vbank(0);
|
---|
1731 |
|
---|
1732 | vputp(ldoct, x, y, exp_c(pen));
|
---|
1733 | }
|
---|
1734 |
|
---|
1735 | /* |
---|
1736 |
|
---|
1737 | */
|
---|
1738 |
|
---|
1739 | /*
|
---|
1740 | =============================================================================
|
---|
1741 | ldbord() -- draw the border for the librarian display
|
---|
1742 | =============================================================================
|
---|
1743 | */
|
---|
1744 |
|
---|
1745 | void ldbord(void)
|
---|
1746 | {
|
---|
1747 | point = ldpoint;
|
---|
1748 |
|
---|
1749 | lseg( 0, 0, 511, 0, LBORD); /* outer border */
|
---|
1750 | lseg(511, 0, 511, 349, LBORD);
|
---|
1751 | lseg(511, 349, 0, 349, LBORD);
|
---|
1752 | lseg( 0, 349, 0, 0, LBORD);
|
---|
1753 |
|
---|
1754 | lseg( 0, 293, 511, 293, LBORD); /* windows - H lines */
|
---|
1755 | lseg(511, 308, 0, 308, LBORD);
|
---|
1756 |
|
---|
1757 | lseg( 79, 293, 79, 308, LBORD); /* windows - V lines */
|
---|
1758 | lseg(144, 293, 144, 308, LBORD);
|
---|
1759 | lseg(215, 293, 215, 308, LBORD);
|
---|
1760 | lseg( 71, 308, 71, 349, LBORD);
|
---|
1761 | lseg(256, 308, 256, 349, LBORD);
|
---|
1762 | }
|
---|
1763 |
|
---|
1764 | /* |
---|
1765 |
|
---|
1766 | */
|
---|
1767 |
|
---|
1768 | /*
|
---|
1769 | =============================================================================
|
---|
1770 | lwclr() -- clear the message window text strings
|
---|
1771 | =============================================================================
|
---|
1772 | */
|
---|
1773 |
|
---|
1774 | void lmwclr(void)
|
---|
1775 | {
|
---|
1776 | lmwtype = 0;
|
---|
1777 | submenu = FALSE;
|
---|
1778 |
|
---|
1779 | lmln22 = "";
|
---|
1780 | lmln23 = "";
|
---|
1781 | lmln24 = "";
|
---|
1782 | }
|
---|
1783 |
|
---|
1784 | /*
|
---|
1785 | =============================================================================
|
---|
1786 | lmwvtyp() -- load the typewriter into the message window text strings
|
---|
1787 | =============================================================================
|
---|
1788 | */
|
---|
1789 |
|
---|
1790 | void lmwvtyp(void)
|
---|
1791 | {
|
---|
1792 | lmwtype = 1;
|
---|
1793 | submenu = TRUE;
|
---|
1794 |
|
---|
1795 | lmln22 = vtlin1;
|
---|
1796 | lmln23 = vtlin2;
|
---|
1797 | lmln24 = vtlin3;
|
---|
1798 | }
|
---|
1799 |
|
---|
1800 | /* |
---|
1801 |
|
---|
1802 | */
|
---|
1803 |
|
---|
1804 | /*
|
---|
1805 | =============================================================================
|
---|
1806 | libdsp() -- put up the librarian display
|
---|
1807 | =============================================================================
|
---|
1808 | */
|
---|
1809 |
|
---|
1810 | void libdsp(void)
|
---|
1811 | {
|
---|
1812 | librob = &v_score[0]; /* setup display object pointer */
|
---|
1813 | obj0 = &v_curs0[0]; /* setup cursor object pointer */
|
---|
1814 | obj2 = &v_tcur[0]; /* setup typewriter cursor pointer */
|
---|
1815 | ldoct = &v_obtab[LIBROBJ]; /* setup object control table pointer */
|
---|
1816 |
|
---|
1817 | lselsw = FALSE;
|
---|
1818 | ldelsw = FALSE;
|
---|
1819 | lstrsw = FALSE;
|
---|
1820 |
|
---|
1821 | lasgsw = FALSE;
|
---|
1822 | lorchsw = FALSE;
|
---|
1823 | lorclsw = FALSE;
|
---|
1824 | lpatsw = FALSE;
|
---|
1825 | lscrsw = FALSE;
|
---|
1826 | lseqsw = FALSE;
|
---|
1827 | ltunsw = FALSE;
|
---|
1828 | lwavsw = FALSE;
|
---|
1829 |
|
---|
1830 | lderrsw = FALSE;
|
---|
1831 | ltagged = FALSE;
|
---|
1832 | lksel = -1;
|
---|
1833 | /* |
---|
1834 |
|
---|
1835 | */
|
---|
1836 | clrcat(); /* void the catalog */
|
---|
1837 | catin = FALSE;
|
---|
1838 |
|
---|
1839 | lmwclr(); /* clear the message window text strings */
|
---|
1840 |
|
---|
1841 | dswap(); /* initialize display */
|
---|
1842 |
|
---|
1843 | if (v_regs[5] & 0x0180)
|
---|
1844 | vbank(0);
|
---|
1845 |
|
---|
1846 | memsetw(librob, 0, 32767);
|
---|
1847 | memsetw(librob+32767L, 0, 12033);
|
---|
1848 |
|
---|
1849 | SetObj(LIBROBJ, 0, 0, librob, 512, 350, 0, 0, LIBRFL, -1);
|
---|
1850 | SetObj( 0, 0, 1, obj0, 16, 16, LCURX, LCURY, OBFL_00, -1);
|
---|
1851 | SetObj( TTCURS, 0, 1, obj2, 16, 16, 0, 0, TTCCFL, -1);
|
---|
1852 |
|
---|
1853 | arcurs(TTCURC); /* setup arrow cursor object */
|
---|
1854 | itcini(TTCURC); /* setup text cursor object */
|
---|
1855 | ttcini(TTCURC); /* setup typewriter cursor object */
|
---|
1856 |
|
---|
1857 | ldbord(); /* draw the border */
|
---|
1858 | lwins();
|
---|
1859 |
|
---|
1860 | vsndpal(lbrpal); /* setup the palette */
|
---|
1861 |
|
---|
1862 | SetPri(LIBROBJ, LIBRPRI);
|
---|
1863 | SetPri(0, GCPRI); /* display the graphic cursor */
|
---|
1864 |
|
---|
1865 | setgc(LCURX, LCURY);
|
---|
1866 |
|
---|
1867 | chtime = thcwval; /* turn it into a text cursor */
|
---|
1868 | cvtime = tvcwval;
|
---|
1869 | cmtype = CT_TEXT;
|
---|
1870 | itcpos(cyval / 14, cxval >> 3);
|
---|
1871 | }
|
---|