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

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

Added include files for global functions and variables.

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