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

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

Unused variables and parameters.

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