Mercurial > repos > blastem
diff blastem.c @ 364:62177cc39049
Incredibly broken YM2612 support plus a fix to Z80 bus request
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 29 May 2013 00:57:19 -0700 |
parents | b7c3facee762 |
children | 836585d389b8 |
line wrap: on
line diff
--- a/blastem.c Wed May 29 00:13:48 2013 -0700 +++ b/blastem.c Wed May 29 00:57:19 2013 -0700 @@ -198,7 +198,7 @@ sync_z80(z_context, mclks); if (mclks >= mclks_per_frame) { ym_run(gen->ym, context->current_cycle); - gen->ym->current_cycle -= ((mclks_per_frame/MCLKS_PER_68K) / 6) * 6; + gen->ym->current_cycle -= mclks_per_frame/MCLKS_PER_68K; //printf("reached frame end | 68K Cycles: %d, MCLK Cycles: %d\n", context->current_cycle, mclks); vdp_run_context(v_context, mclks_per_frame); psg_run(gen->psg, mclks/MCLKS_PER_PSG); @@ -534,8 +534,8 @@ if(!reset && !busreq) { busack_cycle = ((gen->z80->current_cycle + Z80_ACK_DELAY) * MCLKS_PER_Z80) / MCLKS_PER_68K;//context->current_cycle + Z80_ACK_DELAY; new_busack = Z80_REQ_ACK; - busreq = 1; } + busreq = 1; } else { if (busreq) { dputs("releasing z80 bus"); @@ -635,8 +635,8 @@ if(!reset && !busreq) { busack_cycle = ((gen->z80->current_cycle + Z80_ACK_DELAY) * MCLKS_PER_Z80) / MCLKS_PER_68K;//context->current_cycle + Z80_ACK_DELAY; new_busack = Z80_REQ_ACK; - busreq = 1; } + busreq = 1; } else { if (busreq) { dprintf("releasing Z80 bus @ %d\n", (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80); @@ -1420,6 +1420,8 @@ #define PSG_CLKS_NTSC (3579545/16) #define PSG_CLKS_PAL (3546893/16) +#define YM_CLKS_NTSC 7670454 +#define YM_CLKS_PAL 7600485 int main(int argc, char ** argv) { @@ -1505,7 +1507,7 @@ init_vdp_context(&v_context); ym2612_context y_context; - ym_init(&y_context); + ym_init(&y_context, render_sample_rate(), fps == 60 ? YM_CLKS_NTSC : YM_CLKS_PAL, render_audio_buffer()); psg_context p_context; psg_init(&p_context, render_sample_rate(), fps == 60 ? PSG_CLKS_NTSC : PSG_CLKS_PAL, render_audio_buffer());