2 * Common source code project -> FM-7 -> Display -> Vram access
3 * (C) 2015 K.Ohta <whatisthis.sowhat _at_ gmail.com>
5 * Sep 27, 2015 : Split from display.cpp .
10 #include "fm7_display.h"
16 void DISPLAY::draw_screen()
18 //#if !defined(_FM77AV_VARIANTS)
23 extern config_t config;
24 void DISPLAY::draw_screen2()
28 scrntype_t *p, *pp, *p2;
33 uint32_t yoff_d1, yoff_d2;
34 uint16_t wx_begin, wx_end, wy_low, wy_high;
35 bool scan_line = config.scan_line;
36 bool ff = force_update;
38 #if defined(_FM77AV40EX) || defined(_FM77AV40SX)
40 wx_begin = window_xbegin;
43 wy_high = window_high;
44 bool _flag = window_opened;
45 if((wx_begin < wx_end) && (wy_low < wy_high)) {
48 window_opened = false;
50 if(_flag != window_opened) {
51 vram_wrote_shadow = true;
55 // frame_skip_count_draw++;
56 #if defined(_FM77AV_VARIANTS)
60 //if(!(vram_wrote_shadow)) return;
61 yoff_d1 = yoff_d2 = offset_point;
66 switch(display_mode) {
67 case DISPLAY_MODE_8_200L:
71 case DISPLAY_MODE_8_400L:
80 # if !defined(FIXED_FRAMEBUFFER_SIZE)
81 emu->set_vm_screen_size(xpixels, ylines, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH_ASPECT, WINDOW_HEIGHT_ASPECT);
83 emu->set_vm_screen_lines(ylines);
87 #if !defined(FIXED_FRAMEBUFFER_SIZE)
88 for(y = 0; y < ylines; y += 8) {
89 for(yy = 0; yy < 8; yy++) {
90 vram_draw_table[y + yy] = false;
91 ppp = emu->get_screen_buffer(y + yy);
92 if(ppp != NULL) memset(ppp, 0x00, xpixels * sizeof(scrntype_t));
96 for(y = 0; y < 400; y += 8) {
97 for(yy = 0; yy < 8; yy++) {
98 vram_draw_table[y + yy] = false;
99 ppp = emu->get_screen_buffer(y + yy);
100 if(ppp != NULL) memset(ppp, 0x00, 640 * sizeof(scrntype_t));
106 crt_flag_bak = crt_flag;
109 crt_flag_bak = crt_flag;
110 if(!(vram_wrote_shadow | ff)) return;
111 vram_wrote_shadow = false;
112 if(display_mode == DISPLAY_MODE_8_200L) {
115 #ifdef USE_GREEN_DISPLAY
116 if(use_green_monitor) {
117 // Green display had only connected to FM-8, FM-7/NEW7 and FM-77.
118 for(y = 0; y < 200; y += 8) {
119 for(yy = 0; yy < 8; yy++) {
120 if(!(vram_draw_table[y + yy] | ff)) continue;
121 vram_draw_table[y + yy] = false;
122 #if !defined(FIXED_FRAMEBUFFER_SIZE)
123 p = emu->get_screen_buffer(y + yy);
126 p = emu->get_screen_buffer((y + yy) * 2);
127 p2 = emu->get_screen_buffer((y + yy) * 2 + 1);
129 if(p == NULL) continue;
130 yoff = (y + yy) * 80;
132 for(x = 0; x < 10; x++) {
133 for(ii = 0; ii < 8; ii++) {
134 GETVRAM_8_200L_GREEN(yoff + ii, p, p2, false, scan_line);
135 #if defined(FIXED_FRAMEBUFFER_SIZE)
145 if(ff) force_update = false;
149 for(y = 0; y < 200; y += 8) {
150 for(yy = 0; yy < 8; yy++) {
152 if(!(vram_draw_table[y + yy] | ff)) continue;
153 vram_draw_table[y + yy] = false;
154 #if !defined(FIXED_FRAMEBUFFER_SIZE)
155 p = emu->get_screen_buffer(y + yy);
158 p = emu->get_screen_buffer((y + yy) * 2);
159 p2 = emu->get_screen_buffer((y + yy) * 2 + 1);
161 if(p == NULL) continue;
162 yoff = (y + yy) * 80;
163 # if defined(_FM77AV40EX) || defined(_FM77AV40SX)
164 if(window_opened && (wy_low <= (y + yy)) && (wy_high > (y + yy))) {
165 for(x = 0; x < 80; x++) {
166 if((x >= wx_begin) && (x < wx_end)) {
167 GETVRAM_8_200L(yoff, p, p2, true, scan_line);
169 GETVRAM_8_200L(yoff, p, p2, false, scan_line);
171 #if defined(FIXED_FRAMEBUFFER_SIZE)
180 for(x = 0; x < 10; x++) {
181 for(ii = 0; ii < 8; ii++) {
182 GETVRAM_8_200L(yoff + ii, p, p2, false, scan_line);
183 #if defined(FIXED_FRAMEBUFFER_SIZE)
194 if(ff) force_update = false;
198 if(display_mode == DISPLAY_MODE_1_400L) {
200 uint8_t *regs = l4crtc->get_regs();
201 cursor_start = (int)(regs[10] & 0x1f);
202 cursor_end = (int)(regs[11] & 0x1f);
203 cursor_type = (int)((regs[10] & 0x60) >> 5);
204 text_xmax = (int)((uint16_t)regs[1] << 1);
205 text_lines = (int)((regs[9] & 0x1f) + 1);
206 text_ymax = (int)(regs[6] & 0x7f);
208 // Green display had only connected to FM-8, FM-7/NEW7 and FM-77.
209 for(y = 0; y < 400; y += 8) {
210 bool renderf = false;
218 if((y & 0x0f) == 0) {
219 for(yy = 0; yy < 16; yy++) renderf |= vram_draw_table[y + yy];
220 renderf = renderf | ff;
222 for(yy = 0; yy < 16; yy++) vram_draw_table[y + yy] = true;
225 if(use_green_monitor) {
226 for(yy = 0; yy < 8; yy++) {
227 if(!(vram_draw_table[y + yy] | ff)) continue;
228 vram_draw_table[y + yy] = false;
229 p = emu->get_screen_buffer(y + yy);
230 if(p == NULL) continue;
231 yoff = (y + yy) * 80;
232 for(x = 0; x < 10; x++) {
233 for(ii = 0; ii < 8; ii++) {
234 GETVRAM_1_400L_GREEN(yoff + ii, p);
242 for(yy = 0; yy < 8; yy++) {
243 if(!(vram_draw_table[y + yy] | ff)) continue;
244 vram_draw_table[y + yy] = false;
245 p = emu->get_screen_buffer(y + yy);
246 if(p == NULL) continue;
247 yoff = (y + yy) * 80;
248 for(x = 0; x < 10; x++) {
249 for(ii = 0; ii < 8; ii++) {
250 GETVRAM_1_400L(yoff + ii, p);
271 for(x = 0; x < xlim; x++) {
272 naddr = (text_start_addr.w.l + ((y / text_lines) * text_xmax + x) * 2) & 0x0ffe;
273 charcode = text_vram[naddr];
274 attr_code = text_vram[naddr + 1];
276 on_color = GETVRAM_TEXTCOLOR(attr_code, do_green);
278 display_char = ((attr_code & 0x10) == 0);
279 reverse = ((attr_code & 0x08) != 0);
281 for(yy = 0; yy < 16; yy++) {
282 raster = y % text_lines;
284 p = emu->get_screen_buffer(y + yy);
285 if(p == NULL) continue;
286 if((raster < 16) && (display_char || text_blink)) {
287 bitdata = subsys_cg_l4[(uint32_t)charcode * 16 + (uint32_t)raster];
290 if((naddr == (uint32_t)(cursor_addr.w.l)) && (cursor_type != 1) &&
291 (text_blink || (cursor_type == 0))) {
292 if((raster >= cursor_start) && (raster <= cursor_end)) {
296 bitdata = GETVRAM_TEXTPIX(bitdata, reverse, cursor_rev);
299 scrntype_t *pp = &(p[x * 2]);
300 for(ii = 0; ii < 8; ii++) {
301 if((bitdata & 0x80) != 0) {
309 scrntype_t *pp = &(p[x * 2]);
310 for(ii = 0; ii < 8; ii++) {
311 if((bitdata & 0x80) != 0) {
323 if(ff) force_update = false;
327 # if defined(_FM77AV_VARIANTS)
328 if(display_mode == DISPLAY_MODE_4096) {
332 if(!multimode_dispflags[0]) mask = 0x00f;
333 if(!multimode_dispflags[1]) mask = mask | 0x0f0;
334 if(!multimode_dispflags[2]) mask = mask | 0xf00;
335 for(y = 0; y < 200; y += 4) {
336 for(yy = 0; yy < 4; yy++) {
337 if(!(vram_draw_table[y + yy] | ff)) continue;
338 vram_draw_table[y + yy] = false;
340 #if !defined(FIXED_FRAMEBUFFER_SIZE)
341 p = emu->get_screen_buffer(y + yy);
344 p = emu->get_screen_buffer((y + yy) * 2 );
345 p2 = emu->get_screen_buffer((y + yy) * 2 + 1);
347 if(p == NULL) continue;
348 yoff = (y + yy) * 40;
349 # if defined(_FM77AV40EX) || defined(_FM77AV40SX)
350 if(window_opened && (wy_low <= (y + yy)) && (wy_high > (y + yy))) {
351 for(x = 0; x < 40; x++) {
352 if((x >= wx_begin) && (x < wx_end)) {
353 GETVRAM_4096(yoff, p, p2, mask, true, scan_line);
355 GETVRAM_4096(yoff, p, p2, mask, false, scan_line);
357 #if defined(FIXED_FRAMEBUFFER_SIZE)
368 for(x = 0; x < 5; x++) {
369 for(ii = 0; ii < 8; ii++) {
370 GETVRAM_4096(yoff + ii, p, p2, mask, false, scan_line);
371 #if defined(FIXED_FRAMEBUFFER_SIZE)
384 if(ff) force_update = false;
387 # if defined(_FM77AV40) || defined(_FM77AV40EX) || defined(_FM77AV40SX)
388 else if(display_mode == DISPLAY_MODE_8_400L) {
391 //rgbmask = ~multimode_dispmask;
392 for(y = 0; y < 400; y += 8) {
393 for(yy = 0; yy < 8; yy++) {
394 if(!(vram_draw_table[y + yy] | ff)) continue;
395 vram_draw_table[y + yy] = false;
397 p = emu->get_screen_buffer(y + yy);
398 if(p == NULL) continue;
400 yoff = (y + yy) * 80;
401 # if defined(_FM77AV40EX) || defined(_FM77AV40SX)
402 if(window_opened && (wy_low <= (y + yy)) && (wy_high > (y + yy))) {
403 for(x = 0; x < 80; x++) {
404 if((x >= wx_begin) && (x < wx_end)) {
405 GETVRAM_8_400L(yoff, p, true);
407 GETVRAM_8_400L(yoff, p, false);
414 for(x = 0; x < 10; x++) {
416 for(ii = 0; ii < 8; ii++) {
417 GETVRAM_8_400L(yoff + ii, p);
424 if(ff) force_update = false;
426 } else if(display_mode == DISPLAY_MODE_256k) {
428 //rgbmask = ~multimode_dispmask;
430 for(y = 0; y < 200; y += 4) {
431 for(yy = 0; yy < 4; yy++) {
432 if(!(vram_draw_table[y + yy] | ff)) continue;
433 vram_draw_table[y + yy] = false;
434 #if !defined(FIXED_FRAMEBUFFER_SIZE)
435 p = emu->get_screen_buffer(y + yy);
438 p = emu->get_screen_buffer((y + yy) * 2 );
439 p2 = emu->get_screen_buffer((y + yy) * 2 + 1);
441 if(p == NULL) continue;
443 yoff = (y + yy) * 40;
445 for(x = 0; x < 5; x++) {
446 for(ii = 0; ii < 8; ii++) {
447 GETVRAM_256k(yoff + ii, p, p2, scan_line);
448 #if !defined(FIXED_FRAMEBUFFER_SIZE)
460 if(ff) force_update = false;
464 # endif //_FM77AV_VARIANTS
467 bool DISPLAY::screen_update(void)
470 bool f = screen_update_flag;
471 screen_update_flag = false;
474 if(crt_flag_bak) return true;
479 void DISPLAY::reset_screen_update(void)
481 screen_update_flag = false;
484 void DISPLAY::GETVRAM_8_200L(int yoff, scrntype_t *p,
491 #if defined(_FM77AV40EX) || defined(_FM77AV40SX)
492 int dpage = vram_display_block;
494 if(p == NULL) return;
496 yoff_d = (yoff + yoff_d) & 0x3fff;
498 #if defined(_FM77AV40EX) || defined(_FM77AV40SX)
506 if(dpage != 0) yoff_d += 0x18000;
509 #if defined(_FM77AV_VARIANTS)
510 if(display_page_bak == 1) yoff_d += 0xc000;
512 if(!multimode_dispflags[0]) b = gvram_shadow[yoff_d + 0x00000];
513 if(!multimode_dispflags[1]) r = gvram_shadow[yoff_d + 0x04000];
514 if(!multimode_dispflags[2]) g = gvram_shadow[yoff_d + 0x08000];
516 uint16_t *pg = &(bit_trans_table_0[g][0]);
517 uint16_t *pr = &(bit_trans_table_1[r][0]);
518 uint16_t *pb = &(bit_trans_table_2[b][0]);
520 scrntype_t tmp_dd[8];
522 __DECL_VECTORIZED_LOOP
523 for(int i = 0; i < 8; i++) {
525 tmp_d[i] = tmp_d[i] | pg[i];
526 tmp_d[i] = tmp_d[i] | pb[i];
527 tmp_d[i] = tmp_d[i] >> 5;
530 __DECL_VECTORIZED_LOOP
531 for(int i = 0; i < 8; i++) {
532 tmp_dd[i] = dpalette_pixel[tmp_d[i]];
534 #if defined(FIXED_FRAMEBUFFER_SIZE)
537 #if defined(_RGB555) || defined(_RGBA565)
538 static const int shift_factor = 2;
540 static const int shift_factor = 3;
542 __DECL_VECTORIZED_LOOP
543 for(int i = 0; i < 8; i++) {
545 tmp_dd[i] = (tmp_dd[i] >> shift_factor) & (const scrntype_t)RGBA_COLOR(31, 31, 31, 255);;
549 __DECL_VECTORIZED_LOOP
550 for(int i = 0; i < 8; i++) {
556 __DECL_VECTORIZED_LOOP
557 for(int i = 0; i < 8; i++) {
564 scrntype_t DISPLAY::GETVRAM_TEXTCOLOR(uint8_t attr, bool do_green)
566 int color = attr & 0x07;
569 static const int green_g_table[16] = {0, 24, 48, 64, 80, 96, 112, 128,
570 140, 155, 175, 186, 210, 220, 240, 255};
572 if((attr & 0x20) != 0) color += 8;
574 g = green_g_table[color];
576 r = (color - 9) * 16;
577 b = (color - 9) * 16;
580 if((attr & 0x20) != 0) {
581 g = ((color & 4) != 0) ? 255 : 0;
582 r = ((color & 2) != 0) ? 255 : 0;
583 b = ((color & 1) != 0) ? 255 : 0;
585 g = ((color & 4) != 0) ? 128 : 0;
586 r = ((color & 2) != 0) ? 128 : 0;
587 b = ((color & 1) != 0) ? 128 : 0;
590 return RGBA_COLOR(r, g, b, 255);
593 uint8_t DISPLAY::GETVRAM_TEXTPIX(uint8_t bitdata, bool reverse, bool cursor_rev)
595 uint8_t ret = bitdata;
597 ret = (uint8_t)(~ret);
600 ret = (uint8_t)(~ret);
605 void DISPLAY::GETVRAM_1_400L(int yoff, scrntype_t *p)
609 if(p == NULL) return;
610 yoff_d = yoff & 0x7fff;
611 pixel = gvram_shadow[yoff_d];
612 uint16_t *ppx = &(bit_trans_table_0[pixel][0]);
614 scrntype_t tmp_dd[8];
616 __DECL_VECTORIZED_LOOP
617 for(int i = 0; i < 8; i++) {
619 tmp_d[i] = tmp_d[i] >> 5;
622 __DECL_VECTORIZED_LOOP
623 for(int i = 0; i < 8; i++) {
624 tmp_dd[i] = dpalette_pixel[tmp_d[i]];
630 void DISPLAY::GETVRAM_1_400L_GREEN(int yoff, scrntype_t *p)
634 if(p == NULL) return;
635 yoff_d = yoff & 0x7fff;
636 pixel = gvram_shadow[yoff_d];
637 uint16_t *ppx = &(bit_trans_table_0[pixel][0]);
639 scrntype_t tmp_dd[8];
641 __DECL_VECTORIZED_LOOP
642 for(int i = 0; i < 8; i++) {
644 tmp_d[i] = tmp_d[i] >> 5;
647 __DECL_VECTORIZED_LOOP
648 for(int i = 0; i < 8; i++) {
649 tmp_dd[i] = dpalette_pixel_green[tmp_d[i]];
656 #if defined(USE_GREEN_DISPLAY)
657 void DISPLAY::GETVRAM_8_200L_GREEN(int yoff, scrntype_t *p,
664 #if defined(_FM77AV40EX) || defined(_FM77AV40SX)
665 int dpage = vram_display_block;
667 if(p == NULL) return;
669 yoff_d = (yoff + yoff_d) & 0x3fff;
672 if(!multimode_dispflags[0]) b = gvram_shadow[yoff_d + 0x00000];
673 if(!multimode_dispflags[1]) r = gvram_shadow[yoff_d + 0x04000];
674 if(!multimode_dispflags[2]) g = gvram_shadow[yoff_d + 0x08000];
676 uint16_t *pg = &(bit_trans_table_0[g][0]);
677 uint16_t *pr = &(bit_trans_table_1[r][0]);
678 uint16_t *pb = &(bit_trans_table_2[b][0]);
680 scrntype_t tmp_dd[8];
682 __DECL_VECTORIZED_LOOP
683 for(int i = 0; i < 8; i++) {
685 tmp_d[i] = tmp_d[i] | pg[i];
686 tmp_d[i] = tmp_d[i] | pb[i];
687 tmp_d[i] = tmp_d[i] >> 5;
690 __DECL_VECTORIZED_LOOP
691 for(int i = 0; i < 8; i++) {
692 tmp_dd[i] = dpalette_pixel_green[tmp_d[i]];
694 #if defined(FIXED_FRAMEBUFFER_SIZE)
697 #if defined(_RGB555) || defined(_RGBA565)
698 static const int shift_factor = 2;
700 static const int shift_factor = 3;
702 __DECL_VECTORIZED_LOOP
703 for(int i = 0; i < 8; i++) {
705 tmp_dd[i] = (tmp_dd[i] >> shift_factor) & (const scrntype_t)RGBA_COLOR(31, 31, 31, 255);;
709 __DECL_VECTORIZED_LOOP
710 for(int i = 0; i < 8; i++) {
716 __DECL_VECTORIZED_LOOP
717 for(int i = 0; i < 8; i++) {
724 #if defined(_FM77AV_VARIANTS)
725 void DISPLAY::GETVRAM_4096(int yoff, scrntype_t *p, scrntype_t *px,
731 uint8_t bb[4], rr[4], gg[4];
733 const uint16_t __masks[8] = {(uint16_t)mask, (uint16_t)mask, (uint16_t)mask, (uint16_t)mask, (uint16_t)mask, (uint16_t)mask, (uint16_t)mask, (uint16_t)mask};
739 # if defined(_FM77AV40EX) || defined(_FM77AV40SX)
740 int dpage = vram_display_block;
742 if(p == NULL) return;
746 # if defined(_FM77AV40EX) || defined(_FM77AV40SX)
759 bb[0] = gvram_shadow[yoff_d1];
760 bb[1] = gvram_shadow[yoff_d1 + 0x02000];
761 rr[0] = gvram_shadow[yoff_d1 + 0x04000];
762 rr[1] = gvram_shadow[yoff_d1 + 0x06000];
764 gg[0] = gvram_shadow[yoff_d1 + 0x08000];
765 gg[1] = gvram_shadow[yoff_d1 + 0x0a000];
767 bb[2] = gvram_shadow[yoff_d2 + 0x0c000];
768 bb[3] = gvram_shadow[yoff_d2 + 0x0e000];
770 rr[2] = gvram_shadow[yoff_d2 + 0x10000];
771 rr[3] = gvram_shadow[yoff_d2 + 0x12000];
772 gg[2] = gvram_shadow[yoff_d2 + 0x14000];
773 gg[3] = gvram_shadow[yoff_d2 + 0x16000];
775 uint16_t tmp_g[8], tmp_r[8], tmp_b[8];
776 uint16_t *p0, *p1, *p2, *p3;
777 #if !defined(FIXED_FRAMEBUFFER_SIZE)
778 scrntype_t tmp_dd[8];
780 scrntype_t tmp_dd[16];
783 p0 = &(bit_trans_table_0[gg[0]][0]);
784 p1 = &(bit_trans_table_1[gg[1]][0]);
785 p2 = &(bit_trans_table_2[gg[2]][0]);
786 p3 = &(bit_trans_table_3[gg[3]][0]);
787 __DECL_VECTORIZED_LOOP
788 for(int i = 0; i < 8; i++) {
790 tmp_g[i] = tmp_g[i] | p1[i];
791 tmp_g[i] = tmp_g[i] | p2[i];
792 tmp_g[i] = tmp_g[i] | p3[i];
795 p0 = &(bit_trans_table_0[rr[0]][0]);
796 p1 = &(bit_trans_table_1[rr[1]][0]);
797 p2 = &(bit_trans_table_2[rr[2]][0]);
798 p3 = &(bit_trans_table_3[rr[3]][0]);
799 __DECL_VECTORIZED_LOOP
800 for(int i = 0; i < 8; i++) {
802 tmp_r[i] = tmp_r[i] | p1[i];
803 tmp_r[i] = tmp_r[i] | p2[i];
804 tmp_r[i] = tmp_r[i] | p3[i];
807 p0 = &(bit_trans_table_0[bb[0]][0]);
808 p1 = &(bit_trans_table_1[bb[1]][0]);
809 p2 = &(bit_trans_table_2[bb[2]][0]);
810 p3 = &(bit_trans_table_3[bb[3]][0]);
811 __DECL_VECTORIZED_LOOP
812 for(int i = 0; i < 8; i++) {
814 tmp_b[i] = tmp_b[i] | p1[i];
815 tmp_b[i] = tmp_b[i] | p2[i];
816 tmp_b[i] = tmp_b[i] | p3[i];
818 __DECL_VECTORIZED_LOOP
819 for(int i = 0; i < 8; i++) {
821 pixels[i] = tmp_b[i] >> 4;
822 pixels[i] = pixels[i] | tmp_r[i];
823 pixels[i] = pixels[i] | tmp_g[i];
824 pixels[i] = pixels[i] & __masks[i];
826 //for(int i = 0; i < 8; i++) {
827 // pixels[i] = pixels[i] & mask;
829 #if !defined(FIXED_FRAMEBUFFER_SIZE)
830 __DECL_VECTORIZED_LOOP
831 for(int i = 0; i < 8; i++) {
832 tmp_dd[i] = analog_palette_pixel[pixels[i]];
836 __DECL_VECTORIZED_LOOP
837 for(int i = 0; i < 8; i++) {
838 tmp_dd[i * 2] = tmp_dd[i * 2 + 1] = analog_palette_pixel[pixels[i]];;
840 __DECL_VECTORIZED_LOOP
841 for(int i = 0; i < 16; i++) {
846 __DECL_VECTORIZED_LOOP
847 for(int i = 0; i < 16; i++) {
848 #if defined(_RGB888) || defined(_RGBA888)
849 tmp_dd[i] = tmp_dd[i] >> 3;
850 #elif defined(_RGB555)
851 tmp_dd[i] = tmp_dd[i] >> 2;
852 #elif defined(_RGB565)
853 tmp_dd[i] = tmp_dd[i] >> 2;
856 __DECL_VECTORIZED_LOOP
857 for(int i = 0; i < 16; i++) {
858 tmp_dd[i] = tmp_dd[i] & (const scrntype_t)RGBA_COLOR(31, 31, 31, 255);
862 __DECL_VECTORIZED_LOOP
863 for(int i = 0; i < 16; i++) {
872 #if defined(_FM77AV40) || defined(_FM77AV40EX) || defined(_FM77AV40SX)
873 void DISPLAY::GETVRAM_8_400L(int yoff, scrntype_t *p,
879 # if defined(_FM77AV40EX) || defined(_FM77AV40SX)
880 int dpage = vram_display_block;
882 if(p == NULL) return;
884 # if defined(_FM77AV40EX) || defined(_FM77AV40SX)
892 if(dpage != 0) yoff_d += 0x18000;
895 if(!multimode_dispflags[0]) b = gvram_shadow[yoff_d + 0x00000];
896 if(!multimode_dispflags[1]) r = gvram_shadow[yoff_d + 0x08000];
897 if(!multimode_dispflags[2]) g = gvram_shadow[yoff_d + 0x10000];
899 uint16_t *pg = &(bit_trans_table_0[g][0]);
900 uint16_t *pr = &(bit_trans_table_1[r][0]);
901 uint16_t *pb = &(bit_trans_table_2[b][0]);
904 __DECL_VECTORIZED_LOOP
905 for(int i = 0; i < 8; i++) {
906 tmp_d[i] = pg[i] | pr[i] | pb[i];
907 tmp_d[i] = tmp_d[i] >> 5;
909 __DECL_VECTORIZED_LOOP
910 for(int i = 0; i < 8; i++) {
911 p[i] = dpalette_pixel[tmp_d[i]];
915 void DISPLAY::GETVRAM_256k(int yoff, scrntype_t *p, scrntype_t *px, bool scan_line)
919 uint32_t btmp, rtmp, gtmp;
928 if(p == NULL) return;
937 uint8_t bb[8], rr[8], gg[8];
938 uint16_t *p0, *p1, *p2, *p3, *p4, *p5;
939 uint32_t _btmp[8], _rtmp[8], _gtmp[8];
940 #if !defined(FIXED_FRAMEBUFFER_SIZE)
941 scrntype_t tmp_dd[8];
943 scrntype_t tmp_dd[16];
946 if(!multimode_dispflags[0]) {
948 bb[0] = gvram_shadow[yoff_d1];
949 bb[1] = gvram_shadow[yoff_d1 + 0x02000];
951 bb[2] = gvram_shadow[yoff_d2 + 0x0c000];
952 bb[3] = gvram_shadow[yoff_d2 + 0x0e000];
954 bb[4] = gvram_shadow[yoff_d1 + 0x18000];
955 bb[5] = gvram_shadow[yoff_d1 + 0x1a000];
957 p0 = &(bit_trans_table_0[bb[0]][0]);
958 p1 = &(bit_trans_table_1[bb[1]][0]);
959 p2 = &(bit_trans_table_2[bb[2]][0]);
960 p3 = &(bit_trans_table_3[bb[3]][0]);
961 p4 = &(bit_trans_table_4[bb[4]][0]);
962 p5 = &(bit_trans_table_5[bb[5]][0]);
963 __DECL_VECTORIZED_LOOP
964 for(int i = 0; i < 8; i++) {
966 _btmp[i] = _btmp[i] | p1[i];
967 _btmp[i] = _btmp[i] | p2[i];
968 _btmp[i] = _btmp[i] | p3[i];
969 _btmp[i] = _btmp[i] | p4[i];
970 _btmp[i] = _btmp[i] | p5[i];
973 __DECL_VECTORIZED_LOOP
974 for(int i = 0; i < 8; i++) {
978 if(!multimode_dispflags[1]) {
981 rr[0] = gvram_shadow[yoff_d1 + 0x04000];
982 rr[1] = gvram_shadow[yoff_d1 + 0x06000];
984 rr[2] = gvram_shadow[yoff_d2 + 0x10000];
985 rr[3] = gvram_shadow[yoff_d2 + 0x12000];
987 rr[4] = gvram_shadow[yoff_d1 + 0x1c000];
988 rr[5] = gvram_shadow[yoff_d1 + 0x1e000];
990 p0 = &(bit_trans_table_0[rr[0]][0]);
991 p1 = &(bit_trans_table_1[rr[1]][0]);
992 p2 = &(bit_trans_table_2[rr[2]][0]);
993 p3 = &(bit_trans_table_3[rr[3]][0]);
994 p4 = &(bit_trans_table_4[rr[4]][0]);
995 p5 = &(bit_trans_table_5[rr[5]][0]);
996 __DECL_VECTORIZED_LOOP
997 for(int i = 0; i < 8; i++) {
999 _rtmp[i] = _rtmp[i] | p1[i];
1000 _rtmp[i] = _rtmp[i] | p2[i];
1001 _rtmp[i] = _rtmp[i] | p3[i];
1002 _rtmp[i] = _rtmp[i] | p4[i];
1003 _rtmp[i] = _rtmp[i] | p5[i];
1006 __DECL_VECTORIZED_LOOP
1007 for(int i = 0; i < 8; i++) {
1011 if(!multimode_dispflags[2]) {
1014 gg[0] = gvram_shadow[yoff_d1 + 0x08000];
1015 gg[1] = gvram_shadow[yoff_d1 + 0x0a000];
1017 gg[2] = gvram_shadow[yoff_d2 + 0x14000];
1018 gg[3] = gvram_shadow[yoff_d2 + 0x16000];
1020 gg[4] = gvram_shadow[yoff_d1 + 0x20000];
1021 gg[5] = gvram_shadow[yoff_d1 + 0x22000];
1023 p0 = &(bit_trans_table_0[gg[0]][0]);
1024 p1 = &(bit_trans_table_1[gg[1]][0]);
1025 p2 = &(bit_trans_table_2[gg[2]][0]);
1026 p3 = &(bit_trans_table_3[gg[3]][0]);
1027 p4 = &(bit_trans_table_4[gg[4]][0]);
1028 p5 = &(bit_trans_table_5[gg[5]][0]);
1029 __DECL_VECTORIZED_LOOP
1030 for(int i = 0; i < 8; i++) {
1032 _gtmp[i] = _gtmp[i] | p1[i];
1033 _gtmp[i] = _gtmp[i] | p2[i];
1034 _gtmp[i] = _gtmp[i] | p3[i];
1035 _gtmp[i] = _gtmp[i] | p4[i];
1036 _gtmp[i] = _gtmp[i] | p5[i];
1039 __DECL_VECTORIZED_LOOP
1040 for(int i = 0; i < 8; i++) {
1044 #if !defined(FIXED_FRAMEBUFFER_SIZE)
1045 __DECL_VECTORIZED_LOOP
1046 for(int i = 0; i < 8; i++) {
1047 tmp_dd[i] = RGB_COLOR(_rtmp[i], _gtmp[i], _btmp[i]);
1051 __DECL_VECTORIZED_LOOP
1052 for(int i = 0; i < 8; i++) {
1053 tmp_dd[i * 2] = tmp_dd[i * 2 + 1] = RGB_COLOR(_rtmp[i], _gtmp[i], _btmp[i]);
1055 __DECL_VECTORIZED_LOOP
1056 for(int i = 0; i < 16; i++) {
1060 /* Fancy scanline */
1061 __DECL_VECTORIZED_LOOP
1062 for(int i = 0; i < 16; i++) {
1063 #if defined(_RGB888) || defined(_RGBA888)
1064 tmp_dd[i] = tmp_dd[i] >> 3;
1065 #elif defined(_RGB555)
1066 tmp_dd[i] = tmp_dd[i] >> 2;
1067 #elif defined(_RGB565)
1068 tmp_dd[i] = tmp_dd[i] >> 2;
1071 __DECL_VECTORIZED_LOOP
1072 for(int i = 0; i < 16; i++) {
1073 tmp_dd[i] = tmp_dd[i] & RGBA_COLOR(31, 31, 31, 256);
1077 __DECL_VECTORIZED_LOOP
1078 for(int i = 0; i < 16; i++) {