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