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

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

Added missing includes and declarations.

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