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