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