1 | /*
|
---|
2 | =============================================================================
|
---|
3 | ucslice.c -- update score display center slice
|
---|
4 | Version 7 -- 1988-09-28 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #undef DEBUGGER
|
---|
9 |
|
---|
10 | #include "all.h"
|
---|
11 |
|
---|
12 | /* variables defined elsewhere */
|
---|
13 |
|
---|
14 | extern uint16_t *saddr; /* score object base address */
|
---|
15 |
|
---|
16 | extern int16_t ndisp; /* current display number */
|
---|
17 | extern int16_t sd; /* scroll direction flag */
|
---|
18 | extern int16_t soffset; /* score object scroll offset */
|
---|
19 |
|
---|
20 | extern int16_t gtctab[]; /* group to color table */
|
---|
21 | extern int16_t lintab1[]; /* note top line table - N_SHARP */
|
---|
22 | extern int16_t lintab2[]; /* note top line table - N_FLAT */
|
---|
23 | extern int16_t nbmasks[]; /* pixel mask table for slices */
|
---|
24 | extern int16_t nttab1[]; /* gdsel code transition table - fwd */
|
---|
25 | extern int16_t nttab2[]; /* gdsel code transition table - bak */
|
---|
26 |
|
---|
27 | extern uint16_t pxtbl[][4]; /* pixel mask table - notes */
|
---|
28 | extern uint16_t epxtbl[][16]; /* pixel mask table - events */
|
---|
29 |
|
---|
30 | extern struct gdsel *gdfsep; /* gdsel freechain pointer */
|
---|
31 |
|
---|
32 | extern struct gdsel *gdstbc[]; /* group status list heads */
|
---|
33 |
|
---|
34 | /* |
---|
35 |
|
---|
36 | */
|
---|
37 |
|
---|
38 | /*
|
---|
39 | =============================================================================
|
---|
40 | ucslice()
|
---|
41 |
|
---|
42 | Updates the center slice.
|
---|
43 |
|
---|
44 | Note transitions are based on the value of global variable 'sd',
|
---|
45 | which is zero for forward, and non-zero for backward scrolling.
|
---|
46 |
|
---|
47 | Note colors come from 'gtctab[]'.
|
---|
48 |
|
---|
49 | This code must be very fast or the display bogs down the system.
|
---|
50 | =============================================================================
|
---|
51 | */
|
---|
52 |
|
---|
53 | void ucslice(void)
|
---|
54 | {
|
---|
55 | register uint16_t *pxptr, *slptr;
|
---|
56 | register struct gdsel *gdsep;
|
---|
57 | register int32_t lc;
|
---|
58 | register uint16_t i, ncolor, mask1, mask2;
|
---|
59 | uint16_t *ncptr, *nctabp;
|
---|
60 | struct gdsel **gdstp, *gdprv, *gdnxt;
|
---|
61 | int16_t *lintab;
|
---|
62 |
|
---|
63 | DB_ENTR("ucslice()");
|
---|
64 |
|
---|
65 | lc = 128L;
|
---|
66 | mask1 = nbmasks[soffset];
|
---|
67 | mask2 = ~mask1;
|
---|
68 |
|
---|
69 | /* initialize note color, note control, and group control pointers */
|
---|
70 |
|
---|
71 | gdstp = gdstbc; /* group control table */
|
---|
72 | nctabp = sd ? nttab2 : nttab1; /* note transition table */
|
---|
73 | ncptr = gtctab; /* group to color table */
|
---|
74 |
|
---|
75 | lintab = (ac_code EQ N_SHARP) ? lintab1 : lintab2; /* line table */
|
---|
76 |
|
---|
77 | /* |
---|
78 |
|
---|
79 | */
|
---|
80 |
|
---|
81 | for (i = 0; i < 12; i++) { /* scan the group control table ... */
|
---|
82 |
|
---|
83 | ncolor = mask1 & *ncptr++; /* get note color mask */
|
---|
84 | gdprv = (struct gdsel *)gdstp; /* setup previous pointer */
|
---|
85 | gdsep = *gdstp++; /* setup current pointer */
|
---|
86 |
|
---|
87 | if (gdsep) { /* ... process each active group ... */
|
---|
88 |
|
---|
89 | do { /* ... for each note played by the group ... */
|
---|
90 |
|
---|
91 | if (ndisp EQ 2) { /* ... if display is up */
|
---|
92 |
|
---|
93 | /* setup slice and pixel pointers */
|
---|
94 |
|
---|
95 | slptr = saddr + 64L +
|
---|
96 | ((int32_t)lintab[gdsep->note] << 7);
|
---|
97 |
|
---|
98 | pxptr = &pxtbl[gdsep->code][0];
|
---|
99 |
|
---|
100 | /* update the slice */
|
---|
101 |
|
---|
102 | *slptr = (*slptr & mask2) | (*pxptr++ & ncolor);
|
---|
103 | slptr += lc;
|
---|
104 |
|
---|
105 | *slptr = (*slptr & mask2) | (*pxptr++ & ncolor);
|
---|
106 | slptr += lc;
|
---|
107 |
|
---|
108 | *slptr = (*slptr & mask2) | (*pxptr++ & ncolor);
|
---|
109 |
|
---|
110 | }
|
---|
111 |
|
---|
112 | gdnxt = gdsep->next; /* set 'next element' pointer */
|
---|
113 |
|
---|
114 | /* update and check element code */
|
---|
115 |
|
---|
116 | if (0 EQ (gdsep->code = nctabp[gdsep->code])) {
|
---|
117 |
|
---|
118 | /* if it's zero, delete the element */
|
---|
119 |
|
---|
120 | gdprv->next = gdnxt;
|
---|
121 | gdsep->next = gdfsep;
|
---|
122 | gdfsep = gdsep;
|
---|
123 |
|
---|
124 | } else
|
---|
125 | gdprv = gdsep;
|
---|
126 |
|
---|
127 | gdsep = gdnxt; /* set pointer for next pass */
|
---|
128 |
|
---|
129 | } while (gdsep);
|
---|
130 | }
|
---|
131 | }
|
---|
132 |
|
---|
133 | /* |
---|
134 |
|
---|
135 | */
|
---|
136 | for (; i < NGDSEL; i++) {
|
---|
137 |
|
---|
138 | gdprv = (struct gdsel *)gdstp; /* setup previous pointer */
|
---|
139 | gdsep = *gdstp++; /* setup current pointer */
|
---|
140 |
|
---|
141 | if (gdsep) { /* ... process each active event priority ... */
|
---|
142 |
|
---|
143 | do { /* ... for each event of this priority ... */
|
---|
144 |
|
---|
145 | if (ndisp EQ 2) { /* ... if display is up */
|
---|
146 |
|
---|
147 | /* setup slice and pixel pointers */
|
---|
148 |
|
---|
149 | slptr = saddr + 27200L;
|
---|
150 | pxptr = &epxtbl[gdsep->code][0];
|
---|
151 |
|
---|
152 | /* get event color */
|
---|
153 |
|
---|
154 | ncolor = mask1 & gdsep->note;
|
---|
155 |
|
---|
156 | /* update the slice */
|
---|
157 |
|
---|
158 | if (*pxptr++) /* 212 */
|
---|
159 | *slptr = (*slptr & mask2) | ncolor;
|
---|
160 |
|
---|
161 | slptr += lc;
|
---|
162 |
|
---|
163 | if (*pxptr++) /* 213 */
|
---|
164 | *slptr = (*slptr & mask2) | ncolor;
|
---|
165 |
|
---|
166 | slptr += lc;
|
---|
167 |
|
---|
168 | if (*pxptr++) /* 214 */
|
---|
169 | *slptr = (*slptr & mask2) | ncolor;
|
---|
170 |
|
---|
171 | slptr += lc;
|
---|
172 |
|
---|
173 | if (*pxptr++) /* 215 */
|
---|
174 | *slptr = (*slptr & mask2) | ncolor;
|
---|
175 |
|
---|
176 | slptr += lc;
|
---|
177 |
|
---|
178 | if (*pxptr++) /* 216 */
|
---|
179 | *slptr = (*slptr & mask2) | ncolor;
|
---|
180 |
|
---|
181 | slptr += lc;
|
---|
182 |
|
---|
183 | if (*pxptr++) /* 217 */
|
---|
184 | *slptr = (*slptr & mask2) | ncolor;
|
---|
185 |
|
---|
186 | slptr += lc;
|
---|
187 | /* |
---|
188 |
|
---|
189 | */
|
---|
190 | if (*pxptr++) /* 218 */
|
---|
191 | *slptr = (*slptr & mask2) | ncolor;
|
---|
192 |
|
---|
193 | slptr += lc;
|
---|
194 |
|
---|
195 | if (*pxptr++) /* 219 */
|
---|
196 | *slptr = (*slptr & mask2) | ncolor;
|
---|
197 |
|
---|
198 | slptr += lc;
|
---|
199 |
|
---|
200 | if (*pxptr++) /* 220 */
|
---|
201 | *slptr = (*slptr & mask2) | ncolor;
|
---|
202 |
|
---|
203 | slptr += lc;
|
---|
204 |
|
---|
205 | if (*pxptr++) /* 221 */
|
---|
206 | *slptr = (*slptr & mask2) | ncolor;
|
---|
207 |
|
---|
208 | slptr += lc;
|
---|
209 |
|
---|
210 | if (*pxptr++) /* 222 */
|
---|
211 | *slptr = (*slptr & mask2) | ncolor;
|
---|
212 |
|
---|
213 | slptr += lc;
|
---|
214 |
|
---|
215 | if (*pxptr) /* 223 */
|
---|
216 | *slptr = (*slptr & mask2) | ncolor;
|
---|
217 | }
|
---|
218 |
|
---|
219 | gdnxt = gdsep->next; /* set next pointer */
|
---|
220 | gdprv->next = gdnxt; /* delete the element */
|
---|
221 | gdsep->next = gdfsep;
|
---|
222 | gdfsep = gdsep;
|
---|
223 | gdsep = gdnxt; /* set pointer for next pass */
|
---|
224 |
|
---|
225 | } while (gdsep);
|
---|
226 | }
|
---|
227 | }
|
---|
228 |
|
---|
229 | DB_EXIT("ucslice");
|
---|
230 | }
|
---|
231 |
|
---|