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

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

Zero redundant declarations.

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