source: buchla-68k/ram/ucslice.c@ 3fcb810

Last change on this file since 3fcb810 was 8c8b4e5, checked in by Thomas Lopatic <thomas@…>, 7 years ago

More volatile hardware accesses.

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