MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / lcd_words

Function lcd_words

core/lcd.c:223–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221}
222
223static uint32_t lcd_words(uint8_t words) {
224 assert(words > 0);
225 uint32_t ticks = 0;
226 if (likely(lcd.control >> 11 & 1)) {
227 uint32_t bgr = lcd.BGR ? 0x001F001F : 0;
228 uint32_t *dat = &lcd.fifo[lcd.pos / sizeof(uint32_t)];
229 switch (lcd.LCDBPP) {
230 case 4: {
231 uint_fast8_t bi = lcd.BEBO ? 16 : 0;
232 do {
233 uint32_t word = rotr32(lcd_next_word(&dat), bi);
234 word = lcd_bgr565swap(c1555(word), bgr);
235 ticks = lcd_process_pixel(ticks, word);
236 ticks = lcd_process_pixel(ticks, word >> 16);
237 } while (--words);
238 break;
239 }
240
241 case 5:
242 do {
243 uint32_t word = lcd_next_word(&dat);
244 word = lcd_bgr565swap(c888(word), bgr);
245 ticks = lcd_process_pixel(ticks, word);
246 } while (--words);
247 break;
248
249 case 6: {
250 uint_fast8_t bi = lcd.BEBO ? 16 : 0;
251 do {
252 uint32_t word = rotr32(lcd_next_word(&dat), bi);
253 word = lcd_bgr565swap(word, bgr);
254 ticks = lcd_process_pixel(ticks, word);
255 ticks = lcd_process_pixel(ticks, word >> 16);
256 } while (--words);
257 break;
258 }
259
260 case 7: {
261 uint_fast8_t bi = lcd.BEBO ? 16 : 0;
262 do {
263 uint32_t word = rotr32(lcd_next_word(&dat), bi);
264 word = lcd_bgr565swap(c444(word), bgr);
265 ticks = lcd_process_pixel(ticks, word);
266 ticks = lcd_process_pixel(ticks, word >> 16);
267 } while (--words);
268 break;
269 }
270
271 default: {
272 uint_fast8_t bpp = 1 << lcd.LCDBPP;
273 uint_fast8_t mask = (1 << bpp) - 1;
274 uint_fast8_t bi = (lcd.BEBO ^ (CEMU_BYTE_ORDER == CEMU_BIG_ENDIAN) ? 0 : 24) ^ (lcd.BEPO ? 0 : 8 - bpp);
275 do {
276 uint_fast8_t bitpos = 32;
277 uint32_t word = *dat++;
278 do {
279 uint32_t pixel = lcd.palette[word >> ((bitpos -= bpp) ^ bi) & mask];
280 pixel |= (uint32_t)lcd.palette[word >> ((bitpos -= bpp) ^ bi) & mask] << 16;

Callers 1

lcd_dmaFunction · 0.85

Calls 4

rotr32Function · 0.85
lcd_next_wordFunction · 0.85
lcd_bgr565swapFunction · 0.85
lcd_process_pixelFunction · 0.85

Tested by

no test coverage detected