diff --git a/papers/format.md b/papers/format.md index e28a14773..f979ee2f7 100644 --- a/papers/format.md +++ b/papers/format.md @@ -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 diff --git a/src/engine/dispatchContainer.cpp b/src/engine/dispatchContainer.cpp index 8d4983c77..0a88e5407 100644 --- a/src/engine/dispatchContainer.cpp +++ b/src/engine/dispatchContainer.cpp @@ -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; diff --git a/src/engine/fileOps/ftm.cpp b/src/engine/fileOps/ftm.cpp index 781a1be17..dde258f98 100644 --- a/src/engine/fileOps/ftm.cpp +++ b/src/engine/fileOps/ftm.cpp @@ -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; diff --git a/src/engine/platform/nes.cpp b/src/engine/platform/nes.cpp index c5993c624..d8dfba3d6 100644 --- a/src/engine/platform/nes.cpp +++ b/src/engine/platform/nes.cpp @@ -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)]; } diff --git a/src/engine/platform/nes.h b/src/engine/platform/nes.h index a2c1ed8ab..aaebb4d84 100644 --- a/src/engine/platform/nes.h +++ b/src/engine/platform/nes.h @@ -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); diff --git a/src/engine/song.h b/src/engine/song.h index f9ebc0c62..f9983ba9e 100644 --- a/src/engine/song.h +++ b/src/engine/song.h @@ -138,6 +138,7 @@ enum DivSystem { DIV_SYSTEM_NDS, DIV_SYSTEM_GBA_DMA, DIV_SYSTEM_GBA_MINMOD, + DIV_SYSTEM_5E01, }; enum DivEffectType: unsigned short { diff --git a/src/engine/sysDef.cpp b/src/engine/sysDef.cpp index 3f0b0c2e2..e3cbc2c94 100644 --- a/src/engine/sysDef.cpp +++ b/src/engine/sysDef.cpp @@ -2069,6 +2069,28 @@ void DivEngine::registerSystems() { } ); + sysDefs[DIV_SYSTEM_5E01]=new DivSysDef( + "5E01", NULL, 0xf1, 0, 5, false, true, 0x161, false, (1U<,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.", diff --git a/src/gui/guiConst.cpp b/src/gui/guiConst.cpp index b1734caf1..aee901f4d 100644 --- a/src/gui/guiConst.cpp +++ b/src/gui/guiConst.cpp @@ -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! };