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

Method UpdateSHRCell

source/VidHD.cpp:130–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130void VidHDCard::UpdateSHRCell(bool is640Mode, bool isColorFillMode, uint16_t addrPalette, bgra_t* pVideoAddress, uint32_t a)
131{
132 _ASSERT(!is640Mode); // to do: test this mode
133
134 Color* palette = (Color*) MemGetAuxPtr(addrPalette);
135
136 for (UINT i = 0; i < 4; i++)
137 {
138 if (!is640Mode) // 320 mode
139 {
140 BYTE pixel1 = (a >> 4) & 0xf;
141 bgra_t color1 = ConvertIIgs2RGB(palette[pixel1]);
142 if (isColorFillMode && pixel1 == 0) color1 = *(pVideoAddress - 1);
143 *pVideoAddress++ = color1;
144 *pVideoAddress++ = color1;
145
146 BYTE pixel2 = a & 0xf;
147 bgra_t color2 = ConvertIIgs2RGB(palette[pixel2]);
148 if (isColorFillMode && pixel2 == 0) color2 = color1;
149 *pVideoAddress++ = color2;
150 *pVideoAddress++ = color2;
151 }
152 else // 640 mode - see IIgs Hardware Ref, Pg.96, Table4-21 'Color Selection in 640 mode'
153 {
154 BYTE pixel1 = (a >> 6) & 0x3;
155 bgra_t color1 = ConvertIIgs2RGB(palette[0x8 + pixel1]);
156 *pVideoAddress++ = color1;
157
158 BYTE pixel2 = (a >> 4) & 0x3;
159 bgra_t color2 = ConvertIIgs2RGB(palette[0xC + pixel2]);
160 *pVideoAddress++ = color2;
161
162 BYTE pixel3 = (a >> 2) & 0x3;
163 bgra_t color3 = ConvertIIgs2RGB(palette[0x0 + pixel3]);
164 *pVideoAddress++ = color3;
165
166 BYTE pixel4 = a & 0x3;
167 bgra_t color4 = ConvertIIgs2RGB(palette[0x4 + pixel4]);
168 *pVideoAddress++ = color4;
169 }
170
171 a >>= 8;
172 }
173}
174
175//===========================================================================
176

Callers

nothing calls this directly

Calls 2

MemGetAuxPtrFunction · 0.85
ConvertIIgs2RGBFunction · 0.85

Tested by

no test coverage detected