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