From 6f68fce01e5256d87c1f8ff48d3d397b646c4a4f Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Sun, 8 Sep 2013 20:46:25 -0700 Subject: Fix bit instruction timing --- m68k_to_x86.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/m68k_to_x86.c b/m68k_to_x86.c index 785dac3..e78fe0d 100644 --- a/m68k_to_x86.c +++ b/m68k_to_x86.c @@ -2952,7 +2952,9 @@ uint8_t * translate_m68k(uint8_t * dst, m68kinst * inst, x86_68k_options * opts) case M68K_BCLR: case M68K_BSET: case M68K_BTST: - dst = cycles(dst, inst->extra.size == OPSIZE_BYTE ? 4 : 6); + dst = cycles(dst, inst->extra.size == OPSIZE_BYTE ? 4 : ( + inst->op == M68K_BTST ? 6 : (inst->op == M68K_BCLR ? 10 : 8)) + ); if (src_op.mode == MODE_IMMED) { if (inst->extra.size == OPSIZE_BYTE) { src_op.disp &= 0x7; -- cgit v1.2.3 From 1b9e30c264d0af85666d89e8d62d054d847d2628 Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Sun, 8 Sep 2013 20:47:01 -0700 Subject: Remove extra 68K/VDP cycle sync --- blastem.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/blastem.c b/blastem.c index a2cae6c..c093402 100644 --- a/blastem.c +++ b/blastem.c @@ -347,7 +347,6 @@ m68k_context * vdp_port_write(uint32_t vdp_port, m68k_context * context, uint16_ blocked = 0; } } - context->current_cycle = v_context->cycles / MCLKS_PER_68K; } else { adjust_int_cycle(context, v_context); } @@ -356,7 +355,7 @@ m68k_context * vdp_port_write(uint32_t vdp_port, m68k_context * context, uint16_ exit(1); } if (v_context->cycles != before_cycle) { - //printf("68K paused for %d cycles at cycle %d\n", v_context->cycles / MCLKS_PER_68K - context->current_cycle, context->current_cycle); + //printf("68K paused for %d (%d) cycles at cycle %d (%d)\n", v_context->cycles / MCLKS_PER_68K - context->current_cycle, v_context->cycles - before_cycle, context->current_cycle, before_cycle); context->current_cycle = v_context->cycles / MCLKS_PER_68K; } } else if (vdp_port < 0x18) { @@ -420,7 +419,6 @@ uint16_t vdp_port_read(uint32_t vdp_port, m68k_context * context) value = vdp_hv_counter_read(v_context); //printf("HV Counter: %X at cycle %d\n", value, v_context->cycles); } - context->current_cycle = v_context->cycles/MCLKS_PER_68K; } else { printf("Illegal read from PSG or test register port %X\n", vdp_port); exit(1); -- cgit v1.2.3 From 773d8bb91c3d4684e3e6a76e8584e6a97eda31ec Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Sun, 8 Sep 2013 20:48:33 -0700 Subject: Revert change to VBLANK flag timing based on new direct color DMA test --- vdp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vdp.c b/vdp.c index 35b0acb..829cb23 100644 --- a/vdp.c +++ b/vdp.c @@ -1564,7 +1564,7 @@ uint16_t vdp_control_port_read(vdp_context * context) } uint32_t line= context->cycles / MCLKS_LINE; uint32_t linecyc = context->cycles % MCLKS_LINE; - if (line >= (context->latched_mode & BIT_PAL ? PAL_ACTIVE : NTSC_ACTIVE) || context->cycles < (context->latched_mode & BIT_H40 ? 16*4 : 16*5)) { + if (line >= (context->latched_mode & BIT_PAL ? PAL_ACTIVE : NTSC_ACTIVE)) { value |= 0x8; } if (linecyc < (context->latched_mode & BIT_H40 ? HBLANK_CLEAR_H40 : HBLANK_CLEAR_H32)) { @@ -1576,6 +1576,7 @@ uint16_t vdp_control_port_read(vdp_context * context) if (context->latched_mode & BIT_PAL) {//Not sure about this, need to verify value |= 0x1; } + //printf("status read at cycle %d returned %X\n", context->cycles, value); //TODO: Sprite overflow, sprite collision, odd frame flag return value; } -- cgit v1.2.3