changeset 2092:8665d8da0e1c

Fix infinite loop in Sega CD graphics coprocessor code
author Michael Pavone <pavone@retrodev.com>
date Sun, 06 Feb 2022 22:52:24 -0800
parents 36a9cf4db65f
children 46ee354f29bd
files cd_graphics.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/cd_graphics.c	Sun Feb 06 22:24:42 2022 -0800
+++ b/cd_graphics.c	Sun Feb 06 22:52:24 2022 -0800
@@ -214,6 +214,7 @@
 			if ((cd->graphics_dst_x & 3) == 3 || (cd->graphics_dst_x + 1 == cd->gate_array[GA_IMAGE_BUFFER_HDOTS] + (cd->gate_array[GA_IMAGE_BUFFER_OFFSET] & 3))) {
 				cd->graphics_step = DRAW;
 				CHECK_ONLY;
+				goto draw;
 			} else {
 				CHECK_CYCLES;
 			}
@@ -223,6 +224,7 @@
 			if ((cd->graphics_dst_x & 3) == 2 || (cd->graphics_dst_x + 2 == cd->gate_array[GA_IMAGE_BUFFER_HDOTS] + (cd->gate_array[GA_IMAGE_BUFFER_OFFSET] & 3))) {
 				cd->graphics_step = DRAW;
 				CHECK_ONLY;
+				goto draw;
 			} else {
 				CHECK_CYCLES;
 			}
@@ -232,6 +234,7 @@
 			if ((cd->graphics_dst_x & 3) == 1 || (cd->graphics_dst_x + 3 == cd->gate_array[GA_IMAGE_BUFFER_HDOTS] + (cd->gate_array[GA_IMAGE_BUFFER_OFFSET] & 3))) {
 				cd->graphics_step = DRAW;
 				CHECK_ONLY;
+				goto draw;
 			} else {
 				CHECK_CYCLES;
 			}
@@ -239,6 +242,7 @@
 			cd->graphics_pixels[3] = get_src_pixel(cd);
 			cd->graphics_cycle += 2*4;
 			CHECK_CYCLES;
+draw:
 		case DRAW:
 			draw_pixels(cd);
 			cd->graphics_cycle += 1*4;