source: buchla-68k/ram/im700.c@ e225e77

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

Added missing includes and declarations.

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