add register view

supported chips only.
This commit is contained in:
tildearrow 2022-02-21 22:31:27 -05:00
parent f54aeb4c08
commit df35b8fb45
28 changed files with 240 additions and 8 deletions

View file

@ -204,15 +204,27 @@ class DivDispatch {
* @return a pointer, or NULL. * @return a pointer, or NULL.
*/ */
virtual void* getChanState(int chan); virtual void* getChanState(int chan);
/**
* get the register pool of this dispatch.
* @return a pointer, or NULL.
*/
virtual unsigned char* getRegisterPool();
/** /**
* get this dispatch's state. * get the size of the register pool of this dispatch.
* @return the size.
*/
virtual int getRegisterPoolSize();
/**
* get this dispatch's state. DO NOT IMPLEMENT YET.
* @return a pointer to the dispatch's state. must be deallocated manually! * @return a pointer to the dispatch's state. must be deallocated manually!
*/ */
virtual void* getState(); virtual void* getState();
/** /**
* set this dispatch's state. * set this dispatch's state. DO NOT IMPLEMENT YET.
* @param state a pointer to a state pertaining to this dispatch, * @param state a pointer to a state pertaining to this dispatch,
* or NULL if this dispatch does not support state saves. * or NULL if this dispatch does not support state saves.
*/ */

View file

@ -728,6 +728,13 @@ void* DivEngine::getDispatchChanState(int ch) {
return disCont[dispatchOfChan[ch]].dispatch->getChanState(dispatchChanOfChan[ch]); return disCont[dispatchOfChan[ch]].dispatch->getChanState(dispatchChanOfChan[ch]);
} }
unsigned char* DivEngine::getRegisterPool(int sys, int& size) {
if (sys<0 || sys>=song.systemLen) return NULL;
if (disCont[sys].dispatch==NULL) return NULL;
size=disCont[sys].dispatch->getRegisterPoolSize();
return disCont[sys].dispatch->getRegisterPool();
}
void DivEngine::enableCommandStream(bool enable) { void DivEngine::enableCommandStream(bool enable) {
cmdStreamEnabled=enable; cmdStreamEnabled=enable;
} }

View file

@ -529,6 +529,9 @@ class DivEngine {
// get dispatch channel state // get dispatch channel state
void* getDispatchChanState(int chan); void* getDispatchChanState(int chan);
// get register pool
unsigned char* getRegisterPool(int sys, int& size);
// enable command stream dumping // enable command stream dumping
void enableCommandStream(bool enable); void enableCommandStream(bool enable);

View file

@ -29,6 +29,14 @@ void* DivDispatch::getChanState(int chan) {
return NULL; return NULL;
} }
unsigned char* DivDispatch::getRegisterPool() {
return NULL;
}
int DivDispatch::getRegisterPoolSize() {
return 0;
}
void* DivDispatch::getState() { void* DivDispatch::getState() {
return NULL; return NULL;
} }

View file

