source: buchla-68k/ram/stcpos.c@ 0580615

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

Point of no return.

  • Property mode set to 100644
File size: 9.4 KB
Line 
1/*
2 =============================================================================
3 stcpos.c -- text cursor positioning for the score display
4 Version 19 -- 1989-11-15 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "stddefs.h"
9#include "graphdef.h"
10#include "vsdd.h"
11#include "vsddsw.h"
12#include "hwdefs.h"
13#include "memory.h"
14#include "fields.h"
15
16#include "midas.h"
17#include "scdsp.h"
18
19#define STCOBJ obj3
20
21#define SDLINE 4 /* dividing line color - analog stuff */
22
23extern unsigned exp_c(unsigned c);
24
25extern unsigned *STCOBJ; /* text cursor address in VSDD RAM */
26
27extern short cxval, cyval; /* score cursor x,y */
28extern short stcrow, stccol; /* score cursor row,col */
29extern short sctctab[10][64]; /* score background color table */
30
31/*
32
33*/
34
35short sctccon[10][64] = { /* score background color constants */
36
37 /* 0 - row 0 */
38
39 {SDBG00, SDBG00, SDBG01, SDBG01, SDBG01, SDBG01, SDBG01, SDBG01,
40 SDBG01, SDBG00, SDBG00, SDBG00, SDBG00, SDBG00, SDBG00, SDBG00,
41 SDBG00, SDBG00, SDBG00, SDBG00, SDBG00, SDBG00, SDBG01, SDBG01,
42 SDBG01, SDBG01, SDBG01, SDBG01, SDBG01, SDBG02, SDBG02, SDBG02,
43
44 SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG02,
45 SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG02,
46 SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG03,
47 SDBG03, SDBG03, SDBG03, SDBG03, SDBG03, SDBG03, SDBG03, SDBG03},
48
49 /* 1 - row 17 */
50
51 {SDBG04, SDBG04, SDBG04, SDBG04, SDBG04, SDBG04, SDBG04, SDBG04,
52 SDBG04, SDBG04, SDBG04, SDBG04, SDBG04, SDBG04, SDBG05, SDBG05,
53 SDBG05, SDBG05, SDBG05, SDBG05, SDBG05, SDBG06, SDBG06, SDBG06,
54 SDBG06, SDBG06, SDBG06, SDBG06, SDBG06, SDBG06, SDBG06, SDBG07,
55
56 SDBG07, SDBG07, SDBG07, SDBG07, SDBG07, SDBG07, SDBG07, SDBG07,
57 SDBG08, SDBG08, SDBG08, SDBG08, SDBG08, SDBG08, SDBG08, SDBG08,
58 SDBG08, SDBG08, SDBG09, SDBG09, SDBG09, SDBG09, SDBG09, SDBG09,
59 SDBG09, SDBG10, SDBG10, SDBG10, SDBG10, SDBG10, SDBG10, SDBG10},
60
61 /* 2 - row 18 */
62
63 {SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
64 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
65 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
66 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
67
68 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
69 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
70 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
71 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11},
72/*
73
74*/
75 /* 3 - row 19 */
76
77 {SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
78 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
79 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
80 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
81
82 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
83 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
84 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
85 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11},
86
87 /* 4 - row 20 */
88
89 {SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
90 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
91 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
92 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
93
94 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
95 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
96 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
97 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11},
98
99 /* 5 - row 21 */
100
101 {SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
102 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
103 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
104 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
105
106 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
107 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
108 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
109 SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11},
110/*
111
112*/
113 /* 6 - row 22 */
114
115 {SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
116 SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
117 SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
118 SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
119
120 SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
121 SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
122 SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
123 SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12},
124
125 /* 7 - row 23 */
126
127 {SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
128 SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
129 SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
130 SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
131
132 SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
133 SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
134 SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
135 SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12},
136
137 /* 8 - row 24 */
138
139 {SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13,
140 SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13,
141 SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13,
142 SDBG13, SDBG13, SDBG13, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14,
143
144 SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14,
145 SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14,
146 SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14,
147 SDBG14, SDBG15, SDBG15, SDBG15, SDBG15, SDBG15, SDBG15, SDBG15},
148
149 /* 9 - special - bottom of row 21 - top is entry 5 */
150
151 {SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE,
152 SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE,
153 SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE,
154 SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE,
155
156 SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE,
157 SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE,
158 SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE,
159 SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE}
160};
161
162/*
163
164*/
165
166/*
167 =============================================================================
168 stcclr() -- turn off all of the score text cursors
169 =============================================================================
170*/
171
172void stcclr(void)
173{
174 register unsigned *obj;
175 register short i, j;
176 register unsigned k;
177
178 if ((v_regs[5] & 0x0180) NE 0x0100)
179 vbank(1); /* select the correct bank */
180
181 stcrow = 0; /* leave score cursor row,col = 0,0 */
182 stccol = 0;
183
184 obj = STCOBJ; /* intialize pointers */
185
186 for (i = 0; i < 9; i++) { /* clear each cursor row */
187
188 for (j = 0; j < 64; j++) { /* top cursor row */
189
190 k = exp_c(sctctab[i][j]);
191
192 *obj++ = k;
193 *obj++ = k;
194 }
195
196 for (j = 0; j < 64; j++) { /* bottom cursor row */
197
198 k = exp_c(sctctab[i EQ 5 ? 9 : i][j]);
199
200 *obj++ = k;
201 *obj++ = k;
202 }
203 }
204}
205
206/*
207
208*/
209
210/*
211 =============================================================================
212 stcoff() -- turn off text cursor for the score display
213 =============================================================================
214*/
215
216void stcoff(void)
217{
218 register unsigned ccv, *tcp;
219 register short tcrow;
220
221 tcrow = stcrow ? (stcrow - 16) : 0; /* get old object row */
222
223 if ((v_regs[5] & 0x0180) NE 0x0100)
224 vbank(1);
225
226 tcp = STCOBJ + (tcrow << 8) + (stccol << 1); /* object pointer */
227
228 /* background color */
229
230 ccv = exp_c(sctctab[tcrow][stccol]);
231
232 *tcp++ = ccv; /* turn off the text cursor */
233 *tcp = ccv;
234}
235
236/*
237
238*/
239
240/*
241 =============================================================================
242 stcpos() -- position the score text cursor at ('row', 'col')
243 =============================================================================
244*/
245
246void stcpos(short row, short col)
247{
248 register unsigned *ccp, *tcp;
249 register unsigned curson, ccv;
250 register short ncrow, tcrow;
251
252 tcrow = stcrow ? (stcrow - 16) : 0; /* get old object row */
253 ncrow = row ? (row - 16) : 0; /* get new object row */
254
255 if ((v_regs[5] & 0x0180) NE 0x0100)
256 vbank(1); /* select the cursor bank */
257
258 curson = exp_c(SDCURSR); /* get cursor color */
259
260 /* get old cursor background color */
261
262 ccv = exp_c(sctctab[tcrow][stccol]);
263
264 tcp = STCOBJ + (tcrow << 8) + (stccol << 1); /* old cursor pointer */
265 ccp = STCOBJ + (ncrow << 8) + (col << 1); /* new cursor pointer */
266
267 *tcp++ = ccv; /* turn off the old cursor */
268 *tcp = ccv;
269
270 *ccp++ = curson; /* turn on the new cursor */
271 *ccp = curson;
272
273 stcrow = row; /* update cursor position */
274 stccol = col;
275}
276
277/*
278
279*/
280
281/*
282 =============================================================================
283 advscur() -- advance the score text cursor
284 =============================================================================
285*/
286
287void advscur(void)
288{
289 register short newcol;
290
291 if (infield(stcrow, stccol, curfet))
292 cfetp = infetp;
293 else
294 return;
295
296 newcol = stccol + 1;
297
298 if (newcol LE cfetp->frcol)
299 stcpos(stcrow, newcol);
300}
301
302/*
303 =============================================================================
304 stcset() -- setup the score text cursor color table
305 =============================================================================
306*/
307
308void stcset(void)
309{
310 memcpyw(&sctctab[0][0], &sctccon[0][0], 640);
311}
Note: See TracBrowser for help on using the repository browser.