arcade: add effects to control AMD/PMD

This commit is contained in:
tildearrow 2022-01-20 17:54:11 -05:00
parent e10f61eda2
commit 730561d3a3
5 changed files with 29 additions and 2 deletions

View file

@ -25,6 +25,8 @@ the actual PCM chip had 16 channels, but the number has been cut to 5 in DefleMa
- `1Bxx`: set attack of operator 2.
- `1Cxx`: set attack of operator 3.
- `1Dxx`: set attack of operator 4.
- `1Exx`: set AM depth.
- `1Fxx`: set PM depth.
- `20xx`: set PCM frequency.
- only works on the PCM channels.
- `xx` is a 256th fraction of 31250Hz.

View file

@ -35,6 +35,8 @@ enum DivDispatchCmds {
DIV_CMD_FM_FB,
DIV_CMD_FM_MULT,
DIV_CMD_FM_EXTCH,
DIV_CMD_FM_AM_DEPTH,
DIV_CMD_FM_PM_DEPTH,
DIV_CMD_GENESIS_LFO,

View file

@ -420,6 +420,16 @@ int DivPlatformArcade::dispatch(DivCommand c) {
}
break;
}
case DIV_CMD_FM_AM_DEPTH: {
amDepth=c.value;
immWrite(0x19,amDepth);
break;
}
case DIV_CMD_FM_PM_DEPTH: {
pmDepth=c.value;
immWrite(0x19,0x80|pmDepth);
break;
}
case DIV_CMD_STD_NOISE_FREQ: {
if (c.chan!=7) break;
if (c.value) {
@ -463,6 +473,8 @@ void DivPlatformArcade::forceIns() {
for (int i=0; i<13; i++) {
chan[i].insChanged=true;
}
immWrite(0x19,amDepth);
immWrite(0x19,0x80|pmDepth);
}
void DivPlatformArcade::notifyInsChange(int ins) {
@ -497,10 +509,12 @@ void DivPlatformArcade::reset() {
pcmR=0;
sampleBank=0;
delay=0;
amDepth=0x7f;
pmDepth=0x7f;
//rWrite(0x18,0x10);
immWrite(0x19,0x7f);
immWrite(0x19,0xff);
immWrite(0x19,amDepth);
immWrite(0x19,0x80|pmDepth);
//rWrite(0x1b,0x00);
extMode=false;

View file

@ -42,6 +42,7 @@ class DivPlatformArcade: public DivDispatch {
int pcmL, pcmR, pcmCycles;
unsigned char sampleBank;
unsigned char lastBusy;
unsigned char amDepth, pmDepth;
ymfm::ym2151* fm_ymfm;
ymfm::ym2151::output_data out_ymfm;

View file

@ -47,6 +47,8 @@ const char* cmdName[DIV_CMD_MAX]={
"FM_FB",
"FM_MULT",
"FM_EXTCH",
"FM_AM_DEPTH",
"FM_PM_DEPTH",
"GENESIS_LFO",
@ -250,6 +252,12 @@ bool DivEngine::perSystemPostEffect(int ch, unsigned char effect, unsigned char
case 0x1d: // AR op4
dispatchCmd(DivCommand(DIV_CMD_FM_AR,ch,3,effectVal&31));
break;
case 0x1e: // UNOFFICIAL: Arcade AM depth
dispatchCmd(DivCommand(DIV_CMD_FM_AM_DEPTH,ch,effectVal&127));
break;
case 0x1f: // UNOFFICIAL: Arcade PM depth
dispatchCmd(DivCommand(DIV_CMD_FM_PM_DEPTH,ch,effectVal&127));
break;
case 0x20: // PCM frequency or Neo Geo PSG mode
if (sysOfChan[ch]==DIV_SYSTEM_ARCADE || sysOfChan[ch]==DIV_SYSTEM_YM2151) {
dispatchCmd(DivCommand(DIV_CMD_SAMPLE_FREQ,ch,effectVal));