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

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

Zero redundant declarations.

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