mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-15 17:25:06 +00:00
AY8930: Fix VGM output.
It was generating writes to register addresses > 15.
This commit is contained in:
parent
66f6ab4307
commit
ffa0727bf6
2 changed files with 19 additions and 11 deletions
|
@ -25,7 +25,7 @@
|
|||
#include <math.h>
|
||||
|
||||
#define rWrite(a,v) if (!skipRegisterWrites) {pendingWrites[a]=v;}
|
||||
#define immWrite(a,v) if (!skipRegisterWrites) {writes.emplace(a,v); if (dumpWrites) {addWrite(a,v);} }
|
||||
#define immWrite2(a,v) if (!skipRegisterWrites) {writes.emplace(a,v); if (dumpWrites) {addWrite(a,v);} }
|
||||
|
||||
#define CHIP_DIVIDER 8
|
||||
|
||||
|
@ -61,6 +61,18 @@ const char* regCheatSheetAY8930[]={
|
|||
NULL
|
||||
};
|
||||
|
||||
void DivPlatformAY8930::immWrite(unsigned char a, unsigned char v) {
|
||||
if ((int)bank!=(a>>4)) {
|
||||
bank=a>>4;
|
||||
immWrite2(0x0d, 0xa0|(bank<<4)|ayEnvMode[0]);
|
||||
}
|
||||
if (a==0x0d) {
|
||||
immWrite2(0x0d,0xa0|(bank<<4)|(v&15));
|
||||
} else {
|
||||
immWrite2(a&15,v);
|
||||
}
|
||||
}
|
||||
|
||||
const char** DivPlatformAY8930::getRegisterSheet() {
|
||||
return regCheatSheetAY8930;
|
||||
}
|
||||
|
@ -123,18 +135,13 @@ void DivPlatformAY8930::acquire(short* bufL, short* bufR, size_t start, size_t l
|
|||
}
|
||||
while (!writes.empty()) {
|
||||
QueuedWrite w=writes.front();
|
||||
if ((int)bank!=(w.addr>>4)) {
|
||||
bank=w.addr>>4;
|
||||
ay->address_w(0x0d);
|
||||
ay->data_w(0xa0|(bank<<4)|ayEnvMode[0]);
|
||||
}
|
||||
ay->address_w(w.addr&15);
|
||||
if (w.addr==0x0d) {
|
||||
ay->data_w(0xa0|(bank<<4)|(w.val&15));
|
||||
ay->address_w(w.addr);
|
||||
ay->data_w(w.val);
|
||||
if (w.addr!=0x0d && (regPool[0x0d]&0xf0)==0xb0) {
|
||||
regPool[(w.addr&0x0f)|0x10]=w.val;
|
||||
} else {
|
||||
ay->data_w(w.val);
|
||||
regPool[w.addr&0x0f]=w.val;
|
||||
}
|
||||
regPool[w.addr&0x1f]=w.val;
|
||||
writes.pop();
|
||||
}
|
||||
ay->sound_stream_update(ayBuf,len);
|
||||
|
|
|
@ -73,6 +73,7 @@ class DivPlatformAY8930: public DivDispatch {
|
|||
size_t ayBufLen;
|
||||
|
||||
void updateOutSel(bool immediate=false);
|
||||
void immWrite(unsigned char a, unsigned char v);
|
||||
|
||||
friend void putDispatchChan(void*,int,int);
|
||||
|
||||
|
|
Loading…
Reference in a new issue