MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / userVideoRom2K

Function userVideoRom2K

source/NTSC_CharSet.cpp:183–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181static void userVideoRom2K(csbits_t csbits, const BYTE* pVideoRom, const eApple2Type type = A2TYPE_APPLE2, const int AN2=0);
182
183static void userVideoRom2K(csbits_t csbits, const BYTE* pVideoRom, const eApple2Type type /*= A2TYPE_APPLE2*/, const int AN2/*=0*/)
184{
185 for (int i=0; i<256; i++)
186 {
187 int RA = i*8; // rom address
188
189 if (type == A2TYPE_APPLE2JPLUS)
190 {
191 // AN2=0: $00-3F, $00-3F; $80-BF, $80-BF => KKAA (Repeat Katakana)
192 // AN2=1: $40-7F, $40-7F; $C0-FF, $C0-FF => AAAA (Repeat ASCII)
193 RA &= ~(1<<(6+3));
194 RA |= (AN2<<(6+3)); // AN2 controls A9 (UTAII 8-12, Fig 8.7)
195 }
196
197 for (int y=0; y<8; y++)
198 {
199 BYTE n = pVideoRom[RA+y];
200
201 // UTAII:8-30 "Bit 7 of your EPROM fonts will control flashing in the lower 1024 bytes of the EPROM"
202 // UTAII:8-31 "If you leave O7 (EPROM Output7) reset in these patterns, the resulting characters will be inversions..."
203 // Apple II J-Plus: simplest logic is just invert if reading low 1K of video ROM
204 // Base64A: Bit 0 instead of bit 7
205 if (RA < 1024)
206 {
207 if (type == A2TYPE_BASE64A)
208 {
209 if (!(n & 0x01))
210 n = n ^ 0xfe;
211 }
212 else
213 {
214 if (!(n & 0x80) || (type == A2TYPE_APPLE2JPLUS))
215 n = n ^ 0x7f;
216 }
217 }
218
219 BYTE d = 0;
220 if (type == A2TYPE_BASE64A)
221 {
222 // On the Base 64A bits are ordered 1345672.
223 d = (n >> 2) | ((n & 2) >> 1) | ((n & 4) << 4);
224 }
225 else
226 {
227 // UTAII:8-30 "TEXT ROM pattern is ... reversed"
228 for (BYTE j = 0; j < 7; j++, n >>= 1) // Just bits [0..6]
229 d = (d << 1) | (n & 1);
230 }
231
232 csbits[0][i][y] = d;
233 }
234 }
235}
236
237static void userVideoRomForIIPlus(void)
238{

Callers 4

userVideoRomForIIPlusFunction · 0.85
VideoRomForIIandIIPlusFunction · 0.85
VideoRomForIIJPlusFunction · 0.85
VideoRomForBase64AFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected