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