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