source: buchla-68k/orig/RAM/IM700.C@ c79db87

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

Imported original source code.

  • Property mode set to 100755
File size: 33.6 KB
Line 
1/*
2 =============================================================================
3 im700.c -- variable definitions and initialization for MIDAS-VII
4 Version 102 -- 1989-11-16 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#define DEBUGVAL 0 /* initial value for debugsw */
9
10#define FET_DEFS 1 /* so fields.h gets things right */
11#define M7CAT 1 /* so libdsp.h gets it right */
12
13#include "stddefs.h"
14#include "biosdefs.h"
15#include "cmeta.h"
16#include "curpak.h"
17#include "fields.h"
18#include "fpu.h"
19#include "glcfns.h"
20#include "glcdefs.h"
21#include "graphdef.h"
22#include "hwdefs.h"
23#include "macros.h"
24#include "memory.h"
25#include "objdefs.h"
26#include "panel.h"
27#include "sclock.h"
28#include "scwheel.h"
29#include "slice.h"
30#include "smdefs.h"
31#include "timers.h"
32#include "vsdd.h"
33#include "vsddsw.h"
34#include "vsddvars.h"
35
36#include "midas.h"
37
38#include "asgdsp.h"
39#include "instdsp.h"
40#include "libdsp.h"
41#include "score.h"
42#include "scdsp.h"
43#include "scfns.h"
44#include "wsdsp.h"
45
46extern unsigned tofpu();
47
48extern short nokey(), stdmkey(), cxkstd(), cykstd(), cxgen(), cygen();
49extern short cmvgen(), stdctp2();
50
51extern short blakpal[16][3];
52
53extern PFS t_prmtr[];
54
55extern char *funcndx[256][2];
56
57extern char keystat[24];
58extern char ldcmnt[38];
59extern char ldfile[9];
60extern char loadedc[NLTYPES][37];
61extern char loadedf[NLTYPES][8];
62extern char masens[3];
63extern char mctlval[NCTRLS];
64extern char mdbyte[3];
65extern char mpsust[48];
66extern char mrstat[3];
67extern char trgtab[NTRIGS];
68
69extern short fnoff[];
70
71extern short articen[12]; /* voice articulation enable status */
72extern short grpmode[12]; /* group mode - 0 = play, 1 = stdby, 2 = rec */
73extern short grpsel[12]; /* group select status for instrument selection */
74extern short grpstat[12]; /* group status - 0 = off, non-0 = on */
75extern short gtctab[12]; /* group to color table */
76extern short lastvce[12]; /* last voice assigned in each group */
77extern short lastvel[12]; /* last velocity sent to group */
78extern short mpbend[48]; /* MIDI pitch bend data, by port and channel */
79extern short msmstv[3]; /* MIDI state machine state variables */
80extern short prstab[NTRIGS]; /* pressure */
81extern short vce2trg[12]; /* voice to trigger map (-1 EQ NULL) */
82extern short veltab[NTRIGS]; /* velocity */
83
84/*
85
86*/
87
88extern PFS (*oldsw)[]; /* saved swpt value */
89extern PFS (*swpt)[]; /* switch dispatch table pointer */
90
91extern short (*curmove)(); /* cursor move function */
92extern short (*curtype)(); /* cursor type function */
93extern short (*cx_key)(); /* x rate calculation */
94extern short (*cx_upd)(); /* x update */
95extern short (*cy_key)(); /* y rate calculation */
96extern short (*cy_upd)(); /* y update */
97extern short (*d_key)(); /* in-field data key processor */
98extern short (*e_key)(); /* E key processor */
99extern short (*m_key)(); /* M key processor */
100extern short (*not_fld)(); /* not-in-field data key processor */
101extern short (*premove)(); /* cursor pre-move function */
102extern short (*pstmove)(); /* cursor post-move function */
103extern short (*x_key)(); /* X key processor */
104extern short (*xy_dn)(); /* cursor - finger on (down) */
105extern short (*xy_up)(); /* cursor - finger off (up) */
106
107extern short *cratex; /* cursor x rate table pointer */
108extern short *cratey; /* cursor x rate table pointer */
109
110short admctl; /* assignment display submenu control variable */
111short adnamsw; /* assignment display virtual typewriter flag */
112short aflag; /* analog activity flag */
113short aform; /* action buffer format */
114short amplval; /* amplitude */
115short ancmsw; /* analog variable r/p control source */
116short angroup; /* analog variable group being shown */
117short asgfks; /* first key selected */
118short asghit; /* row hit / assignment in progress */
119short asgmod; /* assignment number or table modified */
120short asig; /* analog signal number */
121short asmode; /* panel assignment mode */
122short astat; /* analog signal status */
123short auxctl; /* aux control flag */
124short aval; /* analog signal value */
125short bform; /* oscillator data buffer format */
126short catin; /* catalog read in flag */
127short cents; /* pitch to cents conversion buffer */
128short chtime; /* horizontal cursor counter */
129short chwait; /* horizontal cursor wait time */
130short cflag; /* accidental flag */
131short clkctl; /* clock control */
132short clkrun; /* clock status */
133short clksrc; /* clock source */
134short cmfirst; /* first cursor motion switch */
135short cmtype; /* cursor motion type */
136short cnote; /* note value at cursor */
137short ctrsw; /* scupd center update switch */
138short curasg; /* current assignment table */
139short curfunc; /* current function number */
140short curgrp; /* current group */
141short curinst; /* current instrument number */
142short curmop; /* current MIDI output port */
143short curpnt; /* current point number (absolute) */
144short curpos; /* cursor pad position for current axis */
145short cursbox; /* currently selected box */
146short curscor; /* Current score number */
147short cursect; /* current section */
148short curslim; /* cursor type change point */
149short curtun; /* current tuning table */
150short curvce; /* current voice number */
151short curwave; /* current waveshape library slot */
152short curwdth; /* current waveshape cursor width */
153short curwfnl; /* current waveshape final value */
154short curwhrm; /* current waveshape harmonic number */
155short curwhrv; /* current waveshape harmonic value */
156short curwoff; /* current waveshape offset value */
157short curwpnt; /* current waveshape point number */
158short curwslt; /* current waveshape instrument slot */
159short cvtime; /* vertical cursor counter */
160short cvwait; /* veritcal cursor wait time */
161short cxrate; /* cursor x rate */
162short cxval; /* graphic cursor x value */
163short cyrate; /* cursor y rate */
164short cyval; /* graphic cursor y value */
165short debugne; /* debug flag for note entry */
166short defect; /* defect code */
167short dferror; /* error code from BIOS or XBIOS */
168short dfsides; /* number of sides */
169short dftype; /* disk type code */
170short dsp_ok; /* display update OK this cycle flag */
171short dubsw; /* overdub / replace switch */
172short ebflag; /* edit buffer data flag */
173short editss; /* edit panel switch state */
174short editsw; /* edit mode switch */
175short endflg; /* !end flag */
176short ext_cv1; /* CV-1 value */
177short ext_cv2; /* CV-2 value */
178short ext_cv3; /* CV-3 value */
179short ext_cv4; /* CV-4 value */
180short ext_mod; /* Aux Signal Mod value */
181short gomode; /* go to mode */
182short grptran; /* group translation value */
183short gtmsel; /* group transpose/map select */
184short hitbox; /* box we just hit */
185short hitcx; /* x of cursor when we hit the box */
186short hitcy; /* y of cursor when we hit the box */
187short idcfsw; /* copy / fetch menu switch */
188short idimsw; /* instrument display instrument menu switch */
189short idintmp; /* temporary for instrument number */
190short idnamsw; /* typewriter switch */
191short idsrcsw; /* source menu switch */
192short idtdat; /* current instrument vtyper data entry string */
193short imflag; /* instrument modified flag */
194short initcfg; /* initial configuration */
195short insmode; /* score insert mode */
196short ismode; /* instrument select mode */
197short lampio; /* LCD timeout disable switch state at I/O time */
198short lampsw; /* LCD timeout disable switch */
199short lasgsw; /* assignments store switch */
200short lastam; /* last assignment menu base */
201short ldelsw; /* delete switch */
202short lderrsw; /* error message displayed switch */
203short ldidsiz; /* getcat() did showsiz() switch */
204short ldkind; /* fetch file type */
205short ldpass; /* librarian load state variable */
206short ldrow; /* fetch select row */
207short ldslot; /* fetch select slot */
208short legato; /* execkey() "legato" mode switch */
209short lksel; /* librarian key slot selector */
210short lmwtype; /* librarian message window type */
211short loadrow; /* librarian row selected for load letter */
212short loadsw; /* panel "Load" mode state */
213short lorchl; /* load hi (TRUE) / lo (FALSE) orchestra */
214short lorchsw; /* hi orchestra (21 - 40) store switch */
215short lorclsw; /* lo orchestra (01 - 20) store switch */
216short lpatsw; /* patch table store switch */
217short lrasw; /* append (TRUE) / replace (FALSE) score */
218short lscrsw; /* score store switch */
219short lselsw; /* fetch select switch */
220short lseqsw; /* sequence table store switch */
221short lstbgnc; /* last note begin entry table index */
222short lstendc; /* last note end entry table index */
223short lstflag; /* last note list end switch */
224short lstrsw; /* store state switch */
225short lstwoff; /* last waveshape offset value */
226short lstwpnt; /* last waveshape point number */
227short ltagged; /* load tag switch */
228short ltunsw; /* tunings store switch */
229short lwavsw; /* waveshapes store switch */
230short mascntr; /* MIDI active sensing timeout counter */
231short mdb1; /* current MIDI data byte 1 */
232short mdb2; /* current MIDI data byte 2 */
233short michan; /* current MIDI channel */
234short midiclk; /* MIDI clock switch */
235short midigo; /* MIDI run switch */
236short mistat; /* current MIDI status */
237short nchwait; /* next chwait value */
238short ncvwait; /* next cvwait value */
239short ndisp; /* current display number */
240short newflag; /* new data entered while t_cur EQ t_ctr */
241short nkdown; /* number of keys down */
242short notenum; /* note number */
243short noteop; /* pending note operation code */
244short notepit; /* note pitch */
245short notesel; /* note selection state */
246short npts; /* number of points in function */
247short nxtflag; /* next score flag */
248short oldltag; /* previous load tag for tagslot */
249short oldpk; /* previous pkctrl state */
250short oldsl; /* previous sliders state */
251short pchsw; /* punch-in enable switch */
252short pecase; /* point edit case variable */
253short pkctrl; /* local performance key state */
254short pntsv; /* point selection state variable */
255short prgchan; /* MIDI program change channel (port 1) */
256short ps_dpth; /* phase shifter -- depth */
257short ps_intn; /* phase shifter -- intensity */
258short ps_rate; /* phase shifter -- rate */
259short pulsclk; /* pulse clock state */
260short recsw; /* record / play switch */
261short runit; /* run switch for main scan loop */
262short sbase; /* score VSDD RAM scroll offset */
263short scmctl; /* score submenu control flag */
264short scrlpot; /* scroll pot state */
265short sd; /* score display direction */
266short se; /* score execution direction */
267short sdmcol; /* score menu - saved stccol */
268short sdmctl; /* score menu - control variable */
269short sdmrow; /* score menu - saved stcrow */
270short secop; /* pending score section operation */
271short secopok; /* section operation OK flag */
272short sgcsw; /* graphic cursor display switch */
273short sgoflag; /* section number relative column 0..3 */
274short sharp; /* sharp flag */
275short sliders; /* slider and switch state */
276short soffset; /* score scroll offset */
277short ss_ptsw; /* smooth scroll patch scroll switch */
278short ss_sqsw; /* smooth scroll sequence scroll switch */
279short stccol; /* score cursor col */
280short stcrow; /* score cursor row */
281short stepclk; /* note entry - step clock state */
282short stepenb; /* note entry - step enable flag */
283short stepint; /* note entry - note interval */
284short stepwgt; /* note entry - note weight */
285short subj; /* edited point number (relative) */
286short submenu; /* submenu active switch */
287short swctrl; /* scroll wheel 'srolling' flag */
288short swdelta; /* scroll wheel change while touched */
289short swdir; /* scroll wheel direction */
290short swfiin; /* scroll wheel fifo input pointer */
291short swflag; /* scroll wheel touched flag */
292short swlast; /* scroll wheel last value */
293short swstop; /* scroll wheel stop flag */
294short swndx; /* scroll wheel look back index */
295short tagslot; /* tagged load slot */
296short tdnamsw; /* tuning editor displaying typewriter */
297short temax; /* time upper limit */
298short temin; /* time lower limit */
299short testing; /* test level */
300short tglclk; /* clock on/off toggle flag */
301short tglpch; /* punch in/out toggle flag */
302short thescore; /* score selected from sqscan */
303short timemlt; /* time scaling */
304short tkctrl; /* trackball active flag */
305short tmpomlt; /* tempo multiplier */
306short tmpoval; /* tempo value */
307short trkball; /* trackball selected switch */
308short ttcmdsv; /* tuning editor edit state variable */
309short ttsel1; /* tuning editor key select variable 1 */
310short ttsel2; /* tuning editor key select variable 2 */
311short ttsel3; /* tuning editor key select variable 3 */
312short tuneval; /* fine tuning */
313short tunmod; /* tuning table modified */
314short tunval; /* tuning editor increment / transpose value */
315short txfiin; /* trackball x fifo input pointer */
316short txflag; /* trackball x axis active flag */
317short txlast; /* trackball x axis last value */
318short txstop; /* trackball x axis filter counter */
319short tyfiin; /* trackball y fifo input pointer */
320short tyflag; /* trackball y axis active flag */
321short tylast; /* trackball y axis last value */
322short tystop; /* trackball y axis filter counter */
323short velflag; /* velocity display flag */
324short verbose; /* verbose output switch */
325short vlbtype; /* type of message window display */
326short vrbw08; /* score display video reset detail word */
327short vrbw09; /* score display video reset detail word */
328short vrbw10; /* score display video reset detail word */
329short vrbw11; /* score display video reset detail word */
330short vrbw12; /* score display video reset detail word */
331short vrbw13; /* score display video reset detail word */
332short vrbw14; /* score display video reset detail word */
333short vrbw15; /* score display video reset detail word */
334short vrcw; /* score display video reset control word */
335short vtccol; /* virtual typewriter cursor column */
336short vtcrow; /* virtual typewriter cursor row */
337short vtdechr; /* virtual typewriter data entry character */
338short vtdecol; /* virtual typewriter data entry column */
339short vtpcol; /* virtual typewriter column */
340short vtprow; /* virtual typewriter row */
341short vtwcol; /* virtual typewriter window left column */
342short vtwrow; /* virtual typewriter window top row */
343short vtxval; /* virtual typewriter cursor x value */
344short vtyval; /* virtual typewriter cursor y value */
345short wcflag; /* ws/cf menu select flag (cf=0, ws=1) */
346short wcmcol; /* ws/cf menu label column */
347short wcmrow; /* ws/cf menu label row */
348short wcpage; /* ws/cf menu page */
349short wdupdfl; /* waveshape display needs updated flag */
350short wmcsel; /* ws menu ws a/b select */
351short wmctag; /* ws/cf display update flag */
352short wplast; /* last point for interpolate operation */
353short wpntsv; /* waveshape point selection state variable */
354short wshmax; /* waveshape maximum value */
355short wvlast; /* last value for interpolate operation */
356short xkcount; /* cursor x key on count */
357short xkstat; /* cursor x key status */
358short xycntr; /* xy center for cursor pad */
359short ykcount; /* cursor y key on count */
360short ykstat; /* cursor y key status */
361
362short anrs[8][16]; /* analog variable resolution */
363short grp2prt[12][2]; /* group to port and channel table */
364short sctctab[10][64]; /* score background color table */
365short sigtab[128][2]; /* signals: [0] = value, [1] = switch */
366short tunlib[NTUNS][128]; /* tuning table library */
367short varmode[8][16]; /* analog variable record mode */
368short wsnmod[12][2]; /* waveshape number / data modified */
369
370struct EXFILE mphead; /* MIDAS-VII program header */
371struct fet *cfetp; /* current fet entry pointer */
372struct fet *curfet; /* current fet table pointer */
373struct fet *infetp; /* in-field fet pointer */
374struct gdsel *gdfsep; /* gdsel freechain pointer */
375struct instpnt *pntptr; /* pointer to edited point */
376struct mlibhdr ldhead; /* library header */
377struct nevent *nefree; /* pointer to free note entries */
378struct nevent *nelist; /* pointer to note entry list */
379struct octent *adoct; /* assignment display object control pointer */
380struct octent *ldoct; /* librarian object control table pointer */
381struct octent *mdoct; /* menu display object control table pointer */
382struct octent *tdoct; /* tuning display object control table pointer */
383struct octent *wdoct; /* object control table pointer */
384struct octent *idoct; /* instrument display octent pointer */
385struct pflent *pflist; /* pendant function list header */
386struct pflent *pfqhdr; /* pendant function list entry freechain header */
387struct s_entry *libsp; /* librarian score pointer */
388struct s_entry *peg; /* insert mode 'peg' to hang the tail on */
389struct s_entry *size1; /* score E_SIZE1 entry free list pointer */
390struct s_entry *size2; /* score E_SIZE2 entry free list pointer */
391struct s_entry *size3; /* score E_SIZE3 entry free list pointer */
392struct selbox *csbp; /* current select box table pointer */
393struct selbox *curboxp; /* current select box pointer */
394struct s_entry *p_bak; /* pointer to entry at left edge of display */
395struct s_entry *p_cbgn; /* pointer to start of copy */
396struct s_entry *p_cend; /* pointer to end of copy */
397struct s_entry *p_cur; /* pointer to entry at current execution time */
398struct s_entry *p_ctr; /* pointer to entry at center of display */
399struct s_entry *p_fwd; /* pointer to entry at right edge of display */
400struct n_entry *p_nbeg; /* pointer to note begin */
401struct n_entry *p_nend; /* pointer to note end */
402struct s_entry *p_sbgn; /* pointer to start of section */
403struct s_entry *p_sec1; /* pointer to start of 1st section */
404struct s_entry *p_sec2; /* pointer to start of 2nd section */
405struct s_entry *p_send; /* pointer to end of section */
406struct s_entry *scp; /* current score pointer */
407
408struct asgent asgtab[NASGS]; /* assignment table library */
409struct fcat filecat[FCMAX]; /* file catalog */
410struct gdsel *gdstbc[NGDSEL]; /* center group & event status lists */
411struct gdsel *gdstbn[NGDSEL]; /* right group & event status lists */
412struct gdsel *gdstbp[NGDSEL]; /* left group & event status lists */
413struct gdsel gdfsl[MAXFSL]; /* gdsel pool */
414struct instdef idefs[NINST]; /* current instrument definitions */
415struct n_entry *lstbgns[NLSTENTS]; /* last note begin entry table */
416struct n_entry *lstends[NLSTENTS]; /* last note end entry table */
417struct instdef vbufs[12]; /* voice instrument buffers */
418struct nevent nevents[NNEVTS]; /* note event list */
419struct pflent pfents[NPFENTS]; /* pendant function list entry pool */
420struct scndx sindex[N_SCORES]; /* score file table of contents */
421struct sment *vpsms[192]; /* voice parameter general S/M pointer table */
422struct sment sments[192]; /* source multiplier assignment table */
423struct valent valents[NGPSRS]; /* source value table */
424struct wstbl wslib[NUMWAVS]; /* waveshape library */
425struct s_entry *scores[N_SCORES]; /* Score pointer table */
426
427struct s_time stimes[N_SCORES][N_SECTS]; /* score section SMPTE times */
428struct s_entry *hplist[N_SCORES][N_TYPES]; /* Score change list pointers */
429struct s_entry *seclist[N_SCORES][N_SECTS]; /* Section pointer table */
430
431unsigned *asgob; /* assignment display object pointer */
432unsigned *consl; /* constant slice pointer */
433unsigned *cursl; /* current (center) slice pointer */
434unsigned *instob; /* instrument object pointer */
435unsigned *librob; /* librarian display object pointer */
436unsigned *menuob; /* menu display object pointer */
437unsigned *nxtsl; /* next (right edge) slice pointer */
438unsigned *obj0; /* object 0 VSDD RAM pointer */
439unsigned *obj1; /* object 1 VSDD RAM pointer */
440unsigned *obj2; /* object 2 VSDD RAM pointer */
441unsigned *obj3; /* object 3 VSDD RAM pointer */
442unsigned *obj4; /* object 4 VSDD RAM pointer */
443unsigned *obj5; /* object 5 VSDD RAM pointer */
444unsigned *obj6; /* object 6 VSDD RAM pointer */
445unsigned *obj7; /* object 7 VSDD RAM pointer */
446unsigned *obj8; /* object 8 VSDD RAM pointer */
447unsigned *obj9; /* object 9 VSDD RAM pointer */
448unsigned *obj10; /* object 10 VSDD RAM pointer */
449unsigned *obj11; /* object 11 VSDD RAM pointer */
450unsigned *obj12; /* object 12 VSDD RAM pointer */
451unsigned *obj13; /* object 13 VSDD RAM pointer */
452unsigned *obj14; /* object 14 VSDD RAM pointer */
453unsigned *obj15; /* object 15 VSDD RAM pointer */
454unsigned *prvsl; /* previous (left edge) slice pointer */
455unsigned *saddr; /* score VSDD RAM base pointer */
456unsigned *tunob; /* tuning table display object pointer */
457unsigned *vtobj; /* virtual typewriter display object pointer */
458unsigned *waveob; /* waveshape display object pointer */
459
460unsigned curintp; /* current interpolate time (FPU format) */
461unsigned scrl; /* score VSDD object scroll register image */
462unsigned vtbgval; /* virtual typewriter data background color */
463unsigned vtfgval; /* virtual typewriter data foreground color */
464
465unsigned dfbuf[4096]; /* track formatting buffer */
466unsigned slices[896]; /* score display slices */
467
468/*
469
470*/
471
472/* initialized variables */
473
474short debugsw = DEBUGVAL; /* debug output switch */
475
476short swback = SWBACK; /* scroll wheel look back count */
477short swthr = SWTHR; /* scroll wheel movement threshold */
478short swtime = SWTIME; /* scroll wheel timer scan time */
479short swwait = SWWAIT; /* scroll wheel wait count */
480
481short tkback = TKBACK; /* trackball FIFO look back count */
482short tkrmin = TKRMIN; /* trackball rate threshold */
483short tkthr = TKTHR; /* trackball movement threshold */
484short tktime = TKTIME; /* trackball timer scan time */
485short tkwait = TKWAIT; /* trackball wait count */
486
487short curhold = CURHOLD; /* cursor hold time */
488short hcwval = HCWVAL; /* graphics cursor X wait time */
489short thcwval = THCWVAL; /* text cursor H wait time */
490short tvcwval = TVCWVAL; /* text cursor V wait time */
491short vcwval = VCWVAL; /* graphics cursor Y wait time */
492
493/*
494
495*/
496
497short tmultab[] = { /* time multiplier table - indexed by voltage */
498
499 0xFFFF, 0xFAFA, 0xF627, 0xF182, 0xED09, /* 0 */
500 0xE8BA, 0xE492, 0xE08F, 0xDCB0, 0xD8F2, /* 5 */
501 0xD555, 0xD1D6, 0xCE73, 0xCB2C, 0xC800, /* 10 */
502 0xC4EC, 0xC1F0, 0xBF0B, 0xBC3C, 0xB981, /* 15 */
503 0xB6DB, 0xB448, 0xB1C7, 0xAF57, 0xACF9, /* 20 */
504 0xAAAA, 0xA86B, 0xA63B, 0xA41A, 0xA206, /* 25 */
505 0xA000, 0x9E06, 0x9C18, 0x9A37, 0x9861, /* 30 */
506 0x9696, 0x94D6, 0x9320, 0x9174, 0x8FD1, /* 35 */
507 0x8E38, 0x8CA8, 0x8B21, 0x89A2, 0x882B, /* 40 */
508 0x86BC, 0x8555, 0x83F5, 0x829C, 0x814A, /* 45 */
509 0x8000, 0x7EBB, 0x7D7D, 0x7C45, 0x7B13, /* 50 */
510 0x79E7, 0x78C1, 0x77A0, 0x7684, 0x756E, /* 55 */
511 0x745D, 0x7350, 0x7249, 0x7146, 0x7047, /* 60 */
512 0x6F4D, 0x6E58, 0x6D66, 0x6C79, 0x6B90, /* 65 */
513 0x6AAA, 0x69C8, 0x68EB, 0x6810, 0x6739, /* 70 */
514 0x6666, 0x6596, 0x64C9, 0x6400, 0x6339, /* 75 */
515 0x6276, 0x61B5, 0x60F8, 0x603D, 0x5F85, /* 80 */
516 0x5ED0, 0x5E1E, 0x5D6E, 0x5CC0, 0x5C16, /* 85 */
517 0x5B6D, 0x5AC7, 0x5A24, 0x5982, 0x58E3, /* 90 */
518 0x5846, 0x57AB, 0x5713, 0x567C, 0x55E7, /* 95 */
519 0x5555 /* 100 */
520};
521
522/*
523
524*/
525
526short crate0[] = { /* cursor rate table 1 */
527
528 0, 0, 0, 0, 0, 0, 0, 0, /* 0..7 */
529 0, 0, 0, 0, 1, 1, 1, 1, /* 8..15 */
530 1, 1, 1, 1, 1, 1, 1, 1, /* 16..23 */
531 1, 1, 1, 1, 1, 1, 1, 1, /* 24..31 */
532 1, 1, 1, 1, 1, 1, 1, 1, /* 32..39 */
533 1, 1, 1, 1, 1, 1, 1, 1, /* 40..47 */
534 1, 1, 1, 1, 1, 1, 1, 1, /* 48..55 */
535 1, 1, 1, 1, 1, 1, 1, 1 /* 56..63 */
536};
537
538short crate1[] = { /* cursor rate table 1 */
539
540 0, 0, 0, 0, 0, 0, 0, 0, /* 0..7 */
541 1, 1, 1, 1, 1, 1, 1, 1, /* 8..15 */
542 3, 3, 3, 3, 3, 3, 3, 3, /* 16..23 */
543 5, 5, 5, 5, 5, 5, 5, 5, /* 24..31 */
544 7, 7, 7, 7, 7, 7, 7, 7, /* 32..39 */
545 9, 9, 9, 9, 9, 9, 9, 9, /* 40..47 */
546 11, 11, 11, 11, 11, 11, 11, 11, /* 48..55 */
547 13, 13, 13, 13, 13, 13, 13, 13 /* 56..63 */
548};
549
550short crate2[] = { /* cursor rate table 2 */
551
552 0, 0, 0, 0, 0, 0, 0, 0, /* 0..7 */
553 1, 1, 1, 1, 1, 1, 1, 1, /* 8..15 */
554 2, 2, 2, 2, 2, 2, 2, 2, /* 16..23 */
555 4, 4, 4, 4, 8, 8, 8, 8, /* 24..31 */
556 16, 16, 16, 16, 32, 32, 32, 32, /* 32..39 */
557 64, 64, 64, 64,128,128,128,128, /* 40..47 */
558 96, 96, 96, 96,256,256,256,256, /* 48..55 */
559 256,256,256,256,256,256,256,256 /* 56..63 */
560};
561
562/*
563
564*/
565
566short loctab[9] = {
567
568 0, /* 0 - left */
569
570 125 << 5, /* 1 */
571 250 << 5, /* 2 */
572 375 << 5, /* 3 */
573
574 500 << 5, /* 4 - center */
575
576 625 << 5, /* 5 */
577 750 << 5, /* 6 */
578 875 << 5, /* 7 */
579
580 1000 << 5 /* 8 - right */
581};
582
583/*
584
585*/
586
587/*
588 =============================================================================
589 valof() -- return initial value of a source
590 =============================================================================
591*/
592
593short
594valof(srcv)
595short srcv;
596{
597 switch (srcv) {
598
599 case SM_NONE: /* -none- */
600 return(0);
601
602 case SM_RAND: /* Random */
603 return(xgetran(0));
604
605 case SM_CTL1: /* Ctl V1 */
606 return(SM_SCALE(sigtab[79][0]));
607
608 case SM_PTCH: /* Pitch */
609 case SM_KPRS: /* Key Prs */
610 case SM_KVEL: /* Key Vel */
611 return(0);
612
613 case SM_PED1: /* Pedal 1 */
614 return(SM_SCALE(sigtab[77][0]));
615
616 case SM_HTPW: /* Hor Tab / Pch Whl */
617 return(0);
618
619 case SM_VTMW: /* Vrt Tab / Mod Whl */
620 return(SM_SCALE(sigtab[54][0]));
621
622 case SM_LPBR: /* LongPot / Breath */
623 return(SM_SCALE(sigtab[57][0]));
624
625 default:
626 return(0);
627 }
628}
629
630/*
631
632*/
633
634/*
635 =============================================================================
636 inismtb() -- initialize source / multiplier data structures
637 =============================================================================
638*/
639
640inismtb()
641{
642 register short i, oldi;
643
644 oldi = setipl(FPU_DI);
645
646/* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
647
648 for (i = 0; i < NGPSRS; i++) {
649
650 valents[i].nxt = &valents[i];
651 valents[i].prv = &valents[i];
652 valents[i].val = valof(i & 0x000F);
653 }
654
655 for (i = 0; i < 192; i++) {
656
657 vpsms[i] = &sments[i];
658
659 sments[i].prv = (struct sment *)&valents[0];
660 sments[i].nxt = valents[0].nxt;
661
662 valents[0].nxt->prv = &sments[i];
663 valents[0].nxt = &sments[i];
664
665 sments[i].vp = i;
666 sments[i].sm = 0;
667 }
668
669 setipl(oldi);
670
671/* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
672
673}
674
675/*
676
677*/
678
679/*
680 =============================================================================
681 clrpfl() -- clear pendant function list
682 =============================================================================
683*/
684
685clrpfl()
686{
687 register short i;
688
689 memsetw(&pfents[0], 0, (NPFENTS * sizeof (struct pflent))/2);
690
691 for (i = 0; i < NPFENTS-1; i++)
692 pfents[i].nextpf = &pfents[i+1];
693
694 pfqhdr = &pfents[0];
695 pflist = (struct pflent *)NULL;
696}
697
698/*
699
700*/
701
702/*
703 =============================================================================
704 im700() -- initialize MIDAS 700
705 =============================================================================
706*/
707
708im700()
709{
710 register short i, j, k;
711 register char *ioadr;
712 register struct instdef *ip;
713
714 debugsw = DEBUGVAL; /* initialize debug switch */
715
716 GLCinit(); /* initialize the GLC */
717 GLCcurs(G_ON);
718 GLCtext(2, 1, "MIDAS 7 -- Initialization in progress -- Please stand by");
719 GLCcurs(G_OFF);
720
721 vsndpal(blakpal); /* setup the blackout palette */
722
723 VHinit(); /* clear the video hardware */
724 VSinit(); /* ... and the video software */
725
726 memset(keystat, 0, 24); /* clear front panel key status */
727 memset(trgtab, 0, NTRIGS); /* clear trigger status table */
728 memset(mctlval, 0, NCTRLS); /* clear MIDI controller values */
729
730 memsetw(grpmode, 0, 12); /* set all groups to PLAY */
731 memsetw(grpstat, GS_ENBL, 12); /* enable all groups for param. artic. */
732 memsetw(grpsel, TRUE, 12); /* enable all groups for instr. sel. */
733 memsetw(sigtab, 0, ((sizeof sigtab) / (sizeof sigtab[0][0])));
734
735 memsetw(veltab, SM_SCALE(64), NTRIGS); /* clear velocity table */
736 memsetw(lastvel, SM_SCALE(64), 12); /* clear last velocity table */
737 memsetw(prstab, 0, NTRIGS); /* clear pressure table */
738
739 curintp = tofpu(100); /* set default interpolate time */
740
741 angroup = -1; /* analog values: group 1, not shown */
742 ancmsw = FALSE; /* analog variable mode from grpmode */
743 velflag = FALSE; /* velocity not displayed */
744
745 dubsw = TRUE; /* set overdub mode */
746
747 sd = D_FWD; /* set display direction */
748 se = D_FWD; /* set execution direction */
749
750 swinit(); /* reset the scroll wheel variables */
751
752 inismtb(); /* clear the S/M data structures */
753 clrnl(); /* clear note entry lists */
754 clrpfl(); /* clear pendant function list */
755
756 lstbgnc = 0; /* reset last note begin count */
757 lstendc = 0; /* reset last note end count */
758 lstflag = TRUE; /* set end of note entry list flag */
759
760 memsetw(lstbgns, 0, (NLSTENTS << 1)); /* clear note begin list */
761 memsetw(lstends, 0, (NLSTENTS << 1)); /* clear note end list */
762
763 /* set funcndx[] entries */
764
765 for (i = 0; i < 12; i++) {
766
767 ip = &vbufs[i];
768
769 for (j = 0; j < NFINST; j++) {
770
771 k = (i << 4) + fnoff[j];
772
773 funcndx[k][0] = &ip->idhfnc[j];
774 funcndx[k][1] = ip->idhpnt;
775 }
776 }
777
778/*
779
780*/
781 for (i = 0; i < 3; i++) { /* reset the state machines */
782
783 msmstv[i] = 0; /* state = 0 */
784 mrstat[i] = 0; /* clear running status */
785 mdbyte[i] = 0; /* clear first byte buffer */
786 masens[i] = 0; /* clear active sensing */
787 }
788
789 for (i = 0; i < 48; i++) {
790
791 mpbend[i] = 0; /* clear bend values */
792 mpsust[i] = 0; /* clear sustain values */
793 }
794
795 for (i = 0; i < 12; i++) {
796
797 for (j = 0; j < 6; j++) {
798
799 varmode[j][i] = 0; /* set r/p mode */
800 anrs[j][i] = 4; /* set analog resolution */
801 }
802
803 setdyn(i, 6); /* set group dynamics */
804 setloc(i, 4); /* set group locations */
805 lastvce[i] = 0; /* clear last voice assigned */
806 vce2trg[i] = -1; /* clear voice to trigger table */
807 }
808
809 for (i = 0; i < NLTYPES; i++) {
810
811 memset(loadedc[i], ' ', 37);
812 memset(loadedf[i], ' ', 8);
813 }
814
815 memset(ldfile, ' ', 8); /* clear the library file name field */
816 ldfile[8] = '\0';
817
818 memset(ldcmnt, ' ', 37); /* clear the library comment field */
819 ldcmnt[37] = '\0';
820
821/*
822
823*/
824 xkcount = 1; /* reset cursor control variables */
825 ykcount = 1;
826 xycntr = XYCENTRE;
827
828 clksrc = CK_LOCAL; /* clock source = local */
829 clkctl = CK_LOCAL; /* clock control = local */
830 clkrun = FALSE; /* clock stopped */
831 midiclk = FALSE; /* ... */
832 pulsclk = FALSE; /* ... */
833 stepclk = FALSE; /* ... */
834 fc_sw = 0; /* stop the frame clock */
835 fc_val = 0L; /* ... and reset it */
836 scrlpot = 0; /* not scrolling */
837 tmpomlt = 50; /* initialize tempo multiplier */
838 io_leds = 0x18; /* ... and turn off the LEDs */
839 io_leds = 0x19; /* ... */
840 settmpo(60); /* set default tempo */
841
842 timemlt = tmultab[50]; /* initialize time scaling */
843 io_leds = 0x1A;
844 io_leds = 0x1B;
845
846 tuneval = 0; /* initialize fine tuning */
847 io_leds = 0x1C;
848 io_leds = 0x1D;
849
850 for (i = 0; i < 12; i++) /* setup default values for gtctab */
851 gtctab[i] = ((i+3) << 12) | ((i+3) << 8) | ((i+3) << 4) | (i+3);
852
853 editsw = FALSE; /* setup edit switch state */
854 io_leds = 0x1E;
855 ioadr = &io_ser + 2L;
856 editss = *ioadr & 0x0008;
857
858 ac_code = N_SHARP; /* default accidentals to display as sharps */
859
860 memsetw(articen, TRUE, 12); /* enable articulation for all voices */
861/*
862
863*/
864 curmove = cmvgen;
865 premove = nokey;
866 pstmove = nokey;
867 curtype = stdctp2;
868
869 x_key = nokey; /* setup default key processors */
870 e_key = nokey;
871 m_key = stdmkey;
872 d_key = nokey;
873
874 not_fld = nokey;
875
876 cx_key = cxkstd; /* setup default cursor processors */
877 cy_key = cykstd;
878 cx_upd = cxgen;
879 cy_upd = cygen;
880 xy_up = nokey;
881 xy_dn = nokey;
882
883 curslim = 349; /* cursor limit for graphics to text switch */
884
885 chtime = hcwval; /* initialize default cursor wait times */
886 cvtime = vcwval;
887 nchwait = curhold;
888 ncvwait = curhold;
889 chwait = 1;
890 cvwait = 1;
891
892 cratex = crate1; /* initialize default cursor x rate table */
893 cratey = crate1; /* initialize default cursor y rate table */
894
895 cmfirst = TRUE; /* setup for first motion of cursor */
896 cmtype = CT_GRAF;
897
898 cxval = XCTR; /* default cursor to center of screen */
899 cyval = YCTR;
900
901 stcrow = cyval / 14; /* keep text position in sync */
902 stccol = cxval / 8;
903
904 submenu = FALSE; /* no submenu up to start with */
905/*
906
907*/
908 curinst = 0; /* current instrument = 0 */
909 curfunc = 12; /* current function = 12 = level */
910 curvce = 0; /* current voice = 0 */
911
912 asmode = FALSE; /* deselect assignment mode */
913 gomode = GO_NULL; /* deselect go to mode */
914 ismode = IS_NULL; /* deselect instrument select mode */
915 pkctrl = PK_PFRM; /* select local performance key state */
916 oldpk = pkctrl; /* ... */
917 sliders = LS_PRMTR; /* setup the LCD display pots and switches */
918 oldsl = sliders; /* ... */
919 swpt = t_prmtr; /* ... */
920 oldsw = swpt; /* ... */
921 setleds(); /* set performance keyboard leds */
922
923 initpt(); /* initialize the patch table */
924 initsq(); /* initialize the sequence table */
925 initil(); /* initialize the instrument library */
926 iniwslb(); /* initialize the waveshape library */
927 inital(); /* initialize the assignment library */
928 inittl(); /* initialize the tuning table library */
929 scinit(); /* initialize the score */
930
931 clearer(1, 0); /* reset the fpu to its nominal values */
932 getasg(curasg = 0); /* setup default assignments */
933
934 lcdlbls(); /* put up the LCD display */
935 lampsw = FALSE; /* enable LCD timeout */
936}
Note: See TracBrowser for help on using the repository browser.