source: buchla-68k/orig/RAM/SEDUMP.C@ 0170798

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

Imported original source code.

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