Add VERA 47.0.3 chip type

This commit is contained in:
MooingLemur 2024-08-11 20:24:48 -07:00 committed by tildearrow
parent 45eab67fd4
commit a8122d3efd
3 changed files with 8 additions and 11 deletions

View file

@ -5,6 +5,7 @@
// Chip revisions
// 0: V 0.3.0
// 1: V 47.0.0 (9-bit volume, phase reset on mute)
// 2: V 47.0.3 (Pulse Width XOR on Saw and Triangle)
#include "vera_psg.h"
@ -88,8 +89,8 @@ render(struct VERA_PSG* psg, int16_t *left, int16_t *right)
uint8_t v = 0;
switch (ch->waveform) {
case WF_PULSE: v = (ch->phase >> 10) > ch->pw ? 0 : 63; break;
case WF_SAWTOOTH: v = ch->phase >> 11; break;
case WF_TRIANGLE: v = (ch->phase & 0x10000) ? (~(ch->phase >> 10) & 0x3F) : ((ch->phase >> 10) & 0x3F); break;
case WF_SAWTOOTH: v = (ch->phase >> 11) ^ (psg->chipType < 2 ? 0 : (ch->pw ^ 0x3f) & 0x3f); break;
case WF_TRIANGLE: v = ((ch->phase & 0x10000) ? (~(ch->phase >> 10) & 0x3F) : ((ch->phase >> 10) & 0x3F)) ^ (psg->chipType < 2 ? 0 : (ch->pw ^ 0x3f) & 0x3f); break;
case WF_NOISE: v = ch->noiseval; break;
}
int8_t sv = (v ^ 0x20);

View file

@ -133,14 +133,6 @@ void DivZSM::writePSG(unsigned char a, unsigned char v) {
} else if (a>=64) {
return writePCM(a-64,v);
}
if (optimize) {
if ((a&3)==3 && v>64) {
// Pulse width on non-pulse waves is nonsense and wasteful
// No need to preserve state here because the next write that
// selects pulse will also set the pulse width in this register
v&=0xc0;
}
}
if (psgState[psg_PREV][a]==v) {
if (psgState[psg_NEW][a]!=v) {
// NEW value is being reset to the same as PREV value

View file

@ -2482,7 +2482,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
break;
}
case DIV_SYSTEM_VERA: {
int chipType=flags.getInt("chipType",1);
int chipType=flags.getInt("chipType",2);
ImGui::Text(_("Chip revision:"));
ImGui::Indent();
@ -2494,6 +2494,10 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
chipType=1;
altered=true;
}
if (ImGui::RadioButton(_("V 47.0.3 (Tri/Saw PW XOR)"),chipType==2)) {
chipType=2;
altered=true;
}
ImGui::Unindent();
if (altered) {