YM2608: add memory type setting

VGM players expect RAM

breaks YM2608-LLE until I implement RAM!
This commit is contained in:
tildearrow 2025-04-29 16:45:40 -05:00
parent 0812607f41
commit 77cec37270
3 changed files with 43 additions and 6 deletions

View file

@ -997,7 +997,7 @@ void DivPlatformYM2608::tick(bool sysTick) {
if (chan[(15+isCSM)].pan!=(chan[(15+isCSM)].std.panL.val&3)) {
chan[(15+isCSM)].pan=chan[(15+isCSM)].std.panL.val&3;
if (!isMuted[(15 + isCSM)]) {
immWrite(0x101,(isMuted[(15 + isCSM)]?0:(chan[(15+isCSM)].pan<<6))|1);
immWrite(0x101,(isMuted[(15 + isCSM)]?0:(chan[(15+isCSM)].pan<<6))|memConfig);
hardResetElapsed++;
}
}
@ -1162,7 +1162,7 @@ int DivPlatformYM2608::dispatch(DivCommand c) {
int end=sampleOffB[chan[c.chan].sample]+s->lengthB-1;
immWrite(0x104,(end>>5)&0xff);
immWrite(0x105,(end>>13)&0xff);
immWrite(0x101,(isMuted[c.chan]?0:(chan[c.chan].pan<<6))|1);
immWrite(0x101,(isMuted[c.chan]?0:(chan[c.chan].pan<<6))|memConfig);
if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].note=c.value;
chan[c.chan].baseFreq=NOTE_ADPCMB(chan[c.chan].note);
@ -1194,7 +1194,7 @@ int DivPlatformYM2608::dispatch(DivCommand c) {
int end=sampleOffB[chan[c.chan].sample]+s->lengthB-1;
immWrite(0x104,(end>>5)&0xff);
immWrite(0x105,(end>>13)&0xff);
immWrite(0x101,(isMuted[c.chan]?0:(chan[c.chan].pan<<6))|1);
immWrite(0x101,(isMuted[c.chan]?0:(chan[c.chan].pan<<6))|memConfig);
int freq=(65536.0*(double)s->rate)/((double)chipClock/144.0);
immWrite(0x109,freq&0xff);
immWrite(0x10a,(freq>>8)&0xff);
@ -1338,7 +1338,7 @@ int DivPlatformYM2608::dispatch(DivCommand c) {
chan[c.chan].pan=(c.value2>0)|((c.value>0)<<1);
}
if (c.chan>(14+isCSM)) {
immWrite(0x101,(isMuted[c.chan]?0:(chan[c.chan].pan<<6))|1);
immWrite(0x101,(isMuted[c.chan]?0:(chan[c.chan].pan<<6))|memConfig);
break;
}
if (c.chan>(8 + isCSM)) {
@ -1683,7 +1683,7 @@ int DivPlatformYM2608::dispatch(DivCommand c) {
void DivPlatformYM2608::muteChannel(int ch, bool mute) {
isMuted[ch]=mute;
if (ch>(14+isCSM)) { // ADPCM-B
immWrite(0x101,(isMuted[ch]?0:(chan[ch].pan<<6))|1);
immWrite(0x101,(isMuted[ch]?0:(chan[ch].pan<<6))|memConfig);
}
if (ch>(8+isCSM)) { // ADPCM-A
immWrite(0x18+(ch-9),isMuted[ch]?0:((chan[ch].pan<<6)|chan[ch].outVol));
@ -2042,6 +2042,10 @@ void DivPlatformYM2608::setFlags(const DivConfig& flags) {
fbAllOps=flags.getBool("fbAllOps",false);
ssgVol=flags.getInt("ssgVol",128);
fmVol=flags.getInt("fmVol",256);
memConfig=flags.getBool("memROM",false)?1:0;
memConfig|=flags.getBool("memParallel",true)?2:0;
if (useCombo==2) {
rate=chipClock/(fmDivBase*2);
} else {

View file

@ -76,7 +76,7 @@ class DivPlatformYM2608: public DivPlatformOPN {
int globalRSSVolume;
bool extMode, noExtMacros;
unsigned char prescale, nukedMult;
unsigned char prescale, nukedMult, memConfig;
DivMemoryComposition memCompo;

View file

@ -1428,6 +1428,8 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
int prescale=flags.getInt("prescale",0);
bool noExtMacros=flags.getBool("noExtMacros",false);
bool fbAllOps=flags.getBool("fbAllOps",false);
bool memROM=flags.getBool("memROM",false);
bool memParallel=flags.getBool("memParallel",true);
int ssgVol=flags.getInt("ssgVol",128);
int fmVol=flags.getInt("fmVol",256);
@ -1470,6 +1472,35 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
altered=true;
} rightClickable
ImGui::TextUnformatted(_("Memory type:"));
ImGui::Indent();
if (ImGui::RadioButton(_("Parallel RAM (8-bit)"),(!memROM && memParallel))) {
memROM=false;
memParallel=true;
altered=true;
mustRender=true;
}
/*
if (ImGui::RadioButton(_("Serial RAM (1-bit)"),(!memROM && !memParallel))) {
memROM=false;
memParallel=false;
altered=true;
mustRender=true;
}*/
if (ImGui::RadioButton(_("ROM"),(memROM && !memParallel))) {
memROM=true;
memParallel=false;
altered=true;
mustRender=true;
}
if (!memROM && !memParallel) {
ImGui::Text(_("I have not implemented serial memory yet!"));
}
if (memROM && memParallel) {
ImGui::Text(_("Congratulations! You found the invalid option!"));
}
ImGui::Unindent();
if (type==DIV_SYSTEM_YM2608_EXT || type==DIV_SYSTEM_YM2608_CSM) {
if (ImGui::Checkbox(_("Disable ExtCh FM macros (compatibility)"),&noExtMacros)) {
altered=true;
@ -1485,6 +1516,8 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
flags.set("prescale",prescale);
flags.set("noExtMacros",noExtMacros);
flags.set("fbAllOps",fbAllOps);
flags.set("memROM",memROM);
flags.set("memParallel",memParallel);
flags.set("ssgVol",ssgVol);
flags.set("fmVol",fmVol);
});