diff --git a/CMakeLists.txt b/CMakeLists.txt index f12a98629..74d2c2ea5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -708,6 +708,7 @@ src/engine/platform/ted.cpp src/engine/platform/c140.cpp src/engine/platform/esfm.cpp src/engine/platform/powernoise.cpp +src/engine/platform/dave.cpp src/engine/platform/pcmdac.cpp src/engine/platform/dummy.cpp @@ -918,6 +919,12 @@ set(USED_SOURCES ${ENGINE_SOURCES} ${AUDIO_SOURCES} ${CLI_SOURCES} src/main.cpp) if (USE_BACKWARD) list(APPEND USED_SOURCES src/backtrace.cpp) if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag(-gcodeview GCC_CODEVIEW) + if (GCC_CODEVIEW) + set(CMAKE_EXE_LINKER_FLAGS "-Wl,--pdb= ") + add_compile_options(-gcodeview) + endif() list(APPEND DEPENDENCIES_LIBRARIES dbghelp psapi) endif() find_library(EXECINFO_IS_LIBRARY execinfo) diff --git a/src/engine/instrument.cpp b/src/engine/instrument.cpp index 990af8da3..31be38638 100644 --- a/src/engine/instrument.cpp +++ b/src/engine/instrument.cpp @@ -1062,6 +1062,8 @@ void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song, bo case DIV_INS_POWERNOISE_SLOPE: featurePN=true; break; + case DIV_INS_DAVE: + break; case DIV_INS_MAX: break; case DIV_INS_NULL: diff --git a/src/engine/instrument.h b/src/engine/instrument.h index 80bd8f251..14cc1cfec 100644 --- a/src/engine/instrument.h +++ b/src/engine/instrument.h @@ -88,6 +88,7 @@ enum DivInstrumentType: unsigned short { DIV_INS_ESFM=55, DIV_INS_POWERNOISE=56, DIV_INS_POWERNOISE_SLOPE=57, + DIV_INS_DAVE=58, DIV_INS_MAX, DIV_INS_NULL }; diff --git a/src/engine/platform/dave.cpp b/src/engine/platform/dave.cpp index c98469b36..3adb368af 100644 --- a/src/engine/platform/dave.cpp +++ b/src/engine/platform/dave.cpp @@ -24,15 +24,6 @@ //#define rWrite(a,v) pendingWrites[a]=v; #define rWrite(a,v) if (!skipRegisterWrites) {writes.push(QueuedWrite(a,v)); if (dumpWrites) {addWrite(a,v);} } -#define chWrite(c,a,v) \ - if (!skipRegisterWrites) { \ - if (curChan!=c) { \ - curChan=c; \ - rWrite(0,curChan); \ - } \ - regPool[16+((c)<<4)+((a)&0x0f)]=v; \ - rWrite(a,v); \ - } #define CHIP_DIVIDER 32 @@ -73,16 +64,8 @@ void DivPlatformDave::acquire(short** buf, size_t len) { chan[i].dacSample=-1; continue; } - chWrite(i,0x07,0); signed char dacData=((signed char)((unsigned char)s->data8[chan[i].dacPos]^0x80))>>3; chan[i].dacOut=CLAMP(dacData,-16,15); - if (!isMuted[i]) { - chWrite(i,0x04,parent->song.disableSampleMacro?0xdf:(0xc0|chan[i].outVol)); - chWrite(i,0x06,chan[i].dacOut&0x1f); - } else { - chWrite(i,0x04,0xc0); - chWrite(i,0x06,0x10); - } chan[i].dacPos++; if (s->isLoopable() && chan[i].dacPos>=(unsigned int)s->loopEnd) { chan[i].dacPos=s->loopStart; @@ -95,22 +78,11 @@ void DivPlatformDave::acquire(short** buf, size_t len) { } // PCE part - cycles=0; - while (!writes.empty() && cycles<24) { + while (!writes.empty()) { QueuedWrite w=writes.front(); - pce->Write(cycles,w.addr,w.val); - regPool[w.addr&0x0f]=w.val; - //cycles+=2; + regPool[w.addr&0x1f]=w.val; writes.pop(); } - memset(tempL,0,24*sizeof(int)); - memset(tempR,0,24*sizeof(int)); - pce->Update(24); - pce->ResetTS(0); - - for (int i=0; i<6; i++) { - oscBuf[i]->data[oscBuf[i]->needle++]=CLAMP(pce->channel[i].blip_prev_samp[0]+pce->channel[i].blip_prev_samp[1],-32768,32767); - } tempL[0]=(tempL[0]>>1)+(tempL[0]>>2); tempR[0]=(tempR[0]>>1)+(tempR[0]>>2); @@ -126,11 +98,6 @@ void DivPlatformDave::acquire(short** buf, size_t len) { } } -// TODO: in octave 6 the noise table changes to a tonal one -static unsigned char noiseFreq[12]={ - 4,13,15,18,21,23,25,27,29,31,0,2 -}; - void DivPlatformDave::tick(bool sysTick) { for (int i=0; i<6; i++) { chan[i].std.next(); @@ -139,7 +106,6 @@ void DivPlatformDave::tick(bool sysTick) { if (chan[i].furnaceDac && chan[i].pcm) { // ignore for now } else { - chWrite(i,0x04,0x80|chan[i].outVol); } } if (chan[i].std.duty.had && i>=4) { @@ -169,7 +135,6 @@ void DivPlatformDave::tick(bool sysTick) { chan[i].pan|=chan[i].std.panR.val&15; } if (chan[i].std.panL.had || chan[i].std.panR.had) { - chWrite(i,0x05,isMuted[i]?0:chan[i].pan); } if (chan[i].std.pitch.had) { if (chan[i].std.pitch.mode) { @@ -185,8 +150,6 @@ void DivPlatformDave::tick(bool sysTick) { if (chan[i].active && chan[i].dacSample>=0 && chan[i].dacSamplesong.sampleLen) { chan[i].dacPos=0; chan[i].dacPeriod=0; - chWrite(i,0x04,parent->song.disableSampleMacro?0xdf:(0xc0|chan[i].vol)); - addWrite(0xffff0000+(i<<8),chan[i].dacSample); chan[i].keyOn=true; } } @@ -205,27 +168,13 @@ void DivPlatformDave::tick(bool sysTick) { } } chan[i].dacRate=((double)chipClock/2)/MAX(1,off*chan[i].freq); - if (dumpWrites) addWrite(0xffff0001+(i<<8),chan[i].dacRate); } if (chan[i].freq<1) chan[i].freq=1; if (chan[i].freq>4095) chan[i].freq=4095; - chWrite(i,0x02,chan[i].freq&0xff); - chWrite(i,0x03,chan[i].freq>>8); - if (i>=4) { - int noiseSeek=(chan[i].fixedArp?chan[i].baseNoteOverride:(chan[i].note+chan[i].arpOff))+chan[i].pitch2; - if (!parent->song.properNoiseLayout && noiseSeek<0) noiseSeek=0; - if (!NEW_ARP_STRAT) { - noiseSeek=chan[i].noiseSeek; - } - chWrite(i,0x07,chan[i].noise?(0x80|(parent->song.properNoiseLayout?(noiseSeek&31):noiseFreq[noiseSeek%12])):0); - } if (chan[i].keyOn) { - //rWrite(16+i*5,0x80); - //chWrite(i,0x04,0x80|chan[i].vol); } if (chan[i].keyOff) { - chWrite(i,0x04,0); } if (chan[i].keyOn) chan[i].keyOn=false; if (chan[i].keyOff) chan[i].keyOff=false; @@ -270,8 +219,6 @@ int DivPlatformDave::dispatch(DivCommand c) { break; } else { if (dumpWrites) { - chWrite(c.chan,0x04,parent->song.disableSampleMacro?0xdf:(0xc0|chan[c.chan].vol)); - addWrite(0xffff0000+(c.chan<<8),chan[c.chan].dacSample); } } chan[c.chan].dacPos=0; @@ -307,8 +254,6 @@ int DivPlatformDave::dispatch(DivCommand c) { chan[c.chan].dacPeriod=0; chan[c.chan].dacRate=parent->getSample(chan[c.chan].dacSample)->rate; if (dumpWrites) { - chWrite(c.chan,0x04,parent->song.disableSampleMacro?0xdf:(0xc0|chan[c.chan].vol)); - addWrite(0xffff0001+(c.chan<<8),chan[c.chan].dacRate); } } break; @@ -319,12 +264,9 @@ int DivPlatformDave::dispatch(DivCommand c) { chan[c.chan].baseFreq=NOTE_PERIODIC(c.value); chan[c.chan].freqChanged=true; chan[c.chan].note=c.value; - chan[c.chan].noiseSeek=c.value; - if (chan[c.chan].noiseSeek<0) chan[c.chan].noiseSeek=0; } chan[c.chan].active=true; chan[c.chan].keyOn=true; - chWrite(c.chan,0x04,0x80|chan[c.chan].vol); chan[c.chan].macroInit(ins); if (!parent->song.brokenOutVol && !chan[c.chan].std.vol.will) { chan[c.chan].outVol=chan[c.chan].vol; @@ -356,7 +298,6 @@ int DivPlatformDave::dispatch(DivCommand c) { if (!chan[c.chan].std.vol.has) { chan[c.chan].outVol=c.value; if (chan[c.chan].active && !chan[c.chan].pcm) { - chWrite(c.chan,0x04,0x80|chan[c.chan].outVol); } } } @@ -410,22 +351,8 @@ int DivPlatformDave::dispatch(DivCommand c) { } break; } - case DIV_CMD_STD_NOISE_MODE: - chan[c.chan].noise=c.value; - chan[c.chan].freqChanged=true; - break; - case DIV_CMD_SAMPLE_MODE: - chan[c.chan].pcm=c.value; - break; - case DIV_CMD_SAMPLE_BANK: - sampleBank=c.value; - if (sampleBank>(parent->song.sample.size()/12)) { - sampleBank=parent->song.sample.size()/12; - } - break; case DIV_CMD_PANNING: { chan[c.chan].pan=(c.value&0xf0)|(c.value2>>4); - chWrite(c.chan,0x05,isMuted[c.chan]?0:chan[c.chan].pan); break; } case DIV_CMD_LEGATO: @@ -460,10 +387,7 @@ int DivPlatformDave::dispatch(DivCommand c) { void DivPlatformDave::muteChannel(int ch, bool mute) { isMuted[ch]=mute; - chWrite(ch,0x05,isMuted[ch]?0:chan[ch].pan); if (!isMuted[ch] && (chan[ch].pcm && chan[ch].dacSample!=-1)) { - chWrite(ch,0x04,parent->song.disableSampleMacro?0xdf:(0xc0|chan[ch].outVol)); - chWrite(ch,0x06,chan[ch].dacOut&0x1f); } } @@ -471,8 +395,6 @@ void DivPlatformDave::forceIns() { for (int i=0; i<6; i++) { chan[i].insChanged=true; chan[i].freqChanged=true; - updateWave(i); - chWrite(i,0x05,isMuted[i]?0:chan[i].pan); } } @@ -543,7 +465,6 @@ void DivPlatformDave::reset() { if (dumpWrites) { addWrite(0xffffffff,0); } - pce->Power(0); lastPan=0xff; memset(tempL,0,32*sizeof(int)); memset(tempR,0,32*sizeof(int)); @@ -559,7 +480,6 @@ void DivPlatformDave::reset() { updateLFO=true; // set per-channel initial panning for (int i=0; i<6; i++) { - chWrite(i,0x05,isMuted[i]?0:chan[i].pan); } delay=500; } @@ -586,12 +506,6 @@ void DivPlatformDave::setFlags(const DivConfig& flags) { for (int i=0; i<6; i++) { oscBuf[i]->rate=rate; } - - if (pce!=NULL) { - delete pce; - pce=NULL; - } - pce=new PCE_PSG(tempL,tempR,flags.getInt("chipType",0)?PCE_PSG::REVISION_HUC6280A:PCE_PSG::REVISION_HUC6280); } void DivPlatformDave::poke(unsigned int addr, unsigned short val) { @@ -611,7 +525,6 @@ int DivPlatformDave::init(DivEngine* p, int channels, int sugRate, const DivConf isMuted[i]=false; oscBuf[i]=new DivDispatchOscBuffer; } - pce=NULL; setFlags(flags); reset(); return 6; @@ -621,10 +534,6 @@ void DivPlatformDave::quit() { for (int i=0; i<6; i++) { delete oscBuf[i]; } - if (pce!=NULL) { - delete pce; - pce=NULL; - } } DivPlatformDave::~DivPlatformDave() { diff --git a/src/engine/song.h b/src/engine/song.h index a4b60238a..932e3924d 100644 --- a/src/engine/song.h +++ b/src/engine/song.h @@ -134,6 +134,7 @@ enum DivSystem { DIV_SYSTEM_C219, DIV_SYSTEM_ESFM, DIV_SYSTEM_POWERNOISE, + DIV_SYSTEM_DAVE, }; enum DivEffectType: unsigned short { diff --git a/src/engine/sysDef.cpp b/src/engine/sysDef.cpp index 65b4cf1f0..684226515 100644 --- a/src/engine/sysDef.cpp +++ b/src/engine/sysDef.cpp @@ -2002,6 +2002,21 @@ void DivEngine::registerSystems() { {} ); + sysDefs[DIV_SYSTEM_DAVE]=new DivSysDef( + "Dave", NULL, 0xd5, 0, 6, false, true, 0, false, 0, 0, 0, + "this chip was featured in the Enterprise 128 computer. it is similar to POKEY, but with stereo output.", + {"Channel 1", "Channel 2", "Channel 3", "Noise", "DAC Left", "DAC Right"}, + {"CH1", "CH2", "CH3", "NO", "L", "R"}, + {DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_NOISE, DIV_CH_PCM, DIV_CH_PCM}, + {DIV_INS_DAVE, DIV_INS_DAVE, DIV_INS_DAVE, DIV_INS_DAVE, DIV_INS_AMIGA, DIV_INS_AMIGA}, + {}, + { + {0x10, {DIV_CMD_WAVE, "10xx: Set waveform (0 to 7)"}}, + {0x11, {DIV_CMD_STD_NOISE_MODE, "11xx: Set AUDCTL"}}, + {0x12, {DIV_CMD_STD_NOISE_FREQ, "12xx: Toggle two-tone mode"}}, + } + ); + 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/gui.h b/src/gui/gui.h index badd269ed..2c7966e4a 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -294,6 +294,7 @@ enum FurnaceGUIColors { GUI_COLOR_INSTR_ESFM, GUI_COLOR_INSTR_POWERNOISE, GUI_COLOR_INSTR_POWERNOISE_SLOPE, + GUI_COLOR_INSTR_DAVE, GUI_COLOR_INSTR_UNKNOWN, GUI_COLOR_CHANNEL_BG, diff --git a/src/gui/guiConst.cpp b/src/gui/guiConst.cpp index 039bfd5bc..70f2eaa73 100644 --- a/src/gui/guiConst.cpp +++ b/src/gui/guiConst.cpp @@ -178,6 +178,7 @@ const char* insTypes[DIV_INS_MAX+1][3]={ {"FM (ESFM)",ICON_FA_AREA_CHART,ICON_FUR_INS_ESFM}, {"PowerNoise (noise)",ICON_FUR_NOISE,ICON_FUR_INS_POWERNOISE}, {"PowerNoise (slope)",ICON_FUR_SAW,ICON_FUR_INS_POWERNOISE_SAW}, + {"Dave",ICON_FA_BAR_CHART,ICON_FUR_INS_DAVE}, {NULL,ICON_FA_QUESTION,ICON_FA_QUESTION} }; @@ -991,6 +992,7 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={ D(GUI_COLOR_INSTR_ESFM,"",ImVec4(0.1f,0.9f,1.0f,1.0f)), D(GUI_COLOR_INSTR_POWERNOISE,"",ImVec4(1.0f,1.0f,0.8f,1.0f)), D(GUI_COLOR_INSTR_POWERNOISE_SLOPE,"",ImVec4(1.0f,0.6f,0.3f,1.0f)), + D(GUI_COLOR_INSTR_DAVE,"",ImVec4(0.7f,0.7f,0.8f,1.0f)), D(GUI_COLOR_INSTR_UNKNOWN,"",ImVec4(0.3f,0.3f,0.3f,1.0f)), D(GUI_COLOR_CHANNEL_BG,"",ImVec4(0.4f,0.6f,0.8f,1.0f)), @@ -1244,6 +1246,7 @@ const int chipsFM[]={ DIV_SYSTEM_OPL3_DRUMS, DIV_SYSTEM_OPZ, DIV_SYSTEM_ESFM, + DIV_SYSTEM_DAVE, 0 // don't remove this last one! }; @@ -1299,6 +1302,7 @@ const int chipsSpecial[]={ DIV_SYSTEM_MMC5, DIV_SYSTEM_SM8521, DIV_SYSTEM_POWERNOISE, + DIV_SYSTEM_DAVE, 0 // don't remove this last one! }; @@ -1343,9 +1347,3 @@ const char* chipCategoryNames[]={ "Sample", NULL }; - -// NORMAL, LETTER, -const char* insIcons[]={ - ICON_FA_AREA_CHART, - -}; diff --git a/src/icon/furIcons.h b/src/icon/furIcons.h index fb1c8a7b5..fe70ba1f5 100644 --- a/src/icon/furIcons.h +++ b/src/icon/furIcons.h @@ -1,7 +1,7 @@ // not auto-generated. update every time you change icons.ttf! #define ICON_MIN_FUR 0xe0f0 -#define ICON_MAX_FUR 0xe15b +#define ICON_MAX_FUR 0xe15c // test #define ICON_FUR_TEST0 u8"\ue0f0" @@ -69,6 +69,7 @@ #define ICON_FUR_INS_ESFM u8"\ue143" #define ICON_FUR_INS_POWERNOISE u8"\ue15a" #define ICON_FUR_INS_POWERNOISE_SAW u8"\ue15b" +#define ICON_FUR_INS_DAVE u8"\ue15c" // sample editor #define ICON_FUR_SAMPLE_APPLY_SILENCE u8"\ue136"