prepare for 5E01

This commit is contained in:
tildearrow 2024-03-18 14:22:05 -05:00
parent cb2aeb649f
commit 3423ac8774
8 changed files with 46 additions and 5 deletions

View file

@ -239,11 +239,12 @@ size | description
| - 0xd2: Ensoniq ES5503 (hard pan) - 32 channels (UNAVAILABLE)
| - 0xd4: PowerNoise - 4 channels
| - 0xd5: Dave - 6 channels
| - 0xd6: NDS - 16 channels (UNAVAILABLE)
| - 0xd7: Game Boy Advance (direct) - 2 channels (UNAVAILABLE)
| - 0xd8: Game Boy Advance (MinMod) - 16 channels (UNAVAILABLE)
| - 0xd6: NDS - 16 channels
| - 0xd7: Game Boy Advance (direct) - 2 channels
| - 0xd8: Game Boy Advance (MinMod) - 16 channels
| - 0xde: YM2610B extended - 19 channels
| - 0xe0: QSound - 19 channels
| - 0xf1: 5E01 - 5 channels
| - 0xfc: Pong - 1 channel
| - 0xfd: Dummy System - 8 channels
| - 0xfe: reserved for development

View file

@ -310,6 +310,7 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
} else {
((DivPlatformNES*)dispatch)->setNSFPlay(eng->getConfInt("nesCore",0)==1);
}
((DivPlatformNES*)dispatch)->set5E01(false);
break;
case DIV_SYSTEM_C64_6581:
dispatch=new DivPlatformC64;
@ -673,6 +674,15 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
case DIV_SYSTEM_NDS:
dispatch=new DivPlatformNDS;
break;
case DIV_SYSTEM_5E01:
dispatch=new DivPlatformNES;
if (isRender) {
((DivPlatformNES*)dispatch)->setNSFPlay(eng->getConfInt("nesCoreRender",0)==1);
} else {
((DivPlatformNES*)dispatch)->setNSFPlay(eng->getConfInt("nesCore",0)==1);
}
((DivPlatformNES*)dispatch)->set5E01(true);
break;
case DIV_SYSTEM_DUMMY:
dispatch=new DivPlatformDummy;
break;

View file

@ -723,8 +723,7 @@ bool DivEngine::loadFTM(unsigned char* file, size_t len, bool dnft, bool dnft_si
}
}
if (expansions & 256) {
// TODO: change when 5E01 is added
ds.system[systemID++] = DIV_SYSTEM_NES;
ds.system[systemID++] = DIV_SYSTEM_5E01;
for (int ch = 0; ch < 5; ch++) {
map_channels[curr_chan] = map_ch;

View file

@ -817,6 +817,10 @@ void DivPlatformNES::setNSFPlay(bool use) {
useNP=use;
}
void DivPlatformNES::set5E01(bool use) {
isE=use;
}
unsigned char DivPlatformNES::readDMC(unsigned short addr) {
return dpcmMem[(addr&0x3fff)|((dpcmBank&15)<<14)];
}

View file

@ -62,6 +62,7 @@ class DivPlatformNES: public DivDispatch {
bool useNP;
bool goingToLoop;
bool countMode;
bool isE;
struct NESAPU* nes;
xgm::NES_APU* nes1_NP;
xgm::NES_DMC* nes2_NP;
@ -93,6 +94,7 @@ class DivPlatformNES: public DivDispatch {
float getPostAmp();
unsigned char readDMC(unsigned short addr);
void setNSFPlay(bool use);
void set5E01(bool use);
void setFlags(const DivConfig& flags);
void notifyInsDeletion(void* ins);
void poke(unsigned int addr, unsigned short val);

View file

@ -138,6 +138,7 @@ enum DivSystem {
DIV_SYSTEM_NDS,
DIV_SYSTEM_GBA_DMA,
DIV_SYSTEM_GBA_MINMOD,
DIV_SYSTEM_5E01,
};
enum DivEffectType: unsigned short {

View file

@ -2069,6 +2069,28 @@ void DivEngine::registerSystems() {
}
);
sysDefs[DIV_SYSTEM_5E01]=new DivSysDef(
"5E01", NULL, 0xf1, 0, 5, false, true, 0x161, false, (1U<<DIV_SAMPLE_DEPTH_1BIT_DPCM)|(1U<<DIV_SAMPLE_DEPTH_8BIT), 0, 0,
"a fantasy sound chip created by Euly. it is based on Ricoh 2A03, adding a couple features such as 32 noise pitches, an extra duty cycle, and three waveforms (besides triangle).",
{"Pulse 1", "Pulse 2", "Wave", "Noise", "DPCM"},
{"S1", "S2", "WA", "NO", "DMC"},
{DIV_CH_PULSE, DIV_CH_PULSE, DIV_CH_WAVE, DIV_CH_NOISE, DIV_CH_PCM},
{DIV_INS_NES, DIV_INS_NES, DIV_INS_NES, DIV_INS_NES, DIV_INS_NES},
{DIV_INS_NULL, DIV_INS_NULL, DIV_INS_NULL, DIV_INS_NULL, DIV_INS_AMIGA},
{
{0x11, {DIV_CMD_NES_DMC, "11xx: Write to delta modulation counter (0 to 7F)"}},
{0x12, {DIV_CMD_STD_NOISE_MODE, "12xx: Set duty cycle/noise mode/waveform (pulse/wave: 0 to 3; noise: 0 or 1)"}},
{0x13, {DIV_CMD_NES_SWEEP, "13xy: Sweep up (x: time; y: shift)",constVal<0>,effectVal}},
{0x14, {DIV_CMD_NES_SWEEP, "14xy: Sweep down (x: time; y: shift)",constVal<1>,effectVal}},
{0x15, {DIV_CMD_NES_ENV_MODE, "15xx: Set envelope mode (0: envelope, 1: length, 2: looping, 3: constant)"}},
{0x16, {DIV_CMD_NES_LENGTH, "16xx: Set length counter (refer to manual for a list of values)"}},
{0x17, {DIV_CMD_NES_COUNT_MODE, "17xx: Set frame counter mode (0: 4-step, 1: 5-step)"}},
{0x18, {DIV_CMD_SAMPLE_MODE, "18xx: Select PCM/DPCM mode (0: PCM; 1: DPCM)"}},
{0x19, {DIV_CMD_NES_LINEAR_LENGTH, "19xx: Set triangle linear counter (0 to 7F; 80 and higher halt)"}},
{0x20, {DIV_CMD_SAMPLE_FREQ, "20xx: Set DPCM frequency (0 to F)"}}
}
);
sysDefs[DIV_SYSTEM_DUMMY]=new DivSysDef(
"Dummy System", NULL, 0xfd, 0, 8, false, true, 0, false, 0, 0, 0,
"this is a system designed for testing purposes.",

View file

@ -1243,6 +1243,7 @@ const int availableSystems[]={
DIV_SYSTEM_POWERNOISE,
DIV_SYSTEM_DAVE,
DIV_SYSTEM_NDS,
DIV_SYSTEM_5E01,
0 // don't remove this last one!
};
@ -1335,6 +1336,7 @@ const int chipsSpecial[]={
DIV_SYSTEM_POWERNOISE,
DIV_SYSTEM_DAVE,
DIV_SYSTEM_NDS,
DIV_SYSTEM_5E01,
0 // don't remove this last one!
};