source: buchla-68k/ram/m7menu.c@ f4fbee9

Last change on this file since f4fbee9 was 73dd55f, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Prepare for automatic substitution.

  • Property mode set to 100644
File size: 13.9 KB
Line 
1/*
2 =============================================================================
3 m7menu.c -- MIDAS main menu functions
4 Version 42 -- 1989-12-19 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#define DEBUGIT 0
9
10#include "stddefs.h"
11#include "hwdefs.h"
12#include "memory.h"
13#include "vsdd.h"
14#include "vsddsw.h"
15#include "vsddvars.h"
16#include "fields.h"
17#include "graphdef.h"
18#include "curpak.h"
19
20#include "midas.h"
21#include "menu.h"
22#include "libdsp.h"
23
24#define DENSITY 1 /* double density */
25
26#define M_COPY 8 /* "copy" text index in mtexts[] */
27#define M_FORM 10 /* "format" text index in mtexts[] */
28
29#define VER_ROW 2 /* version message row */
30#define VER_COL 51 /* version message column */
31
32#if DEBUGIT
33extern short debugsw;
34
35short debugm7 = 1;
36#endif
37
38extern char m7verms[], bfs[], loadedf[][8];
39
40extern struct selbox *csbp, *curboxp;
41
42extern short (*point)();
43
44extern short nokey(), select(), cxkstd(), cykstd();
45extern short cxgen(), cygen(), stdctp2();
46
47extern unsigned exp_c();
48
49extern short ndisp, runit, curslim, sgcsw, cxval, cyval, stcrow, stccol;
50extern short crate1[], defect, dsp_ok;
51
52extern struct octent *mdoct;
53
54extern unsigned *menuob, *obj0, vi_ctl;
55
56static char ml01[61], ml02[61], ml03[61], ml04[61], ml05[61];
57
58short mdselbx();
59
60/*
61
62*/
63
64static char mlc01[] = {1, 0xBA, 58, 0xB1, 1, 0xBB, -1};
65static char mlc02[] = {1, 0xB6, 29, 0xB1, 1, 0xB7, 28, 0xB1, 1, 0xB4, -1};
66static char mlc03[] = {1, 0xB6, 29, 0xB1, 1, 0xB2, 28, 0xB1, 1, 0xB4, -1};
67static char mlc04[] = {1, 0xB6, 29, 0xB1, 1, 0xB5, 28, 0xB1, 1, 0xB4, -1};
68static char mlc05[] = {1, 0xB9, 58, 0xB1, 1, 0xB8, -1};
69
70static char *mtexts[] = {
71
72 /* 0 */ "MIDAS VII for the Buchla 700 Version",
73 /* 1 */ "Librarian",
74 /* 2 */ "Patch Editor",
75 /* 3 */ "Score editor",
76 /* 4 */ "Sequence Editor",
77 /* 5 */ "Instrument designer",
78 /* 6 */ "Initialize system",
79 /* 7 */ "Waveshape editor",
80 /* 8 */ "Write program to disk",
81 /* 9 */ "Tuning tables",
82 /* 10 */ "Format disk",
83 /* 11 */ "Assignment tables",
84 /* 12 */ "Diagnostics",
85 /* 13 */ "created by Buchla and Associates of Berkeley, California",
86};
87
88/*
89
90*/
91
92static short mlintab[][4] = {
93
94 { 18, 26, 18, 322},
95
96 { 21, 26, 21, 42},
97 { 21, 54, 21, 84},
98 { 21, 96, 21, 126},
99 { 21, 138, 21, 168},
100 { 21, 180, 21, 210},
101 { 21, 222, 21, 252},
102 { 21, 264, 21, 294},
103 { 21, 306, 21, 322},
104
105 {258, 54, 258, 84},
106 {258, 96, 258, 126},
107 {258, 138, 258, 168},
108 {258, 180, 258, 210},
109 {258, 222, 258, 252},
110 {258, 264, 258, 294},
111
112 {261, 54, 261, 84},
113 {261, 96, 261, 126},
114 {261, 138, 261, 168},
115 {261, 180, 261, 210},
116 {261, 222, 261, 252},
117 {261, 264, 261, 294},
118
119 {490, 26, 490, 42},
120 {490, 54, 490, 84},
121 {490, 96, 490, 126},
122 {490, 138, 490, 168},
123 {490, 180, 490, 210},
124 {490, 222, 490, 252},
125 {490, 264, 490, 294},
126 {490, 306, 490, 322},
127
128 {493, 26, 493, 322},
129
130 { -1, -1, -1, -1}
131};
132
133/*
134
135*/
136
137static short mrowcol[][2] = {
138
139 { 2, 4}, /* 0 */
140 { 4, 4}, /* 1 */
141 { 4, 34}, /* 2 */
142 { 7, 4}, /* 3 */
143 { 7, 34}, /* 4 */
144 {10, 4}, /* 5 */
145 {10, 34}, /* 6 */
146 {13, 4}, /* 7 */
147 {13, 34}, /* 8 */
148 {16, 4}, /* 9 */
149 {16, 34}, /* 10 */
150 {19, 4}, /* 11 */
151 {19, 34}, /* 12 */
152 {22, 4} /* 13 */
153};
154
155struct selbox mdboxes[] = { /* main menu box definitions */
156
157 { 22, 53, 257, 87, 0, mdselbx}, /* 0 */
158 {262, 53, 489, 87, 1, mdselbx}, /* 1 */
159 { 22, 95, 257, 129, 2, mdselbx}, /* 2 */
160 {262, 95, 489, 129, 3, mdselbx}, /* 3 */
161 { 22, 137, 257, 171, 4, mdselbx}, /* 4 */
162 {262, 137, 489, 171, 5, mdselbx}, /* 5 */
163 { 22, 179, 257, 213, 6, mdselbx}, /* 6 */
164 {262, 179, 489, 213, 7, mdselbx}, /* 7 */
165 { 22, 221, 257, 255, 8, mdselbx}, /* 8 */
166 {262, 221, 489, 255, 9, mdselbx}, /* 9 */
167 { 22, 263, 257, 297, 10, mdselbx}, /* 10 */
168 {262, 263, 489, 297, 11, mdselbx}, /* 11 */
169 { 0, 0, 0, 0, 0, FN_NULL} /* end of table */
170};
171
172/*
173
174*/
175
176short menupal[16][3] = { /* menu display color palette */
177
178 {0, 0, 0}, /* 0 */
179 {2, 1, 0}, /* 1 MCURSOR cursor color */
180 {0, 0, 0}, /* 2 MBKGRND background color */
181 {3, 0, 2}, /* 3 */
182 {2, 1, 0}, /* 4 MBUCHLA "Created by ..." color */
183 {2, 1, 0}, /* 5 MTITLE title color */
184 {0, 1, 0}, /* 6 */
185 {2, 0, 0}, /* 7 MHILITE hilite color */
186 {2, 2, 2}, /* 8 MLFILES file name color */
187 {0, 0, 0}, /* 9 */
188 {1, 1, 2}, /* 10 MLINES outline color */
189 {2, 3, 3}, /* 11 MBUTTON button legend color */
190 {3, 1, 1}, /* 12 */
191 {3, 3, 0}, /* 13 */
192 {0, 3, 3}, /* 14 */
193 {0, 0, 3} /* 15 */
194};
195
196short blakpal[16][3] = { /* black palette */
197
198 {0, 0, 0}, /* 0 */
199 {0, 0, 0}, /* 1 */
200 {0, 0, 0}, /* 2 */
201 {0, 0, 0}, /* 3 */
202 {0, 0, 0}, /* 4 */
203 {0, 0, 0}, /* 5 */
204 {0, 0, 0}, /* 6 */
205 {0, 0, 0}, /* 7 */
206 {0, 0, 0}, /* 8 */
207 {0, 0, 0}, /* 9 */
208 {0, 0, 0}, /* 10 */
209 {0, 0, 0}, /* 11 */
210 {0, 0, 0}, /* 12 */
211 {0, 0, 0}, /* 13 */
212 {0, 0, 0}, /* 14 */
213 {0, 0, 0} /* 15 */
214};
215
216/*
217
218*/
219
220short mfrc[][2] = { /* file name row and column by load type LT_??? */
221
222 {20, 6}, /* assignments */
223 {11, 6}, /* lo orchestra */
224 {11, 20}, /* hi orchestra */
225 { 8, 6}, /* score */
226 {17, 6}, /* tunings */
227 {14, 6}, /* waveshapes */
228 { 5, 36}, /* patches */
229 { 8, 36} /* sequences */
230};
231
232/*
233
234*/
235
236struct curpak m7_flds = { /* main menu cursor package definitions */
237
238 stdctp2, /* curtype */
239 nokey, /* premove */
240 nokey, /* pstmove */
241 cxkstd, /* cx_key */
242 cykstd, /* cy_key */
243 cxgen, /* cx_upd */
244 cygen, /* cy_upd */
245 nokey, /* xy_up */
246 nokey, /* xy_dn */
247 nokey, /* x_key */
248 select, /* e_key */
249 nokey, /* m_key */
250 nokey, /* d_key */
251 nokey, /* not_fld */
252 (struct fet *)NULL, /* curfet */
253 mdboxes, /* csbp */
254 crate1, /* cratex */
255 crate1, /* cratey */
256 CT_GRAF, /* cmtype */
257 MCURX, /* cxval */
258 MCURY /* cyval */
259};
260
261/*
262
263*/
264
265/*
266 =============================================================================
267 dswap() -- clear the screen for display switching
268 =============================================================================
269*/
270
271dswap()
272{
273 register short i;
274
275 vsndpal(blakpal); /* blackout the palette */
276
277 if (v_regs[5] & 0x0180)
278 vbank(0); /* select bank 0 */
279
280 setipl(VID_DI); /* disable the un-blanker */
281 vi_ctl = 0; /* reset un-blank control */
282
283 for (i = 0; i < 16; i++) /* blank the objects */
284 v_odtab[i][0] |= V_BLA;
285
286 VHinit(); /* init VSDD hardware */
287 VSinit(); /* init VSDD software */
288}
289
290/*
291
292*/
293
294/*
295 =============================================================================
296 mlbld() -- build a menu line
297 =============================================================================
298*/
299
300mlbld(where, from)
301char *where, *from;
302{
303 register short i, j;
304 register char c;
305
306 while (-1 NE (i = *from++)) {
307
308 c = *from++;
309
310 for (j = 0; j < i; j++)
311 *where++ = c;
312 }
313
314 *where = '\0';
315}
316
317/*
318 =============================================================================
319 mlpoint() -- draw a point for the MIDAS 700 main menu
320 =============================================================================
321*/
322
323mlpoint(x, y, pen)
324short x, y, pen;
325{
326 if (v_regs[5] & 0x0180)
327 vbank(0);
328
329 vputp(mdoct, x, y, pen);
330}
331
332/*
333
334*/
335
336/*
337 =============================================================================
338 mdselbx() -- process a hit in a window for the MIDAS 700 main menu
339 =============================================================================
340*/
341
342short
343mdselbx(n)
344short n;
345{
346 register unsigned mlcv, mbcv, mbak;
347 register short rc;
348
349#if DEBUGIT
350 if (debugsw AND debugm7)
351 printf("mdselbx(%d): ENTRY old ndisp = %d\n", n, ndisp);
352#endif
353
354 mlcv = exp_c(MLINES);
355 mbcv = exp_c(MBUTTON);
356 mbak = exp_c(MBKGRND);
357
358 rc = SUCCESS;
359
360 if (ndisp EQ 7) { /* "Write program to disk" selected */
361
362 if (n EQ 7) { /* verified, time to do it */
363
364 if (dcopy()) {
365
366 sprintf(bfs, " FAILED -- Error %d", defect);
367
368 vcputsv(menuob, 64, MHILITE, mbak,
369 mrowcol[M_COPY][0] + 1,
370 mrowcol[M_COPY][1],
371 bfs, 14);
372
373 rc = FAILURE;
374 }
375
376 ndisp = -1;
377
378 } else { /* not verified, cancel it */
379
380 ndisp = n; /* display number = box number */
381 runit = FALSE; /* cue msl() to setup the new display */
382 dsp_ok = FALSE; /* disallow display updates */
383 }
384
385 vcputsv(menuob, 64, mbcv, mbak,
386 mrowcol[M_COPY][0], mrowcol[M_COPY][1],
387 mtexts[M_COPY], 14);
388
389/*
390
391*/
392
393 } else if (ndisp EQ 9) { /* "Format disk" selected */
394
395 if (n EQ 9) { /* verified, time to do it */
396
397 if (dformat(DENSITY)) {
398
399 sprintf(bfs, " FAILED -- Error %d", defect);
400
401 vcputsv(menuob, 64, MHILITE, mbak,
402 mrowcol[M_FORM][0] + 1,
403 mrowcol[M_FORM][1],
404 bfs, 14);
405
406 rc = FAILURE;
407 }
408
409 ndisp = -1;
410
411 } else { /* not verified, cancel it */
412
413 ndisp = n; /* display number = box number */
414 runit = FALSE; /* cue msl() to setup the new display */
415 dsp_ok = FALSE; /* disallow display updates */
416 }
417
418 vcputsv(menuob, 64, mbcv, mbak,
419 mrowcol[M_FORM][0], mrowcol[M_FORM][1],
420 mtexts[M_FORM], 14);
421
422/*
423
424*/
425 } else { /* select a new menu item */
426
427 ndisp = n; /* display number = box number */
428
429 if (n EQ 7) { /* select "Write program to disk" */
430
431 vcputsv(menuob, 64, MHILITE, mbak,
432 mrowcol[M_COPY][0], mrowcol[M_COPY][1],
433 mtexts[M_COPY], 14);
434
435 } else if (n EQ 9) { /* select "Format disk" */
436
437 vcputsv(menuob, 64, MHILITE, mbak,
438 mrowcol[M_FORM][0], mrowcol[M_FORM][1],
439 mtexts[M_FORM], 14);
440
441 } else {
442
443 runit = FALSE; /* cue msl() to setup the new display */
444 dsp_ok = FALSE; /* disallow display updates */
445 }
446 }
447
448#if DEBUGIT
449 if (debugsw AND debugm7)
450 printf("mdselbx(%d): EXIT ndisp = %d rc = %d runit = %d\n",
451 n, ndisp, rc, runit);
452#endif
453
454 return(rc);
455}
456
457/*
458
459*/
460
461/*
462 =============================================================================
463 drawm() -- draw the MIDAS 700 main menu
464 =============================================================================
465*/
466
467drawm()
468{
469 register short *mlp;
470 register short i;
471 register unsigned mlcv, mbcv, mbak;
472 char buf[16];
473
474 mlcv = exp_c(MLINES);
475 mbcv = exp_c(MBUTTON);
476 mbak = exp_c(MBKGRND);
477
478 if (ml01[0] EQ 0) {
479
480 mlbld(ml01, mlc01);
481 mlbld(ml02, mlc02);
482 mlbld(ml03, mlc03);
483 mlbld(ml04, mlc04);
484 mlbld(ml05, mlc05);
485 }
486
487 if (v_regs[5] & 0x0180)
488 vbank(0);
489
490 vbfill4(menuob, 128, 0, 0, 511, 349, mbak);
491
492 vcputsv(menuob, 64, mlcv, mbak, 1, 2, ml01, 14);
493 vcputsv(menuob, 64, mlcv, mbak, 2, 2, "\260", 14);
494 vcputsv(menuob, 64, mlcv, mbak, 2, 61, "\260", 14);
495
496 vcputsv(menuob, 64, mlcv, mbak, 3, 2, ml02, 14);
497 vcputsv(menuob, 64, mlcv, mbak, 4, 2, "\260", 14);
498 vcputsv(menuob, 64, mlcv, mbak, 4, 32, "\260", 14);
499 vcputsv(menuob, 64, mlcv, mbak, 4, 61, "\260", 14);
500 vcputsv(menuob, 64, mlcv, mbak, 5, 2, "\260", 14);
501 vcputsv(menuob, 64, mlcv, mbak, 5, 32, "\260", 14);
502 vcputsv(menuob, 64, mlcv, mbak, 5, 61, "\260", 14);
503
504 vcputsv(menuob, 64, mlcv, mbak, 6, 2, ml03, 14);
505 vcputsv(menuob, 64, mlcv, mbak, 7, 2, "\260", 14);
506 vcputsv(menuob, 64, mlcv, mbak, 7, 32, "\260", 14);
507 vcputsv(menuob, 64, mlcv, mbak, 7, 61, "\260", 14);
508 vcputsv(menuob, 64, mlcv, mbak, 8, 2, "\260", 14);
509 vcputsv(menuob, 64, mlcv, mbak, 8, 32, "\260", 14);
510 vcputsv(menuob, 64, mlcv, mbak, 8, 61, "\260", 14);
511/*
512
513*/
514 vcputsv(menuob, 64, mlcv, mbak, 9, 2, ml03, 14);
515 vcputsv(menuob, 64, mlcv, mbak, 10, 2, "\260", 14);
516 vcputsv(menuob, 64, mlcv, mbak, 10, 32, "\260", 14);
517 vcputsv(menuob, 64, mlcv, mbak, 10, 61, "\260", 14);
518 vcputsv(menuob, 64, mlcv, mbak, 11, 2, "\260", 14);
519 vcputsv(menuob, 64, mlcv, mbak, 11, 32, "\260", 14);
520 vcputsv(menuob, 64, mlcv, mbak, 11, 61, "\260", 14);
521
522 vcputsv(menuob, 64, mlcv, mbak, 12, 2, ml03, 14);
523 vcputsv(menuob, 64, mlcv, mbak, 13, 2, "\260", 14);
524 vcputsv(menuob, 64, mlcv, mbak, 13, 32, "\260", 14);
525 vcputsv(menuob, 64, mlcv, mbak, 13, 61, "\260", 14);
526 vcputsv(menuob, 64, mlcv, mbak, 14, 2, "\260", 14);
527 vcputsv(menuob, 64, mlcv, mbak, 14, 32, "\260", 14);
528 vcputsv(menuob, 64, mlcv, mbak, 14, 61, "\260", 14);
529
530 vcputsv(menuob, 64, mlcv, mbak, 15, 2, ml03, 14);
531 vcputsv(menuob, 64, mlcv, mbak, 16, 2, "\260", 14);
532 vcputsv(menuob, 64, mlcv, mbak, 16, 32, "\260", 14);
533 vcputsv(menuob, 64, mlcv, mbak, 16, 61, "\260", 14);
534 vcputsv(menuob, 64, mlcv, mbak, 17, 2, "\260", 14);
535 vcputsv(menuob, 64, mlcv, mbak, 17, 32, "\260", 14);
536 vcputsv(menuob, 64, mlcv, mbak, 17, 61, "\260", 14);
537
538 vcputsv(menuob, 64, mlcv, mbak, 18, 2, ml03, 14);
539 vcputsv(menuob, 64, mlcv, mbak, 19, 2, "\260", 14);
540 vcputsv(menuob, 64, mlcv, mbak, 19, 32, "\260", 14);
541 vcputsv(menuob, 64, mlcv, mbak, 19, 61, "\260", 14);
542 vcputsv(menuob, 64, mlcv, mbak, 20, 2, "\260", 14);
543 vcputsv(menuob, 64, mlcv, mbak, 20, 32, "\260", 14);
544 vcputsv(menuob, 64, mlcv, mbak, 20, 61, "\260", 14);
545
546 vcputsv(menuob, 64, mlcv, mbak, 21, 2, ml04, 14);
547 vcputsv(menuob, 64, mlcv, mbak, 22, 2, "\260", 14);
548 vcputsv(menuob, 64, mlcv, mbak, 22, 61, "\260", 14);
549 vcputsv(menuob, 64, mlcv, mbak, 23, 2, ml05, 14);
550/*
551
552*/
553 mlp = &mlintab[0][0];
554 point = mlpoint;
555
556 while (-1 NE mlp[0]) {
557
558 lseg(mlp[0], mlp[1], mlp[2], mlp[3], mlcv);
559 mlp += 4;
560 }
561
562 vcputsv(menuob, 64, MTITLE, mbak, mrowcol[0][0], mrowcol[0][1],
563 mtexts[0], 14);
564
565 vcputsv(menuob, 64, MTITLE, mbak, VER_ROW, VER_COL, m7verms, 14);
566
567 for (i = 1; i < 13; i++)
568 vcputsv(menuob, 64, mbcv, mbak, mrowcol[i][0], mrowcol[i][1],
569 mtexts[i], 14);
570
571 vcputsv(menuob, 64, MBUCHLA, mbak, mrowcol[13][0], mrowcol[13][1],
572 mtexts[13], 14);
573
574 for (i = 0; i < NLTYPES; i++) {
575
576 memcpy(buf, loadedf[i], 8);
577 buf[8] = '\0';
578
579 vcputsv(menuob, 64, MLFILES, mbak, mfrc[i][0], mfrc[i][1],
580 buf, 14);
581 }
582}
583
584/*
585
586*/
587
588/*
589 =============================================================================
590 m7menu() -- setup the MIDAS 700 main menu display
591 =============================================================================
592*/
593
594m7menu()
595{
596 menuob = &v_score[0];
597 obj0 = &v_curs0[0];
598 mdoct = &v_obtab[MENUOBJ];
599
600 curslim = 350;
601
602 curset(&m7_flds);
603
604 ndisp = -1;
605 dswap();
606
607 vbank(0);
608 memsetw(menuob, 0, 32767);
609 memsetw(menuob+32767L, 0, 12033);
610
611 SetObj(MENUOBJ, 0, 0, menuob, 512, 350, 0, 0, MENUFL, -1);
612 SetObj(0, 0, 1, obj0, 16, 16, MCURX, MCURY, OBFL_00, -1);
613
614 arcurs(MCURSOR);
615
616 drawm();
617
618 vsndpal(menupal);
619
620 SetPri(MENUOBJ, MENUPRI);
621 SetPri(0, GCPRI);
622
623 setgc(MCURX, MCURY);
624}
Note: See TracBrowser for help on using the repository browser.