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

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

Removed form-feed comments.

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