I just discovered two lines that aren't necessary in the FM code. More importantly, removing these two lines fixes some problems resulting from me not sanity-checking the cycle length (I don't advise playing Guardian Force in the 0.122u5 version of MAME - it has a tendency to enter an infinite loop after pressing start on the title screen).
Patch:
Code
diff -Nru aosdk_base/eng_ssf/scsp.c aosdk/eng_ssf/scsp.c
--- aosdk_base/eng_ssf/scsp.c 2008-01-13 00:54:50.000000000 -0800
+++ aosdk/eng_ssf/scsp.c 2008-01-13 00:54:35.000000000 -0800
@@ -1122,11 +1122,9 @@
if(MDL(slot)!=0 || MDXSL(slot)!=0 || MDYSL(slot)!=0)
{
INT32 smp=(SCSP->RINGBUF[(SCSP->BUFPTR+MDXSL(slot))&63]+SCSP->RINGBUF[(SCSP->BUFPTR+MDYSL(slot))&63])/2;
- INT32 cycle=LEA(slot)-LSA(slot); // cycle corresponds to 2 pi
smp<<=0xA; // associate cycle with 1024
smp>>=0x1A-MDL(slot); // ex. for MDL=0xF, sample range corresponds to +/- 64 pi (32=2^5 cycles) so shift by 11 (16-5 == 0x1A-0xF)
- while(smp<0) smp+=cycle; smp%=cycle; // keep modulation sampler within a single cycle
if(!PCM8B(slot)) smp<<=1;
addr1+=smp; addr2+=smp;