source: buchla-68k/ram/ptdisp.c@ 60288f5

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