source: buchla-68k/orig/RAM/UCSLICE.C@ 6888aa2

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

Imported original source code.

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