comparison cd_graphics.c @ 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 c3241eff3c3a
children da326c32ad8f
comparison
equal deleted inserted replaced
2091:36a9cf4db65f 2092:8665d8da0e1c
212 cd->graphics_pixels[0] = get_src_pixel(cd); 212 cd->graphics_pixels[0] = get_src_pixel(cd);
213 cd->graphics_cycle += 2*4; 213 cd->graphics_cycle += 2*4;
214 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))) { 214 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))) {
215 cd->graphics_step = DRAW; 215 cd->graphics_step = DRAW;
216 CHECK_ONLY; 216 CHECK_ONLY;
217 goto draw;
217 } else { 218 } else {
218 CHECK_CYCLES; 219 CHECK_CYCLES;
219 } 220 }
220 case PIXEL1: 221 case PIXEL1:
221 cd->graphics_pixels[1] = get_src_pixel(cd); 222 cd->graphics_pixels[1] = get_src_pixel(cd);
222 cd->graphics_cycle += 2*4; 223 cd->graphics_cycle += 2*4;
223 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))) { 224 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))) {
224 cd->graphics_step = DRAW; 225 cd->graphics_step = DRAW;
225 CHECK_ONLY; 226 CHECK_ONLY;
227 goto draw;
226 } else { 228 } else {
227 CHECK_CYCLES; 229 CHECK_CYCLES;
228 } 230 }
229 case PIXEL2: 231 case PIXEL2:
230 cd->graphics_pixels[2] = get_src_pixel(cd); 232 cd->graphics_pixels[2] = get_src_pixel(cd);
231 cd->graphics_cycle += 2*4; 233 cd->graphics_cycle += 2*4;
232 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))) { 234 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))) {
233 cd->graphics_step = DRAW; 235 cd->graphics_step = DRAW;
234 CHECK_ONLY; 236 CHECK_ONLY;
237 goto draw;
235 } else { 238 } else {
236 CHECK_CYCLES; 239 CHECK_CYCLES;
237 } 240 }
238 case PIXEL3: 241 case PIXEL3:
239 cd->graphics_pixels[3] = get_src_pixel(cd); 242 cd->graphics_pixels[3] = get_src_pixel(cd);
240 cd->graphics_cycle += 2*4; 243 cd->graphics_cycle += 2*4;
241 CHECK_CYCLES; 244 CHECK_CYCLES;
245 draw:
242 case DRAW: 246 case DRAW:
243 draw_pixels(cd); 247 draw_pixels(cd);
244 cd->graphics_cycle += 1*4; 248 cd->graphics_cycle += 1*4;
245 if (!cd->gate_array[GA_IMAGE_BUFFER_LINES]) { 249 if (!cd->gate_array[GA_IMAGE_BUFFER_LINES]) {
246 break; 250 break;