comparison genesis.c @ 2571:3d14db924e57

DMA fill and copy should not block VDP data or control port writes
author Michael Pavone <pavone@retrodev.com>
date Sun, 02 Feb 2025 00:31:58 -0800
parents f0ace2494df6
children 5f725429d08f
comparison
equal deleted inserted replaced
2570:882ceef923e0 2571:3d14db924e57
992 uint32_t before_cycle = v_context->cycles; 992 uint32_t before_cycle = v_context->cycles;
993 uint8_t did_dma = 0; 993 uint8_t did_dma = 0;
994 if (vdp_port < 0x10) { 994 if (vdp_port < 0x10) {
995 int blocked; 995 int blocked;
996 if (vdp_port < 4) { 996 if (vdp_port < 4) {
997 while (vdp_data_port_write(v_context, value) < 0) { 997 vdp_data_port_write(v_context, value);
998 while(v_context->flags & FLAG_DMA_RUN) {
999 did_dma = 1;
1000 vdp_run_dma_done(v_context, gen->frame_end);
1001 if (v_context->cycles >= gen->frame_end) {
1002 uint32_t cycle_diff = v_context->cycles - context->cycles;
1003 uint32_t m68k_cycle_diff = (cycle_diff / MCLKS_PER_68K) * MCLKS_PER_68K;
1004 if (m68k_cycle_diff < cycle_diff) {
1005 m68k_cycle_diff += MCLKS_PER_68K;
1006 }
1007 context->cycles += m68k_cycle_diff;
1008 gen->bus_busy = 1;
1009 if (gen->header.type == SYSTEM_PICO || gen->header.type == SYSTEM_COPERA) {
1010 sync_components_pico(context, 0);
1011 } else {
1012 sync_components(context, 0);
1013 }
1014 gen->bus_busy = 0;
1015 }
1016 }
1017 //context->cycles = v_context->cycles;
1018 }
1019 } else if(vdp_port < 8) { 998 } else if(vdp_port < 8) {
1020 vdp_run_context_full(v_context, context->cycles); 999 vdp_run_context_full(v_context, context->cycles);
1021 before_cycle = v_context->cycles; 1000 before_cycle = v_context->cycles;
1022 blocked = vdp_control_port_write(v_context, value, context->cycles); 1001 blocked = vdp_control_port_write(v_context, value, context->cycles);
1023 if (blocked) { 1002 if (blocked) {