source: buchla-68k/ram/sedump.c@ 572daa7

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

Unused variables and parameters.

  • Property mode set to 100644
File size: 14.8 KB
Line 
1/*
2 =============================================================================
3 sedump.c -- dump various kinds of MIDAS-VII data in readable format
4 Version 42 -- 1988-08-24 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "ram.h"
9
10int8_t *A6PTR = 0L; /* traceback a6 starting address */
11int8_t *A7PTR = 0L; /* traceback a7 starting address */
12int8_t *A7TOP = (int8_t *)0x000FFFFFL;
13 /* traceback stack top */
14
15int16_t SCnumv = 0; /* voice for SCvoice() to dump (0..11) */
16int16_t SL_Flag; /* ROMP trap disable flag */
17int16_t x_unrec; /* unrecognized event type or size flag */
18
19int32_t SCdlim = MAX_SE; /* score dump limit */
20
21int8_t *evkinds[N_ETYPES] = { /* event types (must match score.h) */
22
23 "00: EV_NULL null event ", "01: EV_SCORE score begin ",
24 "02: EV_SBGN section begin", "03: EV_SEND section end ",
25 "04: EV_INST instr. change", "05: EV_NBEG note begin ",
26 "06: EV_NEND note end ", "07: EV_STOP stop ",
27 "08: EV_INTP interpolate ", "09: EV_TMPO tempo ",
28 "0A: EV_TUNE tuning ", "0B: EV_GRP group status ",
29 "0C: EV_LOCN location ", "0D: EV_DYN dynamics ",
30 "0E: EV_ANVL analog value ", "0F: EV_ANRS analog res. ",
31 "10: EV_ASGN I/O assign ", "11: EV_TRNS transposition",
32 "12: EV_REPT repeat ", "13: EV_PNCH punch in/out ",
33 "14: EV_PRES poly pressure", "15: EV_FINI score end ",
34 "16: EV_CPRS chan pressure", "17: EV_BAR bar marker "
35};
36
37int8_t *hpname[N_TYPES] = { /* header type names (must match score.h) */
38
39 "EH_INST", "EH_GRP ", "EH_LOCN", "EH_DYN ",
40 "EH_ANRS", "EH_TRNS", "EH_INTP", "EH_TMPO",
41 "EH_TUNE", "EH_ASGN", "EH_SBGN", "EH_SEND"
42};
43
44int8_t *var_lbl[6] = { /* variable names */
45
46 "Pch/Hor", "Mod/Vrt", "Brth/LP", "GPC/CV1",
47 "Pedal 1", "Key Prs"
48};
49
50int8_t *srcname[] = { /* source names (must match smdefs.h) */
51
52 "NONE", "RAND", "CTL1", "?03?", "?04?", "PTCH", "KPRS", "KVEL",
53 "PED1", "?09?", "FREQ", "HTPW", "VTMW", "LPBR"
54};
55
56int8_t *actname[] = { /* function action names */
57
58 "NULL", "SUST", "ENBL", "JUMP", "LOOP", "KYUP", "KYDN", "HERE"
59};
60
61/*
62 =============================================================================
63 ev_kind(sep) -- returns a pointer to a string describing the event
64 at 'sep', or a NULL pointer if the event is unrecognized.
65 Sets x_unrec according to the result.
66 =============================================================================
67*/
68
69int8_t *ev_kind(struct s_entry *sep)
70{
71 if ((sep->e_type & 0x00FF) GE N_ETYPES) {
72
73 x_unrec = TRUE;
74 return(NULL);
75 }
76
77 x_unrec = FALSE;
78
79 return(evkinds[sep->e_type]);
80}
81
82/*
83 =============================================================================
84 SEctrl() -- print current score pointers and times
85 =============================================================================
86*/
87
88void SEctrl(void)
89{
90 printf("curscor: %d \"%-16.16s\" cursect: %d scp: $%08lX\n\n",
91 curscor, scname[curscor], cursect, scp);
92
93
94 printf(" fc_val: %8ld fc_sw: %d\n\n",
95 fc_val, fc_sw);
96
97
98 printf(" t_bak: %8ld t_cur: %8ld t_ctr: %8ld t_fwd: %8ld\n",
99 t_bak, t_cur, t_ctr, t_fwd);
100
101 printf(" p_bak: $%08lX p_cur: $%08lX p_ctr: $%08lX p_fwd: $%08lX\n\n",
102 p_bak, p_cur, p_ctr, p_fwd);
103
104}
105
106/*
107 =============================================================================
108 SEsnap() -- snap dump critical score storage variables
109 =============================================================================
110*/
111
112void SEsnap(void)
113{
114 register int16_t i, j;
115
116 printf("\n");
117
118 printf("evleft: %ld spcount: %ld frags: %ld\n",
119 evleft(), spcount, frags);
120
121 printf(" se1_cnt=%ld se2_cnt=%ld se3_cnt=%ld\n",
122 se1_cnt, se2_cnt, se3_cnt);
123
124 printf(" pspool=$%08lX size1=$%08lX size2=$%08lX size3=$%08lX\n",
125 pspool, size1, size2, size3);
126
127 SEctrl();
128
129 for (i = 0; i < N_SCORES; i++)
130 printf("%2d: \"%-16.16s\" $%08lX %s\n",
131 i + 1, scname[i], scores[i],
132 (i EQ curscor) ? "<--- curscor" : "");
133
134 printf("\n\n");
135
136 printf("Variable modes for each group:\n\n");
137
138 printf("V# VarName 01 02 03 04 05 06 07 08 09 10 11 12\n");
139 printf("-- ------- -- -- -- -- -- -- -- -- -- -- -- --\n");
140
141 for (i = 0; i < 6; i++) {
142
143 printf("%02d %s ", i, var_lbl[i]);
144
145 for (j = 0; j < 12; j++)
146 printf(" %d ", varmode[i][j]);
147
148 printf("\n");
149 }
150
151 printf("\n");
152}
153
154/*
155 =============================================================================
156 SEdump(sep) -- dumps the event at 'sep' in readable format.
157 Returns 'sep'. Sets x_unrec TRUE if the event is unrecognized,
158 FALSE if the event is recognized.
159 =============================================================================
160*/
161
162struct s_entry *SEdump(struct s_entry *sep)
163{
164 int8_t *et;
165
166 x_unrec = TRUE;
167
168 switch (sep->e_size) {
169
170 case E_SIZE1:
171 case E_SIZE2:
172 case E_SIZE3:
173
174 break;
175
176 default:
177
178 printf("[%08lX]: ** Bad event size: $%02.2X **\n",
179 sep, sep->e_size);
180
181 return(sep);
182 }
183
184 if (NULL EQ (et = ev_kind(sep))) {
185
186 printf("[%08lX]: ** Bad event type: $%02.2X **\n",
187 sep, sep->e_type);
188
189 return(sep);
190 }
191
192 x_unrec = FALSE;
193
194 printf("$%08lX: t=%10ld F:$%08lX B:$%08lX * %s\n",
195 sep, sep->e_time, sep->e_fwd, sep->e_bak, et);
196
197 printf(" data = $%02.2X $%02.2X",
198 0x00FF & sep->e_data1, 0x00FF & sep->e_data2);
199
200 if (sep->e_size EQ E_SIZE1)
201 printf(" $%04.4X $%04.4X",
202 ((struct n_entry *)sep)->e_vel,
203 ((struct n_entry *)sep)->e_data4);
204
205 printf("\n");
206
207 if (sep->e_size GT E_SIZE1)
208 printf(" up: $%08lX dn: $%08lX",
209 sep->e_up, sep->e_dn);
210 else
211 return(sep);
212
213 if (sep->e_size GT E_SIZE2)
214 printf(" lft: $%08lX rgt: $%08lX",
215 sep->e_lft, sep->e_rgt);
216
217 printf("\n");
218
219 return(sep);
220}
221
222/*
223 =============================================================================
224 SEchase() -- print up to 'n' events or to the end of the score,
225 starting with event 'ep'.
226 =============================================================================
227*/
228
229struct s_entry *SEchase(struct s_entry *ep, int32_t n)
230{
231 register int32_t i;
232 register struct s_entry *np;
233
234 printf("\n");
235
236 if (ep EQ E_NULL) {
237
238 printf("NULL pointer\n");
239 return(scp);
240 }
241
242 if (Pcheck(ep, "ep - SEchase()"))
243 return(scp);
244
245 for (i = 0; i < n; i++) {
246
247 SEdump(ep);
248
249 if ((ep->e_type EQ EV_FINI) OR x_unrec)
250 return(scp);
251
252 np = ep->e_fwd;
253
254 if (Pcheck(np, "e_fwd - SEchase()"))
255 return(scp);
256
257 if (Pcheck(ep->e_bak, "e_bak - SEchase()"))
258 return(scp);
259
260 ep = np;
261 }
262
263 printf("\n");
264
265 return(ep);
266}
267
268/*
269 =============================================================================
270 SLdump() -- print slice control data
271 =============================================================================
272*/
273
274void SLdump(void)
275{
276 register int16_t i;
277
278 printf("\n");
279
280 printf("sd = %s se = %s sbase = %d soffset = %d scrl = $%04.4X\n",
281 sd ? "BAK" : "FWD", se ? "BAK" : "FWD", sbase, soffset, scrl);
282
283 printf("gdfsep = $%08lX\n\n", gdfsep);
284
285 printf("gr $ gdstbp $ gdstbc $ gdstbn\n");
286 printf(" %08lX %08lX %08lX\n", gdstbp, gdstbc, gdstbn);
287 printf("-- -------- -------- --------\n");
288
289 for (i = 0; i < NGDSEL; i++) {
290
291 printf("%2d %08lX %08lX %08lX\n",
292 i + 1, gdstbp[i], gdstbc[i], gdstbn[i]);
293
294 if (i EQ 11)
295 printf("\n");
296 }
297
298 printf("\n");
299
300 if (SL_Flag EQ FALSE)
301 xtrap15();
302
303 SL_Flag = FALSE;
304}
305
306/*
307 =============================================================================
308 SECdump() -- dump section variables and hplist
309 =============================================================================
310*/
311
312void SECdump(void)
313{
314 register int16_t i;
315
316 printf("p_sbgn = $%08lX p_send = $%08lX\n",
317 p_sbgn, p_send);
318
319 printf("t_sbgn = %8ld t_send = %8ld t_sect = %8ld\n\n",
320 t_sbgn, t_send, t_sect);
321
322
323 printf("p_cbgn = $%08lX p_cend = $%08lX\n",
324 p_cbgn, p_cend);
325
326 printf("t_cbgn = %8ld t_cend = %8ld\n\n",
327 t_cbgn, t_cend);
328
329
330 printf("seclist[curscor][]\n");
331 printf("------------------\n\n");
332
333 printf("Sec Addr_____ Sec Addr_____ Sec Addr_____ Sec Addr_____ Sec Addr_____ \n");
334
335 for (i = 0; i < N_SECTS; i += 5) {
336
337 printf("%2d $%08lX ", i + 1, seclist[curscor][i]);
338
339 if ((i + 1) < N_SECTS)
340 printf("%2d $%08lX ", i + 2, seclist[curscor][i + 1]);
341
342 if ((i + 2) < N_SECTS)
343 printf("%2d $%08lX ", i + 3, seclist[curscor][i + 2]);
344
345 if ((i + 3) < N_SECTS)
346 printf("%2d $%08lX ", i + 4, seclist[curscor][i + 3]);
347
348 if ((i + 4) < N_SECTS)
349 printf("%2d $%08lX ", i + 5, seclist[curscor][i + 4]);
350
351 printf("\n");
352 }
353
354 printf("\n");
355
356 printf("hplist[curscor][]\n");
357 printf("-----------------\n");
358 printf("Type___ Addr_____\n");
359
360 for (i = 0; i < N_TYPES; i++)
361 printf("%s $%08lX\n", hpname[i], hplist[curscor][i]);
362
363 printf("\n");
364}
365
366/*
367 =============================================================================
368 DOA() -- do a simple stack traceback
369 =============================================================================
370*/
371
372void DOA(void)
373{
374 register int32_t *olda6, *cura6;
375 register int16_t n, *prptr;
376
377 if (A6PTR AND A7PTR) {
378
379 printf("Stack dump: $%08lX to $%08lX\n\n", A7PTR, A7TOP);
380 mdump(A7PTR, A7TOP, (int32_t)A7PTR);
381 printf("\n\n");
382 printf("Stack traceback: from A6 = $%08lX\n\n", A6PTR);
383 printf("A6 Old A6 Return\n");
384
385 } else {
386
387 printf("Set A6PTR ($%08lX) and A7PTR ($%08lX) first\n",
388 &A6PTR, &A7PTR);
389
390 xtrap15();
391 }
392
393 cura6 = A6PTR;
394
395 while (cura6) {
396
397 olda6 = (int32_t *)*cura6;
398
399 printf("$%08lX: $%08lX $%08lX\n",
400 cura6, olda6, *(cura6 + 4L));
401
402 prptr = cura6 + 8L;
403 n = 8;
404
405 while (prptr < olda6) {
406
407 printf(" +%-4d [$%08lX]: $%04.4X\n",
408 n, prptr, *prptr);
409
410 n += 2;
411 ++prptr;
412 }
413
414 cura6 = olda6;
415 }
416
417 xtrap15();
418}
419
420/*
421 =============================================================================
422 SCPanic() -- print the score control variables
423 =============================================================================
424*/
425
426void SCPanic(void)
427{
428 SEsnap(); /* control data */
429 xtrap15();
430}
431
432/*
433 =============================================================================
434 SCdump() -- print the score control variables and the current score
435 =============================================================================
436*/
437
438void SCdump(void)
439{
440 SEsnap(); /* control data */
441 SECdump(); /* section variables */
442 SEchase(scp, SCdlim); /* current score */
443 xtrap15();
444}
445
446/*
447 =============================================================================
448 SCcrash() -- print all of the score related data and the current score
449 =============================================================================
450*/
451
452void SCcrash(void)
453{
454 SL_Flag = TRUE;
455 SLdump(); /* slice data */
456 SCdump(); /* control data and current score */
457}
458
459/*
460 =============================================================================
461 SCtimes() -- print the score times and pointers
462 =============================================================================
463*/
464
465void SCtimes(void)
466{
467 SEctrl();
468 xtrap15();
469}
470
471/*
472 =============================================================================
473 SCslice() -- print details of the slices
474 =============================================================================
475*/
476
477void SCslice(void)
478{
479 register int16_t i, s;
480 register struct gdsel *gp;
481
482 /* print details of gdstbp */
483
484 s = FALSE;
485
486 for (i = 0; i < NGDSEL; i++) {
487
488 if ((struct gdsel *)NULL NE (gp = gdstbp[i])) {
489
490 if (NOT s) {
491
492 printf("gdstbp:");
493 s = TRUE;
494 }
495
496 while (gp) {
497
498 printf(" %02d:%02d:%d",
499 i + 1, gp->note, gp->code);
500
501 gp = gp->next;
502 }
503 }
504 }
505
506 if (s)
507 printf("\n");
508
509
510 /* print details of gdstbc */
511
512 s = FALSE;
513
514 for (i = 0; i < NGDSEL; i++) {
515
516 if ((struct gdsel *)NULL NE (gp = gdstbc[i])) {
517
518 if (NOT s) {
519
520 printf("gdstbc:");
521 s = TRUE;
522 }
523
524 while (gp) {
525
526 printf(" %02d:%02d:%d",
527 i + 1, gp->note, gp->code);
528
529 gp = gp->next;
530 }
531 }
532 }
533
534 if (s)
535 printf("\n");
536
537 /* print details of gdstbn */
538
539 s = FALSE;
540
541 for (i = 0; i < NGDSEL; i++) {
542
543 if ((struct gdsel *)NULL NE (gp = gdstbn[i])) {
544
545 if (NOT s) {
546
547 printf("gdstbn:");
548 s = TRUE;
549 }
550
551 while (gp) {
552
553 printf(" %02d:%02d:%d",
554 i + 1, gp->note, gp->code);
555
556 gp = gp->next;
557 }
558 }
559 }
560
561 if (s)
562 printf("\n");
563
564}
565
566/*
567 =============================================================================
568 SCvce() -- dump voice buffer instrument definition
569 =============================================================================
570*/
571
572void SCvce(int16_t n)
573{
574 register int16_t i, j, pif, pt1;
575 register struct instdef *ip;
576 register struct idfnhdr *fp;
577 register struct instpnt *pp;
578
579 ip = &vbufs[n];
580
581 /* dump instrument header */
582
583 printf("VOICE %2d: %-16.16s %-16.16s %-16.16s %-16.16s\n",
584 (1 + n), ip->idhname, ip->idhcom1, ip->idhcom2, ip->idhcom3);
585
586 printf(" flag=%04.4X Cfg=%d #plft=%d WsA=%d WsB=%d\n",
587 ip->idhflag, (0x00FF & ip->idhcfg), (0x00FF & ip->idhplft),
588 (1 + (0x00FF & ip->idhwsa)), (1 + (0x00FF & ip->idhwsb)));
589
590 printf(" Osc 1:%s %c %04.4X 2:%s %c %04.4X 3:%s %c %04.4X 4:%s %c %04.4X\n",
591 osclbl[ip->idhos1c & OC_MOD],
592 ((ip->idhos1c & OC_SYN) ? 'S' : ' '),
593 ip->idhos1v,
594 osclbl[ip->idhos2c & OC_MOD],
595 ((ip->idhos2c & OC_SYN) ? 'S' : ' '),
596 ip->idhos2v,
597 osclbl[ip->idhos3c & OC_MOD],
598 ((ip->idhos3c & OC_SYN) ? 'S' : ' '),
599 ip->idhos3v,
600 osclbl[ip->idhos4c & OC_MOD],
601 ((ip->idhos4c & OC_SYN) ? 'S' : ' '),
602 ip->idhos4v);
603
604 /* dump function headers */
605
606 printf("\nFunction headers\n");
607
608 printf(" Fn Pch Mult Sr Pif Pt1 Cpt Md Pr Trg \n");
609 printf(" -- ---- ---- -- --- --- --- -- -- ----\n");
610
611 for (i = 0; i < NFINST; i++) {
612
613 fp = &ip->idhfnc[i];
614
615 printf(" %2d %04.4X %04.4X %02X %3d %3d %3d %02x %02x %04.4x %s\n",
616 i, fp->idfpch, fp->idfmlt, (0x00FF & fp->idfsrc),
617 (0x00FF & fp->idfpif), (0x00FF & fp->idfpt1),
618 (0x00FF & fp->idfcpt), (0x00FF & fp->idftmd),
619 (0x00FF & fp->idfprm), fp->idftrg, idbxlbl[i]);
620
621 }
622
623 /* dump occupied points for each function */
624
625 printf("\nOccupied points\n");
626 printf(" Fn Fpt Ipt Time Val Mult Src Act P1 P2 P3 Pd\n");
627 printf(" -- --- --- ---- ---- ---- ---- ---- -- -- -- --\n");
628
629 for (i = 0; i < NFINST; i++) {
630
631 fp = &ip->idhfnc[i];
632 pif = 0x00FF & fp->idfpif;
633 pt1 = 0x00FF & fp->idfpt1;
634
635 for (j = 0; j < pif; j++) {
636
637 pp = &ip->idhpnt[pt1 + j];
638
639 printf(" %2d %3d %3d %04.4X %04.4X %04.4X %4s %4s %2X %2X %2X %2X\n",
640 i, j, (pt1 + j), pp->iptim, pp->ipval, pp->ipvmlt,
641 srcname[0x00FF & pp->ipvsrc],
642 actname[0x00FF & pp->ipact],
643 (0x00FF & pp->ippar1), (0x00FF & pp->ippar2),
644 (0x00FF & pp->ippar3), (0x00FF & pp->ippad));
645 }
646 }
647
648 printf("\n");
649}
650
651/*
652 =============================================================================
653 SCvces() -- dump voice buffer instrument definitions
654 =============================================================================
655*/
656
657void SCvces(void)
658{
659 register int16_t i;
660
661 for (i = 0; i < 12; i++)
662 SCvce(i);
663
664 xtrap15();
665}
666
667/*
668 =============================================================================
669 SCvoice() -- dump voice buffer instrument definition
670 =============================================================================
671*/
672
673void SCvoice(void)
674{
675 SCvce(SCnumv);
676 xtrap15();
677}
678
Note: See TracBrowser for help on using the repository browser.