summaryrefslogtreecommitdiff
path: root/blastem.c
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2013-05-29 00:57:19 -0700
committerMike Pavone <pavone@retrodev.com>2013-05-29 00:57:19 -0700
commit54f3fab8efc17a607439cb61e82b1e640f36c99a (patch)
treea679ccd977607a939b0ecd734fc9ba5a5e7b3be4 /blastem.c
parent1d5e794755a615e3627550f8068213e9a23b17e7 (diff)
Incredibly broken YM2612 support plus a fix to Z80 bus request
Diffstat (limited to 'blastem.c')
-rw-r--r--blastem.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/blastem.c b/blastem.c
index e3f5744..affb600 100644
--- a/blastem.c
+++ b/blastem.c
@@ -198,7 +198,7 @@ m68k_context * sync_components(m68k_context * context, uint32_t address)
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 @@ m68k_context * io_write(uint32_t location, m68k_context * context, uint8_t value
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 @@ m68k_context * io_write_w(uint32_t location, m68k_context * context, uint16_t va
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 @@ void detect_region()
#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 @@ int main(int argc, char ** argv)
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());