YM2612: - C S M -

CSM only available with Nuked core
may not work on VGM export if you compress VGM (removes timer A writes)
This commit is contained in:
tildearrow 2022-06-03 16:13:57 -05:00
parent 59ba156cdf
commit b4a7f0f5b7
3 changed files with 35 additions and 24 deletions

View file

@ -1,7 +1,5 @@
# to-do for 0.6pre1
- additional YM2612 features
- CSM
- MSM6258 pitch and clock select
- Game Boy envelope macro/sequence
- rewrite the system name detection function anyway

View file

@ -512,28 +512,6 @@ void DivPlatformGenesis::tick(bool sysTick) {
}
}
if (extMode && softPCM) {
if (chan[7].freqChanged) {
chan[7].freq=parent->calcFreq(chan[7].baseFreq,chan[7].pitch,true,0,chan[7].pitch2,chipClock,CHIP_DIVIDER);
int wf=0x400-chan[7].freq;
printf("freq: %d\n",wf);
immWrite(0x24,wf>>2);
immWrite(0x25,wf&3);
chan[7].freqChanged=false;
}
if (chan[7].keyOn) {
printf("CSM key on\n");
immWrite(0x27,0x81);
chan[7].keyOn=false;
}
if (chan[7].keyOff) {
printf("CSM key off\n");
immWrite(0x27,0x40);
chan[7].keyOff=false;
}
}
for (int i=0; i<7; i++) {
if (i==2 && extMode) continue;
if (chan[i].freqChanged) {

View file

@ -23,6 +23,7 @@
#include "genesisshared.h"
#define CHIP_DIVIDER 72
#define CHIP_FREQBASE 9440540
int DivPlatformGenesisExt::dispatch(DivCommand c) {
@ -446,9 +447,43 @@ void DivPlatformGenesisExt::tick(bool sysTick) {
opChan[i].keyOn=false;
}
}
if (extMode && softPCM) {
if (chan[7].freqChanged) {
chan[7].freq=parent->calcFreq(chan[7].baseFreq,chan[7].pitch,true,0,chan[7].pitch2,chipClock,CHIP_DIVIDER);
if (chan[7].freq<1) chan[7].freq=1;
if (chan[7].freq>1024) chan[7].freq=1024;
int wf=0x400-chan[7].freq;
immWrite(0x24,wf>>2);
immWrite(0x25,wf&3);
chan[7].freqChanged=false;
}
if (chan[7].keyOff || chan[7].keyOn) {
writeNoteOn=true;
for (int i=0; i<4; i++) {
writeMask|=opChan[i].active<<(4+i);
}
}
}
if (writeNoteOn) {
if (chan[7].active) { // CSM
writeMask^=0xf0;
}
immWrite(0x28,writeMask);
}
if (extMode && softPCM) {
if (chan[7].keyOn) {
immWrite(0x27,0x81);
chan[7].keyOn=false;
}
if (chan[7].keyOff) {
immWrite(0x27,0x40);
chan[7].keyOff=false;
}
}
}
void DivPlatformGenesisExt::forceIns() {