source: buchla-68k/ram/ucslice.c

Last change on this file was ba51a45, checked in by Thomas Lopatic <thomas@…>, 6 years ago

Fixed ucslice.c.

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