source: buchla-68k/orig/RAM/STCPOS.C@ 5f1d169

Last change on this file since 5f1d169 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago

Imported original source code.

  • Property mode set to 100755
File size: 9.7 KB
RevLine 
[3ae31e9]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();
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
172stcclr()
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
216stcoff()
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
246stcpos(row, col)
247short row, col;
248{
249 register unsigned *ccp, *tcp;
250 register unsigned curson, ccv;
251 register short ncrow, tcrow;
252
253 tcrow = stcrow ? (stcrow - 16) : 0; /* get old object row */
254 ncrow = row ? (row - 16) : 0; /* get new object row */
255
256 if ((v_regs[5] & 0x0180) NE 0x0100)
257 vbank(1); /* select the cursor bank */
258
259 curson = exp_c(SDCURSR); /* get cursor color */
260
261 /* get old cursor background color */
262
263 ccv = exp_c(sctctab[tcrow][stccol]);
264
265 tcp = STCOBJ + (tcrow << 8) + (stccol << 1); /* old cursor pointer */
266 ccp = STCOBJ + (ncrow << 8) + (col << 1); /* new cursor pointer */
267
268 *tcp++ = ccv; /* turn off the old cursor */
269 *tcp = ccv;
270
271 *ccp++ = curson; /* turn on the new cursor */
272 *ccp = curson;
273
274 stcrow = row; /* update cursor position */
275 stccol = col;
276}
277
278/*
279
280*/
281
282/*
283 =============================================================================
284 advscur() -- advance the score text cursor
285 =============================================================================
286*/
287
288advscur()
289{
290 register short newcol;
291
292 if (infield(stcrow, stccol, curfet))
293 cfetp = infetp;
294 else
295 return;
296
297 newcol = stccol + 1;
298
299 if (newcol LE cfetp->frcol)
300 stcpos(stcrow, newcol);
301}
302
303/*
304 =============================================================================
305 stcset() -- setup the score text cursor color table
306 =============================================================================
307*/
308
309stcset()
310{
311 memcpyw(&sctctab[0][0], &sctccon[0][0], 640);
312}
Note: See TracBrowser for help on using the repository browser.