@ -145,6 +145,7 @@ void DivPlatformArcade::acquire_nuked(short* bufL, short* bufR, size_t start, si
QueuedWrite& w=writes.front(); QueuedWrite& w=writes.front();
if (w.addrOrVal) { if (w.addrOrVal) {
OPM_Write(&fm,1,w.val); OPM_Write(&fm,1,w.val);
regPool[w.addr&0xff]=w.val;
//printf("write: %x = %.2x\n",w.addr,w.val); //printf("write: %x = %.2x\n",w.addr,w.val);
writes.pop(); writes.pop();
} else { } else {
@ -216,6 +217,7 @@ void DivPlatformArcade::acquire_ymfm(short* bufL, short* bufR, size_t start, siz
QueuedWrite& w=writes.front(); QueuedWrite& w=writes.front();
fm_ymfm->write(0x0+((w.addr>>8)<<1),w.addr); fm_ymfm->write(0x0+((w.addr>>8)<<1),w.addr);
fm_ymfm->write(0x1+((w.addr>>8)<<1),w.val); fm_ymfm->write(0x1+((w.addr>>8)<<1),w.val);
regPool[w.addr&0xff]=w.val;
writes.pop(); writes.pop();
delay=1; delay=1;
} }
@ -877,6 +879,14 @@ void* DivPlatformArcade::getChanState(int ch) {
return &chan[ch]; return &chan[ch];
} }
unsigned char* DivPlatformArcade::getRegisterPool() {
return regPool;
}
int DivPlatformArcade::getRegisterPoolSize() {
return 256;
}
void DivPlatformArcade::poke(unsigned int addr, unsigned short val) { void DivPlatformArcade::poke(unsigned int addr, unsigned short val) {
immWrite(addr,val); immWrite(addr,val);
} }
@ -887,6 +897,7 @@ void DivPlatformArcade::poke(std::vector<DivRegWrite>& wlist) {
void DivPlatformArcade::reset() { void DivPlatformArcade::reset() {
while (!writes.empty()) writes.pop(); while (!writes.empty()) writes.pop();
memset(regPool,0,256);
if (useYMFM) { if (useYMFM) {
fm_ymfm->reset(); fm_ymfm->reset();
} else { } else {

View file

@ -71,6 +71,8 @@ class DivPlatformArcade: public DivDispatch {
ymfm::ym2151::output_data out_ymfm; ymfm::ym2151::output_data out_ymfm;
DivArcadeInterface iface; DivArcadeInterface iface;
unsigned char regPool[256];
bool extMode, useYMFM; bool extMode, useYMFM;
bool isMuted[13]; bool isMuted[13];
@ -90,6 +92,8 @@ class DivPlatformArcade: public DivDispatch {
void acquire(short* bufL, short* bufR, size_t start, size_t len); void acquire(short* bufL, short* bufR, size_t start, size_t len);
int dispatch(DivCommand c); int dispatch(DivCommand c);
void* getChanState(int chan); void* getChanState(int chan);
unsigned char* getRegisterPool();
int getRegisterPoolSize();
void reset(); void reset();
void forceIns(); void forceIns();
void tick(); void tick();

View file

@ -94,6 +94,7 @@ void DivPlatformAY8910::acquire(short* bufL, short* bufR, size_t start, size_t l
QueuedWrite w=writes.front(); QueuedWrite w=writes.front();
ay->address_w(w.addr); ay->address_w(w.addr);
ay->data_w(w.val); ay->data_w(w.val);
regPool[w.addr&0x0f]=w.val;
writes.pop(); writes.pop();
} }
ay->sound_stream_update(ayBuf,len); ay->sound_stream_update(ayBuf,len);
@ -400,9 +401,18 @@ void* DivPlatformAY8910::getChanState(int ch) {
return &chan[ch]; return &chan[ch];
} }
unsigned char* DivPlatformAY8910::getRegisterPool() {
return regPool;
}
int DivPlatformAY8910::getRegisterPoolSize() {
return 16;
}
void DivPlatformAY8910::reset() { void DivPlatformAY8910::reset() {
while (!writes.empty()) writes.pop(); while (!writes.empty()) writes.pop();
ay->device_reset(); ay->device_reset();
memset(regPool,0,16);
for (int i=0; i<3; i++) { for (int i=0; i<3; i++) {
chan[i]=DivPlatformAY8910::Channel(); chan[i]=DivPlatformAY8910::Channel();
chan[i].vol=0x0f; chan[i].vol=0x0f;

View file

@ -47,6 +47,7 @@ class DivPlatformAY8910: public DivDispatch {
}; };
std::queue<QueuedWrite> writes; std::queue<QueuedWrite> writes;
ay8910_device* ay; ay8910_device* ay;
unsigned char regPool[16];
unsigned char lastBusy; unsigned char lastBusy;
bool dacMode; bool dacMode;
@ -76,6 +77,8 @@ class DivPlatformAY8910: public DivDispatch {
void acquire(short* bufL, short* bufR, size_t start, size_t len); void acquire(short* bufL, short* bufR, size_t start, size_t len);
int dispatch(DivCommand c); int dispatch(DivCommand c);
void* getChanState(int chan); void* getChanState(int chan);
unsigned char* getRegisterPool();
int getRegisterPoolSize();
void reset(); void reset();
void forceIns(); void forceIns();
void tick(); void tick();

View file

@ -124,6 +124,7 @@ void DivPlatformAY8930::acquire(short* bufL, short* bufR, size_t start, size_t l
} else { } else {
ay->data_w(w.val); ay->data_w(w.val);
} }
regPool[w.addr&0x1f]=w.val;
writes.pop(); writes.pop();
} }
ay->sound_stream_update(ayBuf,len); ay->sound_stream_update(ayBuf,len);
@ -462,9 +463,18 @@ void* DivPlatformAY8930::getChanState(int ch) {
return &chan[ch]; return &chan[ch];
} }
unsigned char* DivPlatformAY8930::getRegisterPool() {
return regPool;
}
int DivPlatformAY8930::getRegisterPoolSize() {
return 32;
}
void DivPlatformAY8930::reset() { void DivPlatformAY8930::reset() {
while (!writes.empty()) writes.pop(); while (!writes.empty()) writes.pop();
ay->device_reset(); ay->device_reset();
memset(regPool,0,32);
for (int i=0; i<3; i++) { for (int i=0; i<3; i++) {
chan[i]=DivPlatformAY8930::Channel(); chan[i]=DivPlatformAY8930::Channel();
chan[i].vol=31; chan[i].vol=31;

View file

@ -47,6 +47,7 @@ class DivPlatformAY8930: public DivDispatch {
}; };
std::queue<QueuedWrite> writes; std::queue<QueuedWrite> writes;
ay8930_device* ay; ay8930_device* ay;
unsigned char regPool[32];
unsigned char ayNoiseAnd, ayNoiseOr; unsigned char ayNoiseAnd, ayNoiseOr;
bool bank; bool bank;
@ -69,6 +70,8 @@ class DivPlatformAY8930: public DivDispatch {
void acquire(short* bufL, short* bufR, size_t start, size_t len); void acquire(short* bufL, short* bufR, size_t start, size_t len);
int dispatch(DivCommand c); int dispatch(DivCommand c);
void* getChanState(int chan); void* getChanState(int chan);
unsigned char* getRegisterPool();
int getRegisterPoolSize();
void reset(); void reset();
void forceIns(); void forceIns();
void tick(); void tick();

View file

@ -21,7 +21,7 @@
#include "../engine.h" #include "../engine.h"
#include <math.h> #include <math.h>
#define rWrite(a,v) if (!skipRegisterWrites) {sid.write(a,v); if (dumpWrites) {addWrite(a,v);} } #define rWrite(a,v) if (!skipRegisterWrites) {sid.write(a,v); regPool[(a)&0x1f]=v; if (dumpWrites) {addWrite(a,v);} }
#define CHIP_FREQBASE 524288 #define CHIP_FREQBASE 524288
@ -467,12 +467,21 @@ void* DivPlatformC64::getChanState(int ch) {
return &chan[ch]; return &chan[ch];
} }
unsigned char* DivPlatformC64::getRegisterPool() {
return regPool;
}
int DivPlatformC64::getRegisterPoolSize() {
return 32;
}
void DivPlatformC64::reset() { void DivPlatformC64::reset() {
for (int i=0; i<3; i++) { for (int i=0; i<3; i++) {
chan[i]=DivPlatformC64::Channel(); chan[i]=DivPlatformC64::Channel();
} }
sid.reset(); sid.reset();
memset(regPool,0,32);
rWrite(0x18,0x0f); rWrite(0x18,0x0f);

View file

@ -70,6 +70,7 @@ class DivPlatformC64: public DivDispatch {
int filtCut, resetTime; int filtCut, resetTime;
SID sid; SID sid;
unsigned char regPool[32];
friend void putDispatchChan(void*,int,int); friend void putDispatchChan(void*,int,int);
@ -78,6 +79,8 @@ class DivPlatformC64: public DivDispatch {
void acquire(short* bufL, short* bufR, size_t start, size_t len); void acquire(short* bufL, short* bufR, size_t start, size_t len);
int dispatch(DivCommand c); int dispatch(DivCommand c);
void* getChanState(int chan); void* getChanState(int chan);
unsigned char* getRegisterPool();
int getRegisterPoolSize();
void reset(); void reset();
void forceIns(); void forceIns();
void tick(); void tick();

View file

@ -21,8 +21,8 @@
#include "../engine.h" #include "../engine.h"
#include <math.h> #include <math.h>
#define rWrite(a,v) if (!skipRegisterWrites) {GB_apu_write(gb,a,v); if (dumpWrites) {addWrite(a,v);} } #define rWrite(a,v) if (!skipRegisterWrites) {GB_apu_write(gb,a,v); regPool[(a)&0x7f]=v; if (dumpWrites) {addWrite(a,v);} }
#define immWrite(a,v) {GB_apu_write(gb,a,v); if (dumpWrites) {addWrite(a,v);} } #define immWrite(a,v) {GB_apu_write(gb,a,v); regPool[(a)&0x7f]=v; if (dumpWrites) {addWrite(a,v);} }
#define CHIP_DIVIDER 16 #define CHIP_DIVIDER 16
@ -395,6 +395,14 @@ void* DivPlatformGB::getChanState(int ch) {
return &chan[ch]; return &chan[ch];
} }
unsigned char* DivPlatformGB::getRegisterPool() {
return regPool;
}
int DivPlatformGB::getRegisterPoolSize() {
return 64;
}
void DivPlatformGB::reset() { void DivPlatformGB::reset() {
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
chan[i]=DivPlatformGB::Channel(); chan[i]=DivPlatformGB::Channel();
@ -403,6 +411,7 @@ void DivPlatformGB::reset() {
addWrite(0xffffffff,0); addWrite(0xffffffff,0);
} }
memset(gb,0,sizeof(GB_gameboy_t)); memset(gb,0,sizeof(GB_gameboy_t));
memset(regPool,0,128);
gb->model=GB_MODEL_DMG_B; gb->model=GB_MODEL_DMG_B;
GB_apu_init(gb); GB_apu_init(gb);
GB_set_sample_rate(gb,rate); GB_set_sample_rate(gb,rate);

View file

@ -55,6 +55,8 @@ class DivPlatformGB: public DivDispatch {
unsigned char lastPan; unsigned char lastPan;
GB_gameboy_t* gb; GB_gameboy_t* gb;
unsigned char regPool[128];
unsigned char procMute(); unsigned char procMute();
void updateWave(); void updateWave();
friend void putDispatchChan(void*,int,int); friend void putDispatchChan(void*,int,int);
@ -62,6 +64,8 @@ class DivPlatformGB: public DivDispatch {
void acquire(short* bufL, short* bufR, size_t start, size_t len); void acquire(short* bufL, short* bufR, size_t start, size_t len);
int dispatch(DivCommand c); int dispatch(DivCommand c);
void* getChanState(int chan); void* getChanState(int chan);
unsigned char* getRegisterPool();
int getRegisterPoolSize();
void reset(); void reset();
void forceIns(); void forceIns();
void tick(); void tick();

View file

@ -121,6 +121,7 @@ void DivPlatformGenesis::acquire_nuked(short* bufL, short* bufR, size_t start, s
OPN2_Write(&fm,0x1+((w.addr>>8)<<1),w.val); OPN2_Write(&fm,0x1+((w.addr>>8)<<1),w.val);
//printf("write: %x = %.2x\n",w.addr,w.val); //printf("write: %x = %.2x\n",w.addr,w.val);
lastBusy=0; lastBusy=0;
regPool[w.addr&0x1ff]=w.val;
writes.pop(); writes.pop();
} else { } else {
lastBusy++; lastBusy++;
@ -190,6 +191,7 @@ void DivPlatformGenesis::acquire_ymfm(short* bufL, short* bufR, size_t start, si
QueuedWrite& w=writes.front(); QueuedWrite& w=writes.front();
fm_ymfm->write(0x0+((w.addr>>8)<<1),w.addr); fm_ymfm->write(0x0+((w.addr>>8)<<1),w.addr);
fm_ymfm->write(0x1+((w.addr>>8)<<1),w.val); fm_ymfm->write(0x1+((w.addr>>8)<<1),w.val);
regPool[w.addr&0x1ff]=w.val;
writes.pop(); writes.pop();
lastBusy=1; lastBusy=1;
} }
@ -805,8 +807,17 @@ void* DivPlatformGenesis::getChanState(int ch) {
return &chan[ch]; return &chan[ch];
} }
unsigned char* DivPlatformGenesis::getRegisterPool() {
return regPool;
}
int DivPlatformGenesis::getRegisterPoolSize() {
return 512;
}
void DivPlatformGenesis::reset() { void DivPlatformGenesis::reset() {
while (!writes.empty()) writes.pop(); while (!writes.empty()) writes.pop();
memset(regPool,0,512);
if (useYMFM) { if (useYMFM) {
fm_ymfm->reset(); fm_ymfm->reset();
} }

View file

@ -79,6 +79,7 @@ class DivPlatformGenesis: public DivDispatch {
ymfm::ym2612* fm_ymfm; ymfm::ym2612* fm_ymfm;
ymfm::ym2612::output_data out_ymfm; ymfm::ym2612::output_data out_ymfm;
DivYM2612Interface iface; DivYM2612Interface iface;
unsigned char regPool[512];
bool dacMode; bool dacMode;
int dacPeriod; int dacPeriod;
@ -106,6 +107,8 @@ class DivPlatformGenesis: public DivDispatch {
void acquire(short* bufL, short* bufR, size_t start, size_t len); void acquire(short* bufL, short* bufR, size_t start, size_t len);
int dispatch(DivCommand c); int dispatch(DivCommand c);
void* getChanState(int chan); void* getChanState(int chan);
unsigned char* getRegisterPool();
int getRegisterPoolSize();
void reset(); void reset();
void forceIns(); void forceIns();
void tick(); void tick();

View file

@ -25,7 +25,7 @@
#define CHIP_DIVIDER 16 #define CHIP_DIVIDER 16
#define rWrite(a,v) if (!skipRegisterWrites) {apu_wr_reg(nes,a,v); if (dumpWrites) {addWrite(a,v);} } #define rWrite(a,v) if (!skipRegisterWrites) {apu_wr_reg(nes,a,v); regPool[(a)&0x7f]=v; if (dumpWrites) {addWrite(a,v);} }
const char* regCheatSheetNES[]={ const char* regCheatSheetNES[]={
"S0Volume", "4000", "S0Volume", "4000",
@ -444,6 +444,14 @@ void* DivPlatformNES::getChanState(int ch) {
return &chan[ch]; return &chan[ch];
} }
unsigned char* DivPlatformNES::getRegisterPool() {
return regPool;
}
int DivPlatformNES::getRegisterPoolSize() {
return 32;
}
void DivPlatformNES::reset() { void DivPlatformNES::reset() {
for (int i=0; i<5; i++) { for (int i=0; i<5; i++) {
chan[i]=DivPlatformNES::Channel(); chan[i]=DivPlatformNES::Channel();
@ -459,6 +467,7 @@ void DivPlatformNES::reset() {
sampleBank=0; sampleBank=0;
apu_turn_on(nes,apuType); apu_turn_on(nes,apuType);
memset(regPool,0,128);
nes->apu.cpu_cycles=0; nes->apu.cpu_cycles=0;
nes->apu.cpu_opcode_cycle=0; nes->apu.cpu_opcode_cycle=0;

View file

@ -59,6 +59,7 @@ class DivPlatformNES: public DivDispatch {
unsigned char sampleBank; unsigned char sampleBank;
unsigned char apuType; unsigned char apuType;
struct NESAPU* nes; struct NESAPU* nes;
unsigned char regPool[128];
friend void putDispatchChan(void*,int,int); friend void putDispatchChan(void*,int,int);
@ -66,6 +67,8 @@ class DivPlatformNES: public DivDispatch {
void acquire(short* bufL, short* bufR, size_t start, size_t len); void acquire(short* bufL, short* bufR, size_t start, size_t len);
int dispatch(DivCommand c); int dispatch(DivCommand c);
void* getChanState(int chan); void* getChanState(int chan);
unsigned char* getRegisterPool();
int getRegisterPoolSize();
void reset(); void reset();
void forceIns(); void forceIns();
void tick(); void tick();

View file

@ -29,6 +29,7 @@
curChan=c; \ curChan=c; \
rWrite(0,curChan); \ rWrite(0,curChan); \
} \ } \
regPool[16+((c)<<4)+((a)&0x0f)]=v; \
rWrite(a,v); \ rWrite(a,v); \
} }
@ -110,6 +111,7 @@ void DivPlatformPCE::acquire(short* bufL, short* bufR, size_t start, size_t len)
while (!writes.empty() && cycles<24) { while (!writes.empty() && cycles<24) {
QueuedWrite w=writes.front(); QueuedWrite w=writes.front();
pce->Write(cycles,w.addr,w.val); pce->Write(cycles,w.addr,w.val);
regPool[w.addr&0x0f]=w.val;
//cycles+=2; //cycles+=2;
writes.pop(); writes.pop();
} }
@ -442,8 +444,17 @@ void* DivPlatformPCE::getChanState(int ch) {
return &chan[ch]; return &chan[ch];
} }
unsigned char* DivPlatformPCE::getRegisterPool() {
return regPool;
}
int DivPlatformPCE::getRegisterPoolSize() {
return 112;
}
void DivPlatformPCE::reset() { void DivPlatformPCE::reset() {
while (!writes.empty()) writes.pop(); while (!writes.empty()) writes.pop();
memset(regPool,0,128);
for (int i=0; i<6; i++) { for (int i=0; i<6; i++) {
chan[i]=DivPlatformPCE::Channel(); chan[i]=DivPlatformPCE::Channel();
} }

View file

@ -74,12 +74,15 @@ class DivPlatformPCE: public DivDispatch {
int tempR[32]; int tempR[32];
unsigned char sampleBank, lfoMode, lfoSpeed; unsigned char sampleBank, lfoMode, lfoSpeed;
PCE_PSG* pce; PCE_PSG* pce;
unsigned char regPool[128];
void updateWave(int ch); void updateWave(int ch);
friend void putDispatchChan(void*,int,int); friend void putDispatchChan(void*,int,int);
public: public:
void acquire(short* bufL, short* bufR, size_t start, size_t len); void acquire(short* bufL, short* bufR, size_t start, size_t len);
int dispatch(DivCommand c); int dispatch(DivCommand c);
void* getChanState(int chan); void* getChanState(int chan);
unsigned char* getRegisterPool();
int getRegisterPoolSize();
void reset(); void reset();
void forceIns(); void forceIns();
void tick(); void tick();

View file

@ -83,6 +83,7 @@ void DivPlatformSAA1099::acquire_mame(short* bufL, short* bufR, size_t start, si
QueuedWrite w=writes.front(); QueuedWrite w=writes.front();
saa.control_w(w.addr); saa.control_w(w.addr);
saa.data_w(w.val); saa.data_w(w.val);
regPool[w.addr&0x1f]=w.val;
writes.pop(); writes.pop();
} }
saa.sound_stream_update(saaBuf,len); saa.sound_stream_update(saaBuf,len);
@ -103,6 +104,7 @@ void DivPlatformSAA1099::acquire_saaSound(short* bufL, short* bufR, size_t start
while (!writes.empty()) { while (!writes.empty()) {
QueuedWrite w=writes.front(); QueuedWrite w=writes.front();
saa_saaSound->WriteAddressData(w.addr,w.val); saa_saaSound->WriteAddressData(w.addr,w.val);
regPool[w.addr&0x1f]=w.val;
writes.pop(); writes.pop();
} }
saa_saaSound->GenerateMany((unsigned char*)saaBuf[0],len); saa_saaSound->GenerateMany((unsigned char*)saaBuf[0],len);
@ -367,8 +369,17 @@ void* DivPlatformSAA1099::getChanState(int ch) {
return &chan[ch]; return &chan[ch];
} }
unsigned char* DivPlatformSAA1099::getRegisterPool() {
return regPool;
}
int DivPlatformSAA1099::getRegisterPoolSize() {
return 32;
}
void DivPlatformSAA1099::reset() { void DivPlatformSAA1099::reset() {
while (!writes.empty()) writes.pop(); while (!writes.empty()) writes.pop();
memset(regPool,0,32);
switch (core) { switch (core) {
case DIV_SAA_CORE_MAME: case DIV_SAA_CORE_MAME:
saa=saa1099_device(); saa=saa1099_device();

View file

@ -56,6 +56,7 @@ class DivPlatformSAA1099: public DivDispatch {
DivSAACores core; DivSAACores core;
saa1099_device saa; saa1099_device saa;
CSAASound* saa_saaSound; CSAASound* saa_saaSound;
unsigned char regPool[32];
unsigned char lastBusy; unsigned char lastBusy;
bool dacMode; bool dacMode;
@ -85,6 +86,8 @@ class DivPlatformSAA1099: public DivDispatch {
void acquire(short* bufL, short* bufR, size_t start, size_t len); void acquire(short* bufL, short* bufR, size_t start, size_t len);
int dispatch(DivCommand c); int dispatch(DivCommand c);
void* getChanState(int chan); void* getChanState(int chan);
unsigned char* getRegisterPool();
int getRegisterPoolSize();
void reset(); void reset();
void forceIns(); void forceIns();
void tick(); void tick();

View file

@ -22,7 +22,7 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#define rWrite(a,v) if (!skipRegisterWrites) {tia.set(a,v); if (dumpWrites) {addWrite(a,v);} } #define rWrite(a,v) if (!skipRegisterWrites) {tia.set(a,v); regPool[((a)-0x15)&0x0f]=v; if (dumpWrites) {addWrite(a,v);} }
const char* regCheatSheetTIA[]={ const char* regCheatSheetTIA[]={
"AUDC0", "15", "AUDC0", "15",
@ -281,8 +281,17 @@ void* DivPlatformTIA::getChanState(int ch) {
return &chan[ch]; return &chan[ch];
} }
unsigned char* DivPlatformTIA::getRegisterPool() {
return regPool;
}
int DivPlatformTIA::getRegisterPoolSize() {
return 6;
}
void DivPlatformTIA::reset() { void DivPlatformTIA::reset() {
tia.reset(); tia.reset();
memset(regPool,0,16);
for (int i=0; i<2; i++) { for (int i=0; i<2; i++) {
chan[i]=DivPlatformTIA::Channel(); chan[i]=DivPlatformTIA::Channel();
chan[i].vol=0x0f; chan[i].vol=0x0f;

View file

@ -38,6 +38,7 @@ class DivPlatformTIA: public DivDispatch {
Channel chan[2]; Channel chan[2];
bool isMuted[2]; bool isMuted[2];
TIASound tia; TIASound tia;
unsigned char regPool[16];
friend void putDispatchChan(void*,int,int); friend void putDispatchChan(void*,int,int);
unsigned char dealWithFreq(unsigned char shape, int base, int pitch); unsigned char dealWithFreq(unsigned char shape, int base, int pitch);
@ -46,6 +47,8 @@ class DivPlatformTIA: public DivDispatch {
void acquire(short* bufL, short* bufR, size_t start, size_t len); void acquire(short* bufL, short* bufR, size_t start, size_t len);
int dispatch(DivCommand c); int dispatch(DivCommand c);
void* getChanState(int chan); void* getChanState(int chan);
unsigned char* getRegisterPool();
int getRegisterPoolSize();
void reset(); void reset();
void forceIns(); void forceIns();
void tick(); void tick();

View file

@ -111,6 +111,7 @@ void DivPlatformYM2610::acquire(short* bufL, short* bufR, size_t start, size_t l
QueuedWrite& w=writes.front(); QueuedWrite& w=writes.front();
fm->write(0x0+((w.addr>>8)<<1),w.addr); fm->write(0x0+((w.addr>>8)<<1),w.addr);
fm->write(0x1+((w.addr>>8)<<1),w.val); fm->write(0x1+((w.addr>>8)<<1),w.val);
regPool[w.addr&0x1ff]=w.val;
writes.pop(); writes.pop();
delay=4; delay=4;
} }
@ -848,6 +849,14 @@ void* DivPlatformYM2610::getChanState(int ch) {
return &chan[ch]; return &chan[ch];
} }
unsigned char* DivPlatformYM2610::getRegisterPool() {
return regPool;
}
int DivPlatformYM2610::getRegisterPoolSize() {
return 512;
}
void DivPlatformYM2610::poke(unsigned int addr, unsigned short val) { void DivPlatformYM2610::poke(unsigned int addr, unsigned short val) {
immWrite(addr,val); immWrite(addr,val);
} }
@ -858,6 +867,7 @@ void DivPlatformYM2610::poke(std::vector<DivRegWrite>& wlist) {
void DivPlatformYM2610::reset() { void DivPlatformYM2610::reset() {
while (!writes.empty()) writes.pop(); while (!writes.empty()) writes.pop();
memset(regPool,0,512);
if (dumpWrites) { if (dumpWrites) {
addWrite(0xffffffff,0); addWrite(0xffffffff,0);
} }

View file

@ -59,6 +59,7 @@ class DivPlatformYM2610: public DivDispatch {
ymfm::ym2610* fm; ymfm::ym2610* fm;
ymfm::ym2610::output_data fmout; ymfm::ym2610::output_data fmout;
DivYM2610Interface iface; DivYM2610Interface iface;
unsigned char regPool[512];
unsigned char lastBusy; unsigned char lastBusy;
bool dacMode; bool dacMode;
@ -88,6 +89,8 @@ class DivPlatformYM2610: public DivDispatch {
void acquire(short* bufL, short* bufR, size_t start, size_t len); void acquire(short* bufL, short* bufR, size_t start, size_t len);
int dispatch(DivCommand c); int dispatch(DivCommand c);
void* getChanState(int chan); void* getChanState(int chan);
unsigned char* getRegisterPool();
int getRegisterPoolSize();
void reset(); void reset();
void forceIns(); void forceIns();
void tick(); void tick();

View file

@ -2039,6 +2039,49 @@ void FurnaceGUI::drawChannels() {
ImGui::End(); ImGui::End();
} }
void FurnaceGUI::drawRegView() {
if (nextWindow==GUI_WINDOW_REGISTER_VIEW) {
channelsOpen=true;
ImGui::SetNextWindowFocus();
nextWindow=GUI_WINDOW_NOTHING;
}
if (!regViewOpen) return;
if (ImGui::Begin("Register View",&regViewOpen)) {
for (int i=0; i<e->song.systemLen; i++) {
ImGui::Text("%d. %s",i+1,getSystemName(e->song.system[i]));
int size=0;
unsigned char* regPool=e->getRegisterPool(i,size);
if (regPool==NULL) {
ImGui::Text("- no register pool available");
} else {
ImGui::PushFont(patFont);
if (ImGui::BeginTable("Memory",17)) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
for (int i=0; i<16; i++) {
ImGui::TableNextColumn();
ImGui::TextColored(uiColors[GUI_COLOR_PATTERN_ROW_INDEX]," %X",i);
}
for (int i=0; i<=((size-1)>>4); i++) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextColored(uiColors[GUI_COLOR_PATTERN_ROW_INDEX],"%.2X",i*16);
for (int j=0; j<16; j++) {
ImGui::TableNextColumn();
if (i*16+j>=size) continue;
ImGui::Text("%.2x",regPool[i*16+j]);
}
}
ImGui::EndTable();
}
ImGui::PopFont();
}
}
}
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_REGISTER_VIEW;
ImGui::End();
}
void FurnaceGUI::startSelection(int xCoarse, int xFine, int y) { void FurnaceGUI::startSelection(int xCoarse, int xFine, int y) {
if (xCoarse!=selStart.xCoarse || xFine!=selStart.xFine || y!=selStart.y) { if (xCoarse!=selStart.xCoarse || xFine!=selStart.xFine || y!=selStart.y) {
curNibble=false; curNibble=false;
@ -3052,6 +3095,9 @@ void FurnaceGUI::doAction(int what) {
case GUI_ACTION_WINDOW_CHANNELS: case GUI_ACTION_WINDOW_CHANNELS:
nextWindow=GUI_WINDOW_CHANNELS; nextWindow=GUI_WINDOW_CHANNELS;
break; break;
case GUI_ACTION_WINDOW_REGISTER_VIEW:
nextWindow=GUI_WINDOW_REGISTER_VIEW;
break;
case GUI_ACTION_COLLAPSE_WINDOW: case GUI_ACTION_COLLAPSE_WINDOW:
collapseWindow=true; collapseWindow=true;
@ -3121,6 +3167,9 @@ void FurnaceGUI::doAction(int what) {
case GUI_WINDOW_CHANNELS: case GUI_WINDOW_CHANNELS:
channelsOpen=false; channelsOpen=false;
break; break;
case GUI_WINDOW_REGISTER_VIEW:
regViewOpen=false;
break;
default: default:
break; break;
} }
@ -4667,6 +4716,7 @@ bool FurnaceGUI::loop() {
if (ImGui::MenuItem("piano/input pad",BIND_FOR(GUI_ACTION_WINDOW_PIANO),pianoOpen)) pianoOpen=!pianoOpen; if (ImGui::MenuItem("piano/input pad",BIND_FOR(GUI_ACTION_WINDOW_PIANO),pianoOpen)) pianoOpen=!pianoOpen;
if (ImGui::MenuItem("oscilloscope",BIND_FOR(GUI_ACTION_WINDOW_OSCILLOSCOPE),oscOpen)) oscOpen=!oscOpen; if (ImGui::MenuItem("oscilloscope",BIND_FOR(GUI_ACTION_WINDOW_OSCILLOSCOPE),oscOpen)) oscOpen=!oscOpen;
if (ImGui::MenuItem("volume meter",BIND_FOR(GUI_ACTION_WINDOW_VOL_METER),volMeterOpen)) volMeterOpen=!volMeterOpen; if (ImGui::MenuItem("volume meter",BIND_FOR(GUI_ACTION_WINDOW_VOL_METER),volMeterOpen)) volMeterOpen=!volMeterOpen;
if (ImGui::MenuItem("register view",BIND_FOR(GUI_ACTION_WINDOW_REGISTER_VIEW),regViewOpen)) regViewOpen=!regViewOpen;
if (ImGui::MenuItem("statistics",BIND_FOR(GUI_ACTION_WINDOW_STATS),statsOpen)) statsOpen=!statsOpen; if (ImGui::MenuItem("statistics",BIND_FOR(GUI_ACTION_WINDOW_STATS),statsOpen)) statsOpen=!statsOpen;
ImGui::EndMenu(); ImGui::EndMenu();
@ -4770,6 +4820,7 @@ bool FurnaceGUI::loop() {
drawPiano(); drawPiano();
drawNotes(); drawNotes();
drawChannels(); drawChannels();
drawRegView();
if (ImGuiFileDialog::Instance()->Display("FileDialog",ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove,ImVec2(600.0f*dpiScale,400.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale))) { if (ImGuiFileDialog::Instance()->Display("FileDialog",ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove,ImVec2(600.0f*dpiScale,400.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale))) {
//ImGui::GetIO().ConfigFlags&=~ImGuiConfigFlags_NavEnableKeyboard; //ImGui::GetIO().ConfigFlags&=~ImGuiConfigFlags_NavEnableKeyboard;
@ -5380,6 +5431,7 @@ bool FurnaceGUI::init() {
pianoOpen=e->getConfBool("pianoOpen",false); pianoOpen=e->getConfBool("pianoOpen",false);
notesOpen=e->getConfBool("notesOpen",false); notesOpen=e->getConfBool("notesOpen",false);
channelsOpen=e->getConfBool("channelsOpen",false); channelsOpen=e->getConfBool("channelsOpen",false);
regViewOpen=e->getConfBool("regViewOpen",false);
syncSettings(); syncSettings();
@ -5533,6 +5585,7 @@ bool FurnaceGUI::finish() {
e->setConf("pianoOpen",pianoOpen); e->setConf("pianoOpen",pianoOpen);
e->setConf("notesOpen",notesOpen); e->setConf("notesOpen",notesOpen);
e->setConf("channelsOpen",channelsOpen); e->setConf("channelsOpen",channelsOpen);
e->setConf("regViewOpen",regViewOpen);
// commit last window size // commit last window size
e->setConf("lastWindowWidth",scrW); e->setConf("lastWindowWidth",scrW);
@ -5602,6 +5655,7 @@ FurnaceGUI::FurnaceGUI():
pianoOpen(false), pianoOpen(false),
notesOpen(false), notesOpen(false),
channelsOpen(false), channelsOpen(false),
regViewOpen(false),
selecting(false), selecting(false),
curNibble(false), curNibble(false),
orderNibble(false), orderNibble(false),

View file

@ -127,6 +127,7 @@ enum FurnaceGUIWindows {
GUI_WINDOW_PIANO, GUI_WINDOW_PIANO,
GUI_WINDOW_NOTES, GUI_WINDOW_NOTES,
GUI_WINDOW_CHANNELS, GUI_WINDOW_CHANNELS,
GUI_WINDOW_REGISTER_VIEW
}; };
enum FurnaceGUIFileDialogs { enum FurnaceGUIFileDialogs {
@ -209,6 +210,7 @@ enum FurnaceGUIActions {
GUI_ACTION_WINDOW_PIANO, GUI_ACTION_WINDOW_PIANO,
GUI_ACTION_WINDOW_NOTES, GUI_ACTION_WINDOW_NOTES,
GUI_ACTION_WINDOW_CHANNELS, GUI_ACTION_WINDOW_CHANNELS,
GUI_ACTION_WINDOW_REGISTER_VIEW,
GUI_ACTION_COLLAPSE_WINDOW, GUI_ACTION_COLLAPSE_WINDOW,
GUI_ACTION_CLOSE_WINDOW, GUI_ACTION_CLOSE_WINDOW,
@ -520,7 +522,7 @@ class FurnaceGUI {
bool editControlsOpen, ordersOpen, insListOpen, songInfoOpen, patternOpen, insEditOpen; bool editControlsOpen, ordersOpen, insListOpen, songInfoOpen, patternOpen, insEditOpen;
bool waveListOpen, waveEditOpen, sampleListOpen, sampleEditOpen, aboutOpen, settingsOpen; bool waveListOpen, waveEditOpen, sampleListOpen, sampleEditOpen, aboutOpen, settingsOpen;
bool mixerOpen, debugOpen, oscOpen, volMeterOpen, statsOpen, compatFlagsOpen; bool mixerOpen, debugOpen, oscOpen, volMeterOpen, statsOpen, compatFlagsOpen;
bool pianoOpen, notesOpen, channelsOpen; bool pianoOpen, notesOpen, channelsOpen, regViewOpen;
SelectionPoint selStart, selEnd, cursor; SelectionPoint selStart, selEnd, cursor;
bool selecting, curNibble, orderNibble, followOrders, followPattern, changeAllOrders; bool selecting, curNibble, orderNibble, followOrders, followPattern, changeAllOrders;
bool collapseWindow, demandScrollX, fancyPattern, wantPatName; bool collapseWindow, demandScrollX, fancyPattern, wantPatName;
@ -647,6 +649,7 @@ class FurnaceGUI {
void drawPiano(); void drawPiano();
void drawNotes(); void drawNotes();
void drawChannels(); void drawChannels();
void drawRegView();
void drawAbout(); void drawAbout();
void drawSettings(); void drawSettings();
void drawDebug(); void drawDebug();