comparison genesis.c @ 1108:87114df913ec

Fix Z80 interrupt pulse duration. Fixes inconsistent music playback speed in Sonic 2 introduced in 0.4.1
author Michael Pavone <pavone@retrodev.com>
date Wed, 14 Dec 2016 20:20:34 -0800
parents 27ea21b10361
children 2eb54e24914e
comparison
equal deleted inserted replaced
1107:fc125af5e4f1 1108:87114df913ec
95 #else 95 #else
96 #define dprintf 96 #define dprintf
97 #define dputs 97 #define dputs
98 #endif 98 #endif
99 99
100 #define Z80_VINT_DURATION 128
101
102 void z80_next_int_pulse(z80_context * z_context) 100 void z80_next_int_pulse(z80_context * z_context)
103 { 101 {
104 genesis_context * gen = z_context->system; 102 genesis_context * gen = z_context->system;
105 z_context->int_pulse_start = vdp_next_vint_z80(gen->vdp); 103 z_context->int_pulse_start = vdp_next_vint_z80(gen->vdp);
106 z_context->int_pulse_end = z_context->int_pulse_start + Z80_VINT_DURATION * MCLKS_PER_Z80; 104 //Notes in the Genesis Plus GX code suggest this is asserted for one line
107 } 105 z_context->int_pulse_end = z_context->int_pulse_start + MCLKS_LINE;
106 }
108 107
109 void sync_z80(z80_context * z_context, uint32_t mclks) 108 void sync_z80(z80_context * z_context, uint32_t mclks)
110 { 109 {
111 #ifndef NO_Z80 110 #ifndef NO_Z80
112 if (z80_enabled) { 111 if (z80_enabled) {