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

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

Prototypes for global function pointers. Consistent global types.

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