From 72ec155b38cad0dc5dad47cda0452fc7d71f6f9a Mon Sep 17 00:00:00 2001 From: ekeeke31 Date: Tue, 16 Jun 2009 15:51:29 +0000 Subject: [PATCH] ~ fixed a regression that broke STOP instruction behavior ~ modified LFO implementation to make it handles signed displacement value correctly (is that correct ? still need to be verified against real hardware) --- source/m68k/m68kcpu.c | 14 +++++++------- source/sound/ym2612.c | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/source/m68k/m68kcpu.c b/source/m68k/m68kcpu.c index bcafade..151ad57 100644 --- a/source/m68k/m68kcpu.c +++ b/source/m68k/m68kcpu.c @@ -836,13 +836,6 @@ extern uint32 count_m68k; void m68k_run (int cyc) { - /* Make sure we're not stopped */ - if(CPU_STOPPED) - { - count_m68k = cyc; - return; - } - int temp; /* Return point if we had an address error */ @@ -870,6 +863,13 @@ void m68k_run (int cyc) CPU_INT_CYCLES = 0; } + /* Make sure we're not stopped */ + if(CPU_STOPPED) + { + count_m68k = cyc; + return; + } + /* execute a single instruction */ count_m68k += m68k_execute(); } diff --git a/source/sound/ym2612.c b/source/sound/ym2612.c index d3c05e2..cda6040 100644 --- a/source/sound/ym2612.c +++ b/source/sound/ym2612.c @@ -30,7 +30,7 @@ ** - implemented correct SSG-EG emulation (Asterix, Beavis&Butthead, Bubba'n Six & many others) ** - adjusted some EG rates ** - modified address/data port behavior -** - fixed LFO implementation (only 11 bits of precision) +** - fixed Phase Modulation (LFO) calculations (precision reduced to 11 bits) ** ** TODO: complete SSG-EG documentation ** @@ -1244,8 +1244,8 @@ INLINE void update_phase_lfo_slot(FM_SLOT *SLOT , INT32 pms, UINT32 block_fnum) /* retrieve BLOCK register value */ UINT8 blk = (block_fnum >> 11) & 7; - /* increase FNUM register value */ - UINT32 fn = (block_fnum + lfo_fn_table_index_offset) & 0x7ff; + /* apply phase modulation to FNUM register value */ + UINT32 fn = (block_fnum + (UINT32)lfo_fn_table_index_offset) & 0x7ff; /* recalculate keyscale code */ int kc = (blk<<2) | opn_fktable[fn >> 7]; @@ -1277,8 +1277,8 @@ INLINE void update_phase_lfo_channel(FM_CH *CH) /* retrieve BLOCK register value */ UINT8 blk = (block_fnum >> 11) & 7; - /* increase FNUM register value */ - UINT32 fn = (block_fnum + lfo_fn_table_index_offset)& 0x7ff; + /* apply phase modulation to FNUM register value */ + UINT32 fn = (block_fnum + (UINT32)lfo_fn_table_index_offset) & 0x7ff; /* recalculate keyscale code */ int kc = (blk<<2) | opn_fktable[fn >> 7];