Lua sound.get(): add a little more members for DMC channel.

This commit is contained in:
gocha 2011-02-27 11:21:34 +00:00
parent 88c8e1521e
commit e0aff101e0
2 changed files with 8 additions and 1 deletions

View File

@ -4111,6 +4111,7 @@ static int sound_get(lua_State *L)
extern uint8 DMCAddressLatch, DMCSizeLatch;
extern uint8 DMCFormat;
extern char DMCHaveSample;
extern uint8 InitialRawDALatch;
int freqReg;
double freq;
@ -4219,6 +4220,10 @@ static int sound_get(lua_State *L)
lua_setfield(L, -2, "dmcaddress");
lua_pushinteger(L, (DMCSizeLatch << 4) + 1);
lua_setfield(L, -2, "dmcsize");
lua_pushboolean(L, DMCFormat & 0x40);
lua_setfield(L, -2, "dmcloop");
lua_pushinteger(L, InitialRawDALatch);
lua_setfield(L, -2, "dmcseed");
lua_setfield(L, -2, "dpcm");
// rp2a03 end
lua_setfield(L, -2, "rp2a03");

View File

@ -52,6 +52,7 @@ static int32 wlcount[4]={0,0,0,0}; /* Wave length counters. */
static uint8 IRQFrameMode=0; /* $4017 / xx000000 */
/*static*/ uint8 PSG[0x10];
static uint8 RawDALatch=0; /* $4011 0xxxxxxx */
/*static*/ uint8 InitialRawDALatch=0; // used only for lua
uint8 EnabledChannels=0; /* Byte written to $4015 */
@ -322,7 +323,8 @@ static DECLFW(Write_DMCRegs)
DMCFormat=V;
break;
case 0x01:DoPCM();
RawDALatch=V&0x7F;
InitialRawDALatch=V&0x7F;
RawDALatch=InitialRawDALatch;
break;
case 0x02:DMCAddressLatch=V;break;
case 0x03:DMCSizeLatch=V;break;