1 | /*
|
---|
2 | =============================================================================
|
---|
3 | sqdisp.c -- MIDAS-VII sequence editor display functions
|
---|
4 | Version 24 -- 1989-11-16 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #define DEBUGSQ 0
|
---|
9 |
|
---|
10 | #include "stddefs.h"
|
---|
11 | #include "hwdefs.h"
|
---|
12 | #include "graphdef.h"
|
---|
13 | #include "vsdd.h"
|
---|
14 | #include "patch.h"
|
---|
15 |
|
---|
16 | #include "midas.h"
|
---|
17 | #include "ptdisp.h"
|
---|
18 |
|
---|
19 | #include "memory.h"
|
---|
20 | #include "stdio.h"
|
---|
21 | #include "strings.h"
|
---|
22 | #include "vsddsw.h"
|
---|
23 |
|
---|
24 | #if DEBUGSQ
|
---|
25 | extern short debugsw;
|
---|
26 |
|
---|
27 | short debugsq = 1;
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | extern void nokey(void);
|
---|
31 |
|
---|
32 | extern void SetDTop(int16_t row, int16_t scan);
|
---|
33 | extern void UpdVid(int16_t row, int16_t col, int8_t *str, uint16_t atr);
|
---|
34 | extern void ctcon(void);
|
---|
35 | extern void ctcpos(int16_t row, int16_t col);
|
---|
36 | extern void dswap(void);
|
---|
37 | extern void postcm(void);
|
---|
38 | extern void seq2buf(void);
|
---|
39 | extern void vsndpal(int16_t pp[16][3]);
|
---|
40 | 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]);
|
---|
41 | 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]);
|
---|
42 |
|
---|
43 | extern int8_t *(*BakLine)(void);
|
---|
44 | extern int8_t *(*FwdLine)(void);
|
---|
45 |
|
---|
46 | extern uint16_t *obj8, *obj9, *obj10, *obj11;
|
---|
47 | extern uint16_t *LineBuf, *ScObAdr, *OldLine;
|
---|
48 | extern uint16_t LineAtr;
|
---|
49 |
|
---|
50 | extern int16_t CurLine, CurScan;
|
---|
51 | extern int16_t ScrlObj, SmScNsl;
|
---|
52 | extern int16_t PdScDnF, PdScUpF;
|
---|
53 | extern int16_t ctcsw, submenu;
|
---|
54 | extern int16_t stccol, stcrow;
|
---|
55 | extern int16_t cxval;
|
---|
56 |
|
---|
57 | extern int16_t cg3[][256];
|
---|
58 |
|
---|
59 | extern int8_t TheBuf[]; /* display build buffer */
|
---|
60 |
|
---|
61 | int16_t curslin; /* current sequence line */
|
---|
62 |
|
---|
63 | /* |
---|
64 |
|
---|
65 | */
|
---|
66 |
|
---|
67 | int8_t sqhead[] =
|
---|
68 |
|
---|
69 | "\260 Lin Time Action 1 Action 2 Action 3 \260 No Seq Rg T \260";
|
---|
70 |
|
---|
71 | int8_t *sqmcon[] = {
|
---|
72 |
|
---|
73 | "\260 Key transient Trigger on Stop Set reg Value \260",
|
---|
74 | "\260 Key closure Trigger off Jump to lin Inc Reg Register \260",
|
---|
75 | "\260 Key release Trig toggle If reg = Voltage \260",
|
---|
76 | "\260 If key active If trig act If stim act If reg < Random \260",
|
---|
77 | "\260 If reg > \260"
|
---|
78 | };
|
---|
79 |
|
---|
80 | int16_t seqpal[16][3] = { /* sequence display palette */
|
---|
81 |
|
---|
82 | {0, 0, 0}, /* 0 - black */
|
---|
83 | {2, 3, 3}, /* 1 - white */
|
---|
84 | {0, 0, 1}, /* 2 - dark blue #1 */
|
---|
85 | {2, 0, 2}, /* 3 - dark violet */
|
---|
86 | {0, 0, 3}, /* 4 - dark blue #2 */
|
---|
87 | {3, 0, 0}, /* 5 - red */
|
---|
88 | {3, 3, 0}, /* 6 - yellow */
|
---|
89 | {1, 2, 0}, /* 7 - dark green */
|
---|
90 | {0, 3, 3}, /* 8 - light blue */
|
---|
91 | {2, 2, 2}, /* 9 - gray */
|
---|
92 | {0, 3, 0}, /* 10 - light green */
|
---|
93 | {3, 1, 2}, /* 11 - light violet */
|
---|
94 | {0, 2, 3}, /* 12 - medium blue */
|
---|
95 | {2, 0, 0}, /* 13 - dark red */
|
---|
96 | {1, 1, 2}, /* 14 - electric purple */
|
---|
97 | {3, 3, 3} /* 15 - bright white */
|
---|
98 | };
|
---|
99 |
|
---|
100 | /* |
---|
101 |
|
---|
102 | */
|
---|
103 |
|
---|
104 | int16_t sqatype[] = { /* sequence action types by box number */
|
---|
105 |
|
---|
106 | SQ_NULL, /* " " 0 */
|
---|
107 | SQ_TKEY, /* "Kt 001 1 01" 1 */
|
---|
108 | SQ_CKEY, /* "Kc 001 1 01" 2 */
|
---|
109 | SQ_RKEY, /* "Kr 001 1 01" 3 */
|
---|
110 | SQ_IKEY, /* "If 001 1 01" 4 */
|
---|
111 | SQ_STRG, /* "Trig on 01" 5 */
|
---|
112 | SQ_CTRG, /* "Trig off 01" 6 */
|
---|
113 | SQ_TTRG, /* "Trig tgl 01" 7 */
|
---|
114 | SQ_ITRG, /* "If trig act" 8 */
|
---|
115 | SQ_STOP, /* "Stop " 9 */
|
---|
116 | SQ_JUMP, /* "Jump to 000" 10 */
|
---|
117 | SQ_NULL, /* "???????????" 11 */
|
---|
118 | SQ_ISTM, /* "If stim act" 12 */
|
---|
119 | SQ_SREG, /* "Set R01=00 " 13 */
|
---|
120 | SQ_AREG, /* "Inc R01+00 " 14 */
|
---|
121 | SQ_IREQ, /* "If R01=00 " 15 */
|
---|
122 | SQ_IRLT, /* "If R01<00 " 16 */
|
---|
123 | SQ_IRGT /* "If R01>00 " 17 */
|
---|
124 | };
|
---|
125 |
|
---|
126 | /* |
---|
127 |
|
---|
128 | */
|
---|
129 |
|
---|
130 | int8_t *sqdsptb[] = { /* sequence action display strings by action */
|
---|
131 |
|
---|
132 | " ", /* SQ_NULL 0x0000 null action */
|
---|
133 | "Kc 001 1 01", /* SQ_CKEY 0x0001 Key closure */
|
---|
134 | "Kr 001 1 01", /* SQ_RKEY 0x0002 Key release */
|
---|
135 | "Kt 001 1 01", /* SQ_TKEY 0x0003 Key transient */
|
---|
136 | "If 001 1 01", /* SQ_IKEY 0x0004 If key active */
|
---|
137 | "Trig on 01", /* SQ_STRG 0x0005 Trigger on */
|
---|
138 | "Trig off 01", /* SQ_CTRG 0x0006 Trigger off */
|
---|
139 | "Trig tgl 01", /* SQ_TTRG 0x0007 Trigger toggle */
|
---|
140 | "If trig 01", /* SQ_ITRG 0x0008 If trigger active */
|
---|
141 | "Set R01=00 ", /* SQ_SREG 0x0009 Set register */
|
---|
142 | "If R01=00 ", /* SQ_IREQ 0x000A If register = */
|
---|
143 | "If R01<00 ", /* SQ_IRLT 0x000B If register < */
|
---|
144 | "If R01>00 ", /* SQ_IRGT 0x000C If register > */
|
---|
145 | "If stim act", /* SQ_ISTM 0x000D If stimulus active */
|
---|
146 | "Jump to 000", /* SQ_JUMP 0x000E Jump to sequence line */
|
---|
147 | "Stop ", /* SQ_STOP 0x000F Stop sequence */
|
---|
148 | "Inc R01+00 " /* SQ_AREG 0x0010 Increment register */
|
---|
149 | };
|
---|
150 |
|
---|
151 | /* |
---|
152 |
|
---|
153 | */
|
---|
154 |
|
---|
155 | /*
|
---|
156 | =============================================================================
|
---|
157 | initsq() -- initialize the sequence data structures
|
---|
158 | =============================================================================
|
---|
159 | */
|
---|
160 |
|
---|
161 | void initsq(void)
|
---|
162 | {
|
---|
163 | register int16_t i;
|
---|
164 |
|
---|
165 | for (i = 0; i < 16; i++) {
|
---|
166 |
|
---|
167 | seqflag[i] = 0;
|
---|
168 | seqline[i] = 0;
|
---|
169 | sregval[i] = 0;
|
---|
170 | trstate[i] = 0;
|
---|
171 | seqstim[i] = 0;
|
---|
172 | seqtime[i] = 0;
|
---|
173 | }
|
---|
174 |
|
---|
175 | memsetw(&seqtab, 0, (NSEQW * NSLINES));
|
---|
176 | }
|
---|
177 |
|
---|
178 | /* |
---|
179 |
|
---|
180 | */
|
---|
181 |
|
---|
182 | /*
|
---|
183 | =============================================================================
|
---|
184 | dsact() -- convert sequence action code and data to display format
|
---|
185 | =============================================================================
|
---|
186 | */
|
---|
187 |
|
---|
188 | void dsact(int8_t *buf, uint16_t act, uint16_t dat)
|
---|
189 | {
|
---|
190 | uint16_t sqa, sqd, sqf, sqr, sqt, t1, t2, val;
|
---|
191 | uint16_t chan, i, key, port;
|
---|
192 |
|
---|
193 | sqa = SQ_MACT & act;
|
---|
194 |
|
---|
195 | strcpy(buf, sqdsptb[sqa]);
|
---|
196 |
|
---|
197 | switch (sqa) {
|
---|
198 |
|
---|
199 | case SQ_CKEY: /* Key closure */
|
---|
200 | case SQ_RKEY: /* Key release */
|
---|
201 | case SQ_TKEY: /* Key transient */
|
---|
202 | case SQ_IKEY: /* If key active */
|
---|
203 |
|
---|
204 | port = 0x0003 & (dat >> 11);
|
---|
205 | chan = 0x000F & (dat >> 7);
|
---|
206 | key = 0x007F & dat;
|
---|
207 |
|
---|
208 | if (port EQ 2)
|
---|
209 | sprintf(&buf[3], "%03u L ", 1 + key);
|
---|
210 | else
|
---|
211 | sprintf(&buf[3], "%03u %u %02u", 1 + key, 1 + port, 1 + chan);
|
---|
212 |
|
---|
213 | break;
|
---|
214 |
|
---|
215 | case SQ_STRG: /* Trigger on */
|
---|
216 | case SQ_CTRG: /* Trigger off */
|
---|
217 | case SQ_TTRG: /* Trigger toggle */
|
---|
218 | case SQ_ITRG: /* If trigger active */
|
---|
219 |
|
---|
220 | sprintf(&buf[9], "%02u", 1 + dat);
|
---|
221 | break;
|
---|
222 | /* |
---|
223 |
|
---|
224 | */
|
---|
225 | case SQ_AREG: /* Increment register */
|
---|
226 |
|
---|
227 | sqf = (dat & SQ_MFLG) ? '-' : '+';
|
---|
228 | goto doval;
|
---|
229 |
|
---|
230 | case SQ_SREG: /* Set register */
|
---|
231 | case SQ_IREQ: /* If register = */
|
---|
232 |
|
---|
233 | sqf = '=';
|
---|
234 | goto doval;
|
---|
235 |
|
---|
236 | case SQ_IRLT: /* If register < */
|
---|
237 |
|
---|
238 | sqf = '<';
|
---|
239 | goto doval;
|
---|
240 |
|
---|
241 | case SQ_IRGT: /* If register > */
|
---|
242 |
|
---|
243 | sqf = '>';
|
---|
244 |
|
---|
245 | doval:
|
---|
246 |
|
---|
247 | sqr = 1 + ((SQ_MOBJ & act) >> 8);
|
---|
248 | sqd = SQ_MVAL & dat;
|
---|
249 | sqt = SQ_MTYP & dat;
|
---|
250 |
|
---|
251 | switch (sqt) {
|
---|
252 |
|
---|
253 | case SQ_REG: /* register */
|
---|
254 |
|
---|
255 | sprintf(&buf[4], "R%02u%cR%02u", sqr, sqf, 1 + sqd);
|
---|
256 | break;
|
---|
257 |
|
---|
258 | case SQ_VAL: /* value */
|
---|
259 |
|
---|
260 | sprintf(&buf[4], "R%02u%c%02u ", sqr, sqf, sqd);
|
---|
261 | break;
|
---|
262 |
|
---|
263 | case SQ_VLT: /* voltage */
|
---|
264 |
|
---|
265 | sprintf(&buf[4], "R%02u%cV%u ", sqr, sqf, 1 + sqd);
|
---|
266 | break;
|
---|
267 |
|
---|
268 | case SQ_RND: /* random */
|
---|
269 |
|
---|
270 | sprintf(&buf[4], "R%02u%c?%u ", sqr, sqf, sqd);
|
---|
271 | break;
|
---|
272 | }
|
---|
273 |
|
---|
274 | break;
|
---|
275 | /* |
---|
276 |
|
---|
277 | */
|
---|
278 | case SQ_JUMP: /* Jump to sequence line */
|
---|
279 |
|
---|
280 | sprintf(&buf[8], "%03u", dat);
|
---|
281 | break;
|
---|
282 |
|
---|
283 | case SQ_NULL: /* null action */
|
---|
284 | case SQ_ISTM: /* If stimulus active */
|
---|
285 | case SQ_STOP: /* Stop sequence */
|
---|
286 |
|
---|
287 | break;
|
---|
288 | }
|
---|
289 |
|
---|
290 | for (i = 0; i < 12; i++)
|
---|
291 | if (buf[i] EQ '\0')
|
---|
292 | buf[i] = ' ';
|
---|
293 | }
|
---|
294 |
|
---|
295 | /* |
---|
296 |
|
---|
297 | */
|
---|
298 |
|
---|
299 | /*
|
---|
300 | =============================================================================
|
---|
301 | dsqlin() -- convert a sequence line to display format
|
---|
302 | =============================================================================
|
---|
303 | */
|
---|
304 |
|
---|
305 | void dsqlin(int8_t *buf, int16_t slin)
|
---|
306 | {
|
---|
307 | register struct seqent *sp;
|
---|
308 | register int16_t i, t1, t2;
|
---|
309 |
|
---|
310 | sp = &seqtab[slin];
|
---|
311 |
|
---|
312 | t1 = sp->seqtime / 100;
|
---|
313 | t2 = sp->seqtime - (t1 * 100);
|
---|
314 |
|
---|
315 | sprintf(buf, " %03u %02u.%02u", slin, t1, t2);
|
---|
316 |
|
---|
317 | dsact(&buf[12], sp->seqact1, sp->seqdat1);
|
---|
318 | dsact(&buf[24], sp->seqact2, sp->seqdat2);
|
---|
319 | dsact(&buf[36], sp->seqact3, sp->seqdat3);
|
---|
320 |
|
---|
321 | buf[0] = '\260';
|
---|
322 |
|
---|
323 | for (i = 0; i < 48; i++)
|
---|
324 | if (buf[i] EQ '\0')
|
---|
325 | buf[i] = ' ';
|
---|
326 |
|
---|
327 | buf[48] = '\0';
|
---|
328 | }
|
---|
329 |
|
---|
330 | /* |
---|
331 |
|
---|
332 | */
|
---|
333 |
|
---|
334 | /*
|
---|
335 | =============================================================================
|
---|
336 | dcursq() -- display current sequence line
|
---|
337 | =============================================================================
|
---|
338 | */
|
---|
339 |
|
---|
340 | void dcursq(void)
|
---|
341 | {
|
---|
342 | dsqlin(TheBuf, curslin);
|
---|
343 | UpdVid(7, 0, TheBuf, PTEATR);
|
---|
344 | ctcon();
|
---|
345 | }
|
---|
346 |
|
---|
347 | /*
|
---|
348 | =============================================================================
|
---|
349 | dstw() -- display sequence table window around current sequence line
|
---|
350 | =============================================================================
|
---|
351 | */
|
---|
352 |
|
---|
353 | void dstw(void)
|
---|
354 | {
|
---|
355 | register int16_t slin, srow;
|
---|
356 |
|
---|
357 | slin = curslin - 7;
|
---|
358 |
|
---|
359 | if (slin < 0)
|
---|
360 | slin += NSLINES;
|
---|
361 |
|
---|
362 | for (srow = 0; srow < 16; srow++) {
|
---|
363 |
|
---|
364 | dsqlin(TheBuf, slin);
|
---|
365 | UpdVid(srow, 0, TheBuf, (srow EQ 7) ? PTEATR : PTPATR);
|
---|
366 |
|
---|
367 | if (++slin GE NSLINES)
|
---|
368 | slin -= NSLINES;
|
---|
369 | }
|
---|
370 |
|
---|
371 | seq2buf();
|
---|
372 | ctcon();
|
---|
373 | }
|
---|
374 |
|
---|
375 | /* |
---|
376 |
|
---|
377 | */
|
---|
378 |
|
---|
379 | /*
|
---|
380 | =============================================================================
|
---|
381 | sqwin() -- fill in a sequence display window
|
---|
382 | =============================================================================
|
---|
383 | */
|
---|
384 |
|
---|
385 | void sqwin(int16_t n)
|
---|
386 | {
|
---|
387 | register int16_t i, j;
|
---|
388 | int16_t atrbuf[64];
|
---|
389 | int8_t linbuf[66];
|
---|
390 |
|
---|
391 | if (v_regs[5] & 0x0180)
|
---|
392 | vbank(0);
|
---|
393 |
|
---|
394 | switch (n) {
|
---|
395 |
|
---|
396 | case 0: /* headings and box outline */
|
---|
397 |
|
---|
398 | /* row 0 */
|
---|
399 |
|
---|
400 | memset(linbuf, '\261', 63);
|
---|
401 | linbuf[0] = '\272';
|
---|
402 | linbuf[48] = '\267';
|
---|
403 | linbuf[62] = '\273';
|
---|
404 | linbuf[63] = '\0';
|
---|
405 |
|
---|
406 | memsetw(atrbuf, PTBATR, 63);
|
---|
407 | atrbuf[63] = 0x0000;
|
---|
408 |
|
---|
409 | vputsa(obj8, 0, 0, linbuf, atrbuf);
|
---|
410 |
|
---|
411 | /* row 1 */
|
---|
412 |
|
---|
413 | memsetw(atrbuf, PTHATR+0x0100, 64);
|
---|
414 | atrbuf[ 0] = PTBATR;
|
---|
415 | atrbuf[ 1] = PTHATR;
|
---|
416 | atrbuf[ 5] = PTHATR;
|
---|
417 | atrbuf[11] = PTHATR;
|
---|
418 | atrbuf[23] = PTHATR;
|
---|
419 | atrbuf[35] = PTHATR;
|
---|
420 | atrbuf[47] = PTHATR;
|
---|
421 | atrbuf[48] = PTBATR;
|
---|
422 | atrbuf[49] = PTHATR;
|
---|
423 | atrbuf[52] = PTHATR;
|
---|
424 | atrbuf[56] = PTHATR;
|
---|
425 | atrbuf[59] = PTHATR;
|
---|
426 | atrbuf[61] = PTHATR;
|
---|
427 | atrbuf[62] = PTBATR;
|
---|
428 | atrbuf[63] = 0x0000;
|
---|
429 |
|
---|
430 | vputsa(obj8, 1, 0, sqhead, atrbuf);
|
---|
431 | /* |
---|
432 |
|
---|
433 | */
|
---|
434 | /* row 18 */
|
---|
435 |
|
---|
436 | memset(linbuf, '\261', 63);
|
---|
437 | linbuf[ 0] = '\266';
|
---|
438 | linbuf[48] = '\265';
|
---|
439 | linbuf[62] = '\264';
|
---|
440 | linbuf[63] = '\0';
|
---|
441 |
|
---|
442 | memsetw(atrbuf, PTBATR, 63);
|
---|
443 | atrbuf[63] = 0x0000;
|
---|
444 |
|
---|
445 | vputsa(obj11, 0, 0, linbuf, atrbuf);
|
---|
446 |
|
---|
447 | /* row 24 */
|
---|
448 |
|
---|
449 | memset(linbuf, '\261', 63);
|
---|
450 | linbuf[ 0] = '\271';
|
---|
451 | linbuf[62] = '\270';
|
---|
452 | linbuf[63] = '\0';
|
---|
453 |
|
---|
454 | memsetw(atrbuf, PTBATR, 63);
|
---|
455 | atrbuf[63] = 0x0000;
|
---|
456 |
|
---|
457 | vputsa(obj11, 6, 0, linbuf, atrbuf);
|
---|
458 |
|
---|
459 | break;
|
---|
460 | /* |
---|
461 |
|
---|
462 | */
|
---|
463 | case 1: /* sequences */
|
---|
464 |
|
---|
465 | SetDTop(0, 13);
|
---|
466 | dstw();
|
---|
467 | break;
|
---|
468 |
|
---|
469 | case 2: /* sequence status */
|
---|
470 |
|
---|
471 | for (i = 0; i < 16; i++) {
|
---|
472 |
|
---|
473 | sprintf(linbuf, " %03d %02d %d ",
|
---|
474 | seqline[i], sregval[i], trstate[i]);
|
---|
475 |
|
---|
476 | vvputsv(obj10, 16, PDBORFG, PDSEQBG,
|
---|
477 | i, 0, "\260", 14, 14, cg3);
|
---|
478 |
|
---|
479 | vvputsv(obj10, 16, PDSEQFG, PDSEQBG,
|
---|
480 | i, 1, linbuf, 14, 14, cg3);
|
---|
481 |
|
---|
482 | vvputsv(obj10, 16, PDBORFG, PDSEQBG,
|
---|
483 | i, 14, "\260", 14, 14, cg3);
|
---|
484 |
|
---|
485 | if (i EQ 7) {
|
---|
486 |
|
---|
487 | if (48 EQ XTOC(cxval)) {
|
---|
488 |
|
---|
489 | vsplot4(obj10, 16, PDPTRFG,
|
---|
490 | i, 0, "\277", 14, 14, cg3);
|
---|
491 |
|
---|
492 | } else {
|
---|
493 |
|
---|
494 | vsplot4(obj10, 16, PDPTRFG,
|
---|
495 | i, 0, "\274", 14, 14, cg3);
|
---|
496 | }
|
---|
497 | }
|
---|
498 |
|
---|
499 | sprintf(linbuf, "%02d", i + 1);
|
---|
500 |
|
---|
501 | vvputsv(obj10, 16,
|
---|
502 | (seqflag[i] & SQF_RUN) ? PDSEQRN : PDSEQFG, PDSEQBG,
|
---|
503 | i, 2, linbuf, 14, 14, cg3);
|
---|
504 | }
|
---|
505 |
|
---|
506 | break;
|
---|
507 |
|
---|
508 | case 3: /* menu */
|
---|
509 |
|
---|
510 | memsetw(atrbuf, PTMATR, 64);
|
---|
511 | atrbuf[0] = PTBATR;
|
---|
512 | atrbuf[62] = PTBATR;
|
---|
513 | atrbuf[63] = 0x0000;
|
---|
514 |
|
---|
515 | for (i = 0; i < 5; i++)
|
---|
516 | vputsa(obj11, (i + 1), 0, sqmcon[i], atrbuf);
|
---|
517 |
|
---|
518 | break;
|
---|
519 | }
|
---|
520 | }
|
---|
521 |
|
---|
522 | /* |
---|
523 |
|
---|
524 | */
|
---|
525 |
|
---|
526 | /*
|
---|
527 | =============================================================================
|
---|
528 | SqBakLn() -- return the next sequence line in the backward direction
|
---|
529 | =============================================================================
|
---|
530 | */
|
---|
531 |
|
---|
532 | int8_t *SqBakLn(void)
|
---|
533 | {
|
---|
534 | register int16_t slin;
|
---|
535 |
|
---|
536 | if (--curslin < 0)
|
---|
537 | curslin += NSLINES;
|
---|
538 |
|
---|
539 | slin = curslin - 7;
|
---|
540 |
|
---|
541 | if (slin < 0)
|
---|
542 | slin += NSLINES;
|
---|
543 |
|
---|
544 | dsqlin(TheBuf, slin);
|
---|
545 | return(TheBuf);
|
---|
546 | }
|
---|
547 |
|
---|
548 | /* |
---|
549 |
|
---|
550 | */
|
---|
551 |
|
---|
552 | /*
|
---|
553 | =============================================================================
|
---|
554 | SqFwdLn() -- return the next sequence line in the forward direction
|
---|
555 | =============================================================================
|
---|
556 | */
|
---|
557 |
|
---|
558 | int8_t *SqFwdLn(void)
|
---|
559 | {
|
---|
560 | register int16_t slin;
|
---|
561 |
|
---|
562 | if (++curslin GE NSLINES)
|
---|
563 | curslin -= NSLINES;
|
---|
564 |
|
---|
565 | slin = curslin + 8;
|
---|
566 |
|
---|
567 | if (slin GE NSLINES)
|
---|
568 | slin -= NSLINES;
|
---|
569 |
|
---|
570 | dsqlin(TheBuf, slin);
|
---|
571 | return(TheBuf);
|
---|
572 | }
|
---|
573 |
|
---|
574 | /*
|
---|
575 | =============================================================================
|
---|
576 | sqwins() -- draw the sequence display
|
---|
577 | =============================================================================
|
---|
578 | */
|
---|
579 |
|
---|
580 | void sqwins(void)
|
---|
581 | {
|
---|
582 | register int16_t i;
|
---|
583 |
|
---|
584 | for (i = 0; i < 4; i++)
|
---|
585 | sqwin(i);
|
---|
586 | }
|
---|
587 |
|
---|
588 | /* |
---|
589 |
|
---|
590 | */
|
---|
591 |
|
---|
592 | /*
|
---|
593 | =============================================================================
|
---|
594 | sqdisp() -- setup the sequence display
|
---|
595 | =============================================================================
|
---|
596 | */
|
---|
597 |
|
---|
598 | void sqdisp(void)
|
---|
599 | {
|
---|
600 | #if DEBUGSQ
|
---|
601 | if (debugsw AND debugsq)
|
---|
602 | printf("sqdisp(): ENTRY\n");
|
---|
603 | #endif
|
---|
604 |
|
---|
605 | dswap(); /* clear the video display */
|
---|
606 |
|
---|
607 | BakLine = SqBakLn;
|
---|
608 | FwdLine = SqFwdLn;
|
---|
609 |
|
---|
610 | /* setup object pointers */
|
---|
611 |
|
---|
612 | obj8 = &v_score[OB08LOC]; /* 8 - headings */
|
---|
613 | obj9 = &v_score[OB09LOC]; /* 9 - sequences */
|
---|
614 | obj10 = &v_score[OB10LOC]; /* 10 - status */
|
---|
615 | obj11 = &v_score[OB11LOC]; /* 11 - menu */
|
---|
616 |
|
---|
617 | ScrlObj = 9;
|
---|
618 | ScObAdr = obj9;
|
---|
619 | LineBuf = obj9;
|
---|
620 | OldLine = (uint16_t *)NULL;
|
---|
621 | LineAtr = PTPATR;
|
---|
622 |
|
---|
623 | CurLine = 0;
|
---|
624 | CurScan = 13;
|
---|
625 |
|
---|
626 | PdScDnF = FALSE;
|
---|
627 | PdScUpF = FALSE;
|
---|
628 |
|
---|
629 | /* ---------------- initialize object table -------------------- */
|
---|
630 | /* obj, typ, bnk, base, xpix, ypix, x0, y0, flags, pri */
|
---|
631 |
|
---|
632 | SetObj( 8, 1, 0, obj8, 512, 28, 0, 0, PDFL_08, -1);
|
---|
633 | SetObj( 9, 1, 0, obj9, 384, 224, 0, 28, PDFL_09, -1);
|
---|
634 | SetObj( 10, 0, 0, obj10, 128, 224, 384, 28, PDFL_10, -1);
|
---|
635 | SetObj( 11, 1, 0, obj11, 512, 98, 0, 252, PDFL_11, -1);
|
---|
636 |
|
---|
637 | if (v_regs[5] & 0x0180)
|
---|
638 | vbank(0);
|
---|
639 |
|
---|
640 | memsetw(v_score, 0, 32767); /* clear display objects */
|
---|
641 | memsetw(v_score+32767L, 0, 24577);
|
---|
642 |
|
---|
643 | sqwins(); /* fill up the windows */
|
---|
644 |
|
---|
645 | /* |
---|
646 |
|
---|
647 | */
|
---|
648 | /* display some objects */
|
---|
649 |
|
---|
650 | SetPri( 8, 8); /* headings */
|
---|
651 | SetPri( 9, 9); /* sequences */
|
---|
652 | SetPri(10, 10); /* sequence status */
|
---|
653 | SetPri(11, 11); /* menu */
|
---|
654 |
|
---|
655 | if (v_regs[5] & 0x0180) /* select bank 0 */
|
---|
656 | vbank(0);
|
---|
657 |
|
---|
658 | memcpyw(v_cgtab, cg3, 3584); /* setup character generator */
|
---|
659 | v_regs[1] = (v_regs[1] & 0x0FFF) | 0xE000;
|
---|
660 |
|
---|
661 | /* fix the initial scan line specs in the object descriptor table */
|
---|
662 |
|
---|
663 | v_odtab[ 8][0] = (v_odtab[ 8][0] & 0x0FFF) | 0xD000;
|
---|
664 | v_odtab[ 9][0] = (v_odtab[ 9][0] & 0x0FFF) | 0xD000;
|
---|
665 |
|
---|
666 | v_odtab[11][0] = (v_odtab[11][0] & 0x0FFF) | 0xD000;
|
---|
667 |
|
---|
668 | submenu = FALSE;
|
---|
669 |
|
---|
670 | ctcsw = TRUE; /* enable cursor */
|
---|
671 | ctcpos(DATAROW, 2); /* set initial cursor */
|
---|
672 | postcm(); /* set initial submenu */
|
---|
673 |
|
---|
674 | vsndpal(seqpal); /* set the palette */
|
---|
675 |
|
---|
676 | #if DEBUGSQ
|
---|
677 | if (debugsw AND debugsq)
|
---|
678 | printf("sqdisp(): EXIT\n");
|
---|
679 | #endif
|
---|
680 |
|
---|
681 | }
|
---|