source: buchla-68k/ram/sedump.c@ 0c834c5

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

Point of no return.

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