source: buchla-68k/orig/RAM/PTDISP.C@ 30c03a4

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

Imported original source code.

  • Property mode set to 100755
File size: 7.6 KB
Line 
1/*
2 =============================================================================
3 ptdisp.c -- MIDAS-VII Patch editor display functions
4 Version 32 -- 1989-11-16 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "stddefs.h"
9#include "hwdefs.h"
10#include "graphdef.h"
11#include "vsdd.h"
12#include "patch.h"
13
14#include "midas.h"
15#include "ptdisp.h"
16
17extern short LineBak(), LineFwd();
18
19extern short (*BakLine)(), (*FwdLine)();
20
21extern unsigned short pt_alc();
22
23extern unsigned short *obj8, *obj9, *obj10, *obj11;
24extern unsigned short *LineBuf, *ScObAdr, *OldLine;
25extern unsigned short LineAtr;
26
27extern short CurLine, CurScan;
28extern short ScrlObj, SmScNsl;
29extern short PdScDnF, PdScUpF;
30extern short ctcsw, submenu;
31extern short cxval;
32
33extern unsigned short cg3[];
34
35unsigned short seqflag[16]; /* sequence flags */
36unsigned short seqline[16]; /* current sequencer line */
37unsigned short seqstim[16]; /* sequence stimulus */
38unsigned short seqtime[16]; /* sequence timers */
39unsigned short sregval[16]; /* register values */
40unsigned short trstate[16]; /* trigger states */
41
42struct seqent seqtab[NSLINES]; /* sequence table */
43
44/*
45
46*/
47
48char pthead[] =
49
50 "\260 Definer p ch Stmulus p ch Destnation \275\276 Datum \260 No Seq Rg T \260";
51
52char *ptmcon[] = {
53
54 "\260 Key SeqLin Instr Index Level V Out Srce PchWh Pitch \260",
55 "\260 Rel SeqCtl Osc Freq Loctn Depth Mult ModWh Freq \260",
56 "\260 Trg Tuning WaveA Pitch Filtr Rate Time Breth KeyVl \260",
57 "\260 Pls RegSet WaveB Intvl Fil Q Inten Valu Pedal KeyPr \260",
58 "\260 LED RegAdd Confg Ratio Dynmc Aux Func GPC/V Randm \260"
59};
60
61short ptabpal[16][3] = { /* patch display palette */
62
63 {0, 0, 0}, /* 0 - black */
64 {2, 3, 3}, /* 1 - white */
65 {0, 0, 1}, /* 2 - dark blue #1 */
66 {2, 0, 2}, /* 3 - dark violet */
67 {0, 0, 3}, /* 4 - dark blue #2 */
68 {3, 0, 0}, /* 5 - red */
69 {3, 3, 0}, /* 6 - yellow */
70 {1, 2, 0}, /* 7 - dark green */
71 {0, 3, 3}, /* 8 - light blue */
72 {2, 2, 2}, /* 9 - gray */
73 {0, 3, 0}, /* 10 - light green */
74 {3, 1, 2}, /* 11 - light violet */
75 {0, 2, 3}, /* 12 - medium blue */
76 {2, 0, 0}, /* 13 - dark red */
77 {1, 1, 2}, /* 14 - electric purple */
78 {3, 3, 3} /* 15 - bright white */
79};
80
81/*
82
83*/
84
85/*
86 =============================================================================
87 ptwin() -- fill in a patch table display window
88 =============================================================================
89*/
90
91ptwin(n)
92short n;
93{
94 register short i, j;
95 short atrbuf[64];
96 char linbuf[66];
97
98 if (v_regs[5] & 0x0180)
99 vbank(0);
100
101 switch (n) {
102
103 case 0: /* headings and box outline */
104
105 /* row 0 */
106
107 memset(linbuf, '\261', 63);
108 linbuf[0] = '\272';
109 linbuf[48] = '\267';
110 linbuf[62] = '\273';
111 linbuf[63] = '\0';
112
113 memsetw(atrbuf, PTBATR, 63);
114 atrbuf[63] = 0x0000;
115
116 vputsa(obj8, 0, 0, linbuf, atrbuf);
117
118 /* row 1 */
119
120 memsetw(atrbuf, PTHATR+0x0100, 64);
121 atrbuf[0] = PTBATR;
122 atrbuf[1] = PTHATR;
123 atrbuf[14] = PTHATR;
124 atrbuf[27] = PTHATR;
125 atrbuf[41] = PTHATR;
126 atrbuf[47] = PTHATR;
127 atrbuf[48] = PTBATR;
128 atrbuf[49] = PTHATR;
129 atrbuf[52] = PTHATR;
130 atrbuf[56] = PTHATR;
131 atrbuf[59] = PTHATR;
132 atrbuf[61] = PTHATR;
133 atrbuf[62] = PTBATR;
134 atrbuf[63] = 0x0000;
135
136 vputsa(obj8, 1, 0, pthead, atrbuf);
137/*
138
139*/
140 /* row 18 */
141
142 memset(linbuf, '\261', 63);
143 linbuf[0] = '\266';
144 linbuf[48] = '\265';
145 linbuf[62] = '\264';
146 linbuf[63] = '\0';
147
148 memsetw(atrbuf, PTBATR, 63);
149 atrbuf[63] = 0x0000;
150
151 vputsa(obj11, 0, 0, linbuf, atrbuf);
152
153 /* row 24 */
154
155 memset(linbuf, '\261', 63);
156 linbuf[0] = '\271';
157 linbuf[62] = '\270';
158 linbuf[63] = '\0';
159
160 memsetw(atrbuf, PTBATR, 63);
161 atrbuf[63] = 0x0000;
162
163 vputsa(obj11, 6, 0, linbuf, atrbuf);
164
165 break;
166/*
167
168*/
169 case 1: /* patches */
170
171 SetDTop(0, 13);
172
173 for (i = 0; i < 16; i++) {
174
175 for (j = 0; j < 47; j++)
176 linbuf[j] = ' ';
177
178 linbuf[47] = '\0';
179
180 UpdVid(i, 0, "\260", PTBATR);
181
182 UpdVid(i, 1, linbuf,
183 (i EQ 7) ? PTEATR : PTPATR);
184 }
185
186 dptw();
187
188 break;
189/*
190
191*/
192 case 2: /* sequence status */
193
194 for (i = 0; i < 16; i++) {
195
196 sprintf(linbuf, " %03d %02d %d ",
197 seqline[i], sregval[i], trstate[i]);
198
199 vvputsv(obj10, 16, PDBORFG, PDSEQBG,
200 i, 0, "\260", 14, 14, cg3);
201
202 vvputsv(obj10, 16, PDSEQFG, PDSEQBG,
203 i, 1, linbuf, 14, 14, cg3);
204
205 vvputsv(obj10, 16, PDBORFG, PDSEQBG,
206 i, 14, "\260", 14, 14, cg3);
207
208 if (i EQ 7) {
209
210 if (48 EQ XTOC(cxval)) {
211
212 vsplot4(obj10, 16, PDPTRFG,
213 i, 0, "\277", 14, 14, cg3);
214
215 } else {
216
217 vsplot4(obj10, 16, PDPTRFG,
218 i, 0, "\274", 14, 14, cg3);
219 }
220 }
221
222 sprintf(linbuf, "%02d", i + 1);
223
224 vvputsv(obj10, 16,
225 (seqflag[i] & SQF_RUN) ? PDSEQRN : PDSEQFG, PDSEQBG,
226 i, 2, linbuf, 14, 14, cg3);
227 }
228
229 break;
230
231 case 3: /* menu */
232
233 memsetw(atrbuf, PTMATR, 64);
234 atrbuf[0] = PTBATR;
235 atrbuf[62] = PTBATR;
236 atrbuf[63] = 0x0000;
237
238 for (i = 0; i < 5; i++)
239 vputsa(obj11, (i + 1), 0, ptmcon[i], atrbuf);
240
241 break;
242 }
243}
244
245/*
246
247*/
248
249/*
250 =============================================================================
251 ptwins() -- draw the patch table display
252 =============================================================================
253*/
254
255ptwins()
256{
257 register short i;
258
259 for (i = 0; i < 4; i++)
260 ptwin(i);
261}
262
263/*
264 =============================================================================
265 ptdisp() -- setup the patch table display
266 =============================================================================
267*/
268
269ptdisp()
270{
271 dswap(); /* clear the video display */
272
273 BakLine = LineBak;
274 FwdLine = LineFwd;
275
276 /* setup object pointers */
277
278 obj8 = &v_score[OB08LOC]; /* 8 - headings */
279 obj9 = &v_score[OB09LOC]; /* 9 - patches */
280 obj10 = &v_score[OB10LOC]; /* 10 - status */
281 obj11 = &v_score[OB11LOC]; /* 11 - menu */
282
283 ScrlObj = 9;
284 ScObAdr = obj9;
285 LineBuf = obj9;
286 OldLine = (unsigned short *)NULL;
287 LineAtr = PTPATR;
288
289 CurLine = 0;
290 CurScan = 13;
291
292 PdScDnF = FALSE;
293 PdScUpF = FALSE;
294
295 /* ---------------- initialize object table -------------------- */
296 /* obj, typ, bnk, base, xpix, ypix, x0, y0, flags, pri */
297
298 SetObj( 8, 1, 0, obj8, 512, 28, 0, 0, PDFL_08, -1);
299 SetObj( 9, 1, 0, obj9, 384, 224, 0, 28, PDFL_09, -1);
300 SetObj( 10, 0, 0, obj10, 128, 224, 384, 28, PDFL_10, -1);
301 SetObj( 11, 1, 0, obj11, 512, 98, 0, 252, PDFL_11, -1);
302
303 if (v_regs[5] & 0x0180)
304 vbank(0);
305
306 memsetw(v_score, 0, 32767); /* clear display objects */
307 memsetw(v_score+32767L, 0, 24577);
308
309 voidpb(); /* void the patch buffer */
310 ptwins(); /* fill up the windows */
311
312/*
313
314*/
315 /* display some objects */
316
317 SetPri( 8, 8); /* headings */
318 SetPri( 9, 9); /* patches */
319 SetPri(10, 10); /* sequence status */
320 SetPri(11, 11); /* menu */
321
322 if (v_regs[5] & 0x0180) /* select bank 0 */
323 vbank(0);
324
325 memcpyw(v_cgtab, cg3, 3584); /* setup character generator */
326 v_regs[1] = (v_regs[1] & 0x0FFF) | 0xE000;
327
328 /* fix the initial scan line specs in the object descriptor table */
329
330 v_odtab[ 8][0] = (v_odtab[ 8][0] & 0x0FFF) | 0xD000;
331 v_odtab[ 9][0] = (v_odtab[ 9][0] & 0x0FFF) | 0xD000;
332
333 v_odtab[11][0] = (v_odtab[11][0] & 0x0FFF) | 0xD000;
334
335 submenu = FALSE;
336
337 ctcsw = TRUE; /* enable cursor */
338 ctcpos(DATAROW, 2); /* set initial cursor */
339 aftercm(); /* set initial submenu */
340
341 vsndpal(ptabpal); /* set the palette */
342}
Note: See TracBrowser for help on using the repository browser.