mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-31 15:30:14 +00:00
Mockingboard: support AY-3-8913 read
This commit is contained in:
parent
daa0675694
commit
5d46298dcc
@ -709,6 +709,47 @@ void CAY8910::sound_ay_overlay( void )
|
||||
}
|
||||
}
|
||||
|
||||
BYTE CAY8910::sound_ay_read( int reg )
|
||||
{
|
||||
reg &= 15;
|
||||
|
||||
BYTE val = 0;
|
||||
bool got = false;
|
||||
|
||||
if (ay_change_count)
|
||||
{
|
||||
for (int i=ay_change_count-1; i>=0; i--)
|
||||
{
|
||||
if (ay_change[i].reg == reg)
|
||||
{
|
||||
val = ay_change[i].val; // return the most recently written reg's value
|
||||
got = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!got)
|
||||
val = sound_ay_registers[reg];
|
||||
|
||||
switch (reg & 15)
|
||||
{
|
||||
case 1:
|
||||
case 3:
|
||||
case 5:
|
||||
case 13:
|
||||
val &= 15;
|
||||
break;
|
||||
case 6:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
val &= 31;
|
||||
break;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
// AppleWin:TC Holding down ScrollLock will result in lots of AY changes /ay_change_count/
|
||||
// - since sound_ay_overlay() is called to consume them.
|
||||
|
||||
@ -1145,6 +1186,10 @@ bool CAY8910::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, const std::string& su
|
||||
static CAY8910 g_AY8910[MAX_8910];
|
||||
static unsigned __int64 g_uLastCumulativeCycles = 0;
|
||||
|
||||
BYTE AYReadReg(int chip, int r)
|
||||
{
|
||||
return g_AY8910[chip].sound_ay_read(r);
|
||||
}
|
||||
|
||||
void _AYWriteReg(int chip, int r, int v)
|
||||
{
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#define MAX_8910 4
|
||||
|
||||
BYTE AYReadReg(int chip, int r); // TC
|
||||
|
||||
//-------------------------------------
|
||||
// MAME interface
|
||||
|
||||
@ -40,6 +42,7 @@ public:
|
||||
|
||||
void sound_ay_init( void );
|
||||
void sound_init( const char *device );
|
||||
BYTE sound_ay_read( int reg ); // TC
|
||||
void sound_ay_write( int reg, int val, libspectrum_dword now );
|
||||
void sound_ay_reset( void );
|
||||
void sound_frame( void );
|
||||
|
@ -321,6 +321,7 @@ static void AY8910_Write(BYTE nDevice, BYTE /*nReg*/, BYTE nValue, BYTE nAYDevic
|
||||
break;
|
||||
|
||||
case AY_READ: // 5: READ FROM PSG (need to set DDRA to input)
|
||||
pMB->sy6522.ORA = AYReadReg(nDevice+2*nAYDevice, pMB->nAYCurrentRegister) & (pMB->sy6522.DDRA ^ 0xff);
|
||||
break;
|
||||
|
||||
case AY_WRITE: // 6: WRITE TO PSG
|
||||
|
Loading…
x
Reference in New Issue
Block a user