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