diff render_sdl.c @ 28:037963b4c92d

Fix BG plane B render bug
author Mike Pavone <pavone@retrodev.com>
date Sat, 08 Dec 2012 19:42:07 -0800
parents f664eeb55cb4
children 2e15fa26fe58
line wrap: on
line diff
--- a/render_sdl.c	Sat Dec 08 16:58:11 2012 -0800
+++ b/render_sdl.c	Sat Dec 08 19:42:07 2012 -0800
@@ -73,13 +73,21 @@
         	}
         }
         for (int y = 224; y < 240; y++, buf_32 += (screen->pitch/4 - 320)) {
-        	for (int x = 0; x < 320; x++, buf_32++) {
-        		uint16_t gen_color = context->cram[x/10 + ((y-224)/8)*32];
+        	for (int x = 0; x < 256; x++, buf_32++) {
+        		uint16_t gen_color = context->cram[x/8 + ((y-224)/8)*32];
         		b = ((gen_color >> 8) & 0xE) * 18;
         		g = ((gen_color >> 4) & 0xE) * 18;
         		r = (gen_color& 0xE) * 18;
         		*buf_32 = SDL_MapRGB(screen->format, r, g, b);
         	}
+        	for (int x = 256; x < 320; x++, buf_32++) {
+        		if ((x/8 & 1) ^ (y/8 & 1)) {
+        			b = g = r = 255;
+        		} else {
+        			b = g = r = 0;
+        		}
+        		*buf_32 = SDL_MapRGB(screen->format, r, g, b);
+        	}
         }
     	break;
     }