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

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

Removed form-feed comments.

  • Property mode set to 100644
File size: 14.9 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 register struct gdsel *gp;
278
279 printf("\n");
280
281 printf("sd = %s se = %s sbase = %d soffset = %d scrl = $%04.4X\n",
282 sd ? "BAK" : "FWD", se ? "BAK" : "FWD", sbase, soffset, scrl);
283
284 printf("gdfsep = $%08lX\n\n", gdfsep);
285
286 printf("gr $ gdstbp $ gdstbc $ gdstbn\n");
287 printf(" %08lX %08lX %08lX\n", gdstbp, gdstbc, gdstbn);
288 printf("-- -------- -------- --------\n");
289
290 for (i = 0; i < NGDSEL; i++) {
291
292 printf("%2d %08lX %08lX %08lX\n",
293 i + 1, gdstbp[i], gdstbc[i], gdstbn[i]);
294
295 if (i EQ 11)
296 printf("\n");
297 }
298
299 printf("\n");
300
301 if (SL_Flag EQ FALSE)
302 xtrap15();
303
304 SL_Flag = FALSE;
305}
306
307/*
308 =============================================================================
309 SECdump() -- dump section variables and hplist
310 =============================================================================
311*/
312
313void SECdump(void)
314{
315 register int16_t i;
316
317 printf("p_sbgn = $%08lX p_send = $%08lX\n",
318 p_sbgn, p_send);
319
320 printf("t_sbgn = %8ld t_send = %8ld t_sect = %8ld\n\n",
321 t_sbgn, t_send, t_sect);
322
323
324 printf("p_cbgn = $%08lX p_cend = $%08lX\n",
325 p_cbgn, p_cend);
326
327 printf("t_cbgn = %8ld t_cend = %8ld\n\n",
328 t_cbgn, t_cend);
329
330
331 printf("seclist[curscor][]\n");
332 printf("------------------\n\n");
333
334 printf("Sec Addr_____ Sec Addr_____ Sec Addr_____ Sec Addr_____ Sec Addr_____ \n");
335
336 for (i = 0; i < N_SECTS; i += 5) {
337
338 printf("%2d $%08lX ", i + 1, seclist[curscor][i]);
339
340 if ((i + 1) < N_SECTS)
341 printf("%2d $%08lX ", i + 2, seclist[curscor][i + 1]);
342
343 if ((i + 2) < N_SECTS)
344 printf("%2d $%08lX ", i + 3, seclist[curscor][i + 2]);
345
346 if ((i + 3) < N_SECTS)
347 printf("%2d $%08lX ", i + 4, seclist[curscor][i + 3]);
348
349 if ((i + 4) < N_SECTS)
350 printf("%2d $%08lX ", i + 5, seclist[curscor][i + 4]);
351
352 printf("\n");
353 }
354
355 printf("\n");
356
357 printf("hplist[curscor][]\n");
358 printf("-----------------\n");
359 printf("Type___ Addr_____\n");
360
361 for (i = 0; i < N_TYPES; i++)
362 printf("%s $%08lX\n", hpname[i], hplist[curscor][i]);
363
364 printf("\n");
365}
366
367/*
368 =============================================================================
369 DOA() -- do a simple stack traceback
370 =============================================================================
371*/
372
373void DOA(void)
374{
375 register int32_t *olda6, *cura6;
376 register int16_t n, *prptr;
377
378 if (A6PTR AND A7PTR) {
379
380 printf("Stack dump: $%08lX to $%08lX\n\n", A7PTR, A7TOP);
381 mdump(A7PTR, A7TOP, (int32_t)A7PTR);
382 printf("\n\n");
383 printf("Stack traceback: from A6 = $%08lX\n\n", A6PTR);
384 printf("A6 Old A6 Return\n");
385
386 } else {
387
388 printf("Set A6PTR ($%08lX) and A7PTR ($%08lX) first\n",
389 &A6PTR, &A7PTR);
390
391 xtrap15();
392 }
393
394 cura6 = A6PTR;
395
396 while (cura6) {
397
398 olda6 = (int32_t *)*cura6;
399
400 printf("$%08lX: $%08lX $%08lX\n",
401 cura6, olda6, *(cura6 + 4L));
402
403 prptr = cura6 + 8L;
404 n = 8;
405
406 while (prptr < olda6) {
407
408 printf(" +%-4d [$%08lX]: $%04.4X\n",
409 n, prptr, *prptr);
410
411 n += 2;
412 ++prptr;
413 }
414
415 cura6 = olda6;
416 }
417
418 xtrap15();
419}
420
421/*
422 =============================================================================
423 SCPanic() -- print the score control variables
424 =============================================================================
425*/
426
427void SCPanic(void)
428{
429 SEsnap(); /* control data */
430 xtrap15();
431}
432
433/*
434 =============================================================================
435 SCdump() -- print the score control variables and the current score
436 =============================================================================
437*/
438
439void SCdump(void)
440{
441 SEsnap(); /* control data */
442 SECdump(); /* section variables */
443 SEchase(scp, SCdlim); /* current score */
444 xtrap15();
445}
446
447/*
448 =============================================================================
449 SCcrash() -- print all of the score related data and the current score
450 =============================================================================
451*/
452
453void SCcrash(void)
454{
455 SL_Flag = TRUE;
456 SLdump(); /* slice data */
457 SCdump(); /* control data and current score */
458}
459
460/*
461 =============================================================================
462 SCtimes() -- print the score times and pointers
463 =============================================================================
464*/
465
466void SCtimes(void)
467{
468 SEctrl();
469 xtrap15();
470}
471
472/*
473 =============================================================================
474 SCslice() -- print details of the slices
475 =============================================================================
476*/
477
478void SCslice(void)
479{
480 register int16_t i, s;
481 register struct gdsel *gp;
482
483 /* print details of gdstbp */
484
485 s = FALSE;
486
487 for (i = 0; i < NGDSEL; i++) {
488
489 if ((struct gdsel *)NULL NE (gp = gdstbp[i])) {
490
491 if (NOT s) {
492
493 printf("gdstbp:");
494 s = TRUE;
495 }
496
497 while (gp) {
498
499 printf(" %02d:%02d:%d",
500 i + 1, gp->note, gp->code);
501
502 gp = gp->next;
503 }
504 }
505 }
506
507 if (s)
508 printf("\n");
509
510
511 /* print details of gdstbc */
512
513 s = FALSE;
514
515 for (i = 0; i < NGDSEL; i++) {
516
517 if ((struct gdsel *)NULL NE (gp = gdstbc[i])) {
518
519 if (NOT s) {
520
521 printf("gdstbc:");
522 s = TRUE;
523 }
524
525 while (gp) {
526
527 printf(" %02d:%02d:%d",
528 i + 1, gp->note, gp->code);
529
530 gp = gp->next;
531 }
532 }
533 }
534
535 if (s)
536 printf("\n");
537
538 /* print details of gdstbn */
539
540 s = FALSE;
541
542 for (i = 0; i < NGDSEL; i++) {
543
544 if ((struct gdsel *)NULL NE (gp = gdstbn[i])) {
545
546 if (NOT s) {
547
548 printf("gdstbn:");
549 s = TRUE;
550 }
551
552 while (gp) {
553
554 printf(" %02d:%02d:%d",
555 i + 1, gp->note, gp->code);
556
557 gp = gp->next;
558 }
559 }
560 }
561
562 if (s)
563 printf("\n");
564
565}
566
567/*
568 =============================================================================
569 SCvce() -- dump voice buffer instrument definition
570 =============================================================================
571*/
572
573void SCvce(int16_t n)
574{
575 register int16_t i, j, pif, pt1;
576 register struct instdef *ip;
577 register struct idfnhdr *fp;
578 register struct instpnt *pp;
579
580 ip = &vbufs[n];
581
582 /* dump instrument header */
583
584 printf("VOICE %2d: %-16.16s %-16.16s %-16.16s %-16.16s\n",
585 (1 + n), ip->idhname, ip->idhcom1, ip->idhcom2, ip->idhcom3);
586
587 printf(" flag=%04.4X Cfg=%d #plft=%d WsA=%d WsB=%d\n",
588 ip->idhflag, (0x00FF & ip->idhcfg), (0x00FF & ip->idhplft),
589 (1 + (0x00FF & ip->idhwsa)), (1 + (0x00FF & ip->idhwsb)));
590
591 printf(" Osc 1:%s %c %04.4X 2:%s %c %04.4X 3:%s %c %04.4X 4:%s %c %04.4X\n",
592 osclbl[ip->idhos1c & OC_MOD],
593 ((ip->idhos1c & OC_SYN) ? 'S' : ' '),
594 ip->idhos1v,
595 osclbl[ip->idhos2c & OC_MOD],
596 ((ip->idhos2c & OC_SYN) ? 'S' : ' '),
597 ip->idhos2v,
598 osclbl[ip->idhos3c & OC_MOD],
599 ((ip->idhos3c & OC_SYN) ? 'S' : ' '),
600 ip->idhos3v,
601 osclbl[ip->idhos4c & OC_MOD],
602 ((ip->idhos4c & OC_SYN) ? 'S' : ' '),
603 ip->idhos4v);
604
605 /* dump function headers */
606
607 printf("\nFunction headers\n");
608
609 printf(" Fn Pch Mult Sr Pif Pt1 Cpt Md Pr Trg \n");
610 printf(" -- ---- ---- -- --- --- --- -- -- ----\n");
611
612 for (i = 0; i < NFINST; i++) {
613
614 fp = &ip->idhfnc[i];
615
616 printf(" %2d %04.4X %04.4X %02X %3d %3d %3d %02x %02x %04.4x %s\n",
617 i, fp->idfpch, fp->idfmlt, (0x00FF & fp->idfsrc),
618 (0x00FF & fp->idfpif), (0x00FF & fp->idfpt1),
619 (0x00FF & fp->idfcpt), (0x00FF & fp->idftmd),
620 (0x00FF & fp->idfprm), fp->idftrg, idbxlbl[i]);
621
622 }
623
624 /* dump occupied points for each function */
625
626 printf("\nOccupied points\n");
627 printf(" Fn Fpt Ipt Time Val Mult Src Act P1 P2 P3 Pd\n");
628 printf(" -- --- --- ---- ---- ---- ---- ---- -- -- -- --\n");
629
630 for (i = 0; i < NFINST; i++) {
631
632 fp = &ip->idhfnc[i];
633 pif = 0x00FF & fp->idfpif;
634 pt1 = 0x00FF & fp->idfpt1;
635
636 for (j = 0; j < pif; j++) {
637
638 pp = &ip->idhpnt[pt1 + j];
639
640 printf(" %2d %3d %3d %04.4X %04.4X %04.4X %4s %4s %2X %2X %2X %2X\n",
641 i, j, (pt1 + j), pp->iptim, pp->ipval, pp->ipvmlt,
642 srcname[0x00FF & pp->ipvsrc],
643 actname[0x00FF & pp->ipact],
644 (0x00FF & pp->ippar1), (0x00FF & pp->ippar2),
645 (0x00FF & pp->ippar3), (0x00FF & pp->ippad));
646 }
647 }
648
649 printf("\n");
650}
651
652/*
653 =============================================================================
654 SCvces() -- dump voice buffer instrument definitions
655 =============================================================================
656*/
657
658void SCvces(void)
659{
660 register int16_t i;
661
662 for (i = 0; i < 12; i++)
663 SCvce(i);
664
665 xtrap15();
666}
667
668/*
669 =============================================================================
670 SCvoice() -- dump voice buffer instrument definition
671 =============================================================================
672*/
673
674void SCvoice(void)
675{
676 SCvce(SCnumv);
677 xtrap15();
678}
679
Note: See TracBrowser for help on using the repository browser.