Show some values for registers $4000-$4017 (memview, disassembly).

This commit is contained in:
feos-tas 2014-07-13 12:22:22 +00:00
parent a2aec08026
commit 11e82599e6
7 changed files with 70 additions and 44 deletions

View File

@ -263,7 +263,7 @@ uint8 *GetNesCHRPointer(int A){
}
uint8 GetMem(uint16 A) {
if ((A >= 0x2000) && (A < 0x4000)) {
if ((A >= 0x2000) && (A < 0x4000)) // PPU regs and their mirrors
switch (A&7) {
case 0: return PPU[0];
case 1: return PPU[1];
@ -274,8 +274,24 @@ uint8 GetMem(uint16 A) {
case 6: return RefreshAddr&0xFF;
case 7: return VRAMBuffer;
}
} else if ((A >= 0x4000) && (A < 0x5000)) return 0xFF; // AnS: changed the range, so MMC5 ExRAM can be watched in the Hexeditor
if (GameInfo) return ARead[A](A); //adelikat: 11/17/09: Prevent crash if this is called with no game loaded.
// feos: added more registers
else if ((A >= 0x4000) && (A < 0x4010))
return PSG[A&15];
else if ((A >= 0x4010) && (A < 0x4018))
switch(A&7) {
case 0: return DMCFormat;
case 1: return RawDALatch;
case 2: return DMCAddressLatch;
case 3: return DMCSizeLatch;
case 4: return SpriteDMA;
case 5: return EnabledChannels;
case 6: return RawReg4016;
case 7: return IRQFrameMode;
}
else if ((A >= 0x4018) && (A < 0x5000)) // AnS: changed the range, so MMC5 ExRAM can be watched in the Hexeditor
return 0xFF;
if (GameInfo) //adelikat: 11/17/09: Prevent crash if this is called with no game loaded.
return ARead[A](A);
else return 0;
}

View File

@ -148,6 +148,16 @@ public:
extern NSF_HEADER NSFHeader;
extern uint8 PSG[0x10];
extern uint8 DMCFormat;
extern uint8 RawDALatch;
extern uint8 DMCAddressLatch;
extern uint8 DMCSizeLatch;
extern uint8 EnabledChannels;
extern uint8 SpriteDMA;
extern uint8 RawReg4016;
extern uint8 IRQFrameMode;
///retrieves the core's DebuggerState
DebuggerState &FCEUI_Debugger();

View File

@ -93,6 +93,7 @@ static int CommandMapping[EMUCMD_NUM];
static uint8 joy_readbit[2];
uint8 joy[4]={0,0,0,0}; //HACK - should be static but movie needs it
static uint8 LastStrobe;
uint8 RawReg4016 = 0; // Joystick strobe (W)
static bool replaceP2StartWithMicrophone = false;
@ -172,6 +173,7 @@ static DECLFW(B4016)
portFC.driver->Strobe();
}
LastStrobe=V&0x1;
RawReg4016 = V;
}
//a main joystick port driver representing the case where nothing is plugged in

View File

@ -335,6 +335,7 @@ void (*PPU_hook)(uint32 A);
uint8 vtoggle = 0;
uint8 XOffset = 0;
uint8 SpriteDMA = 0; // $4014 / Writing $xx copies 256 bytes by reading from $xx00-$xxFF and writing to $2004 (OAM data)
uint32 TempAddr = 0, RefreshAddr = 0, DummyRead = 0;
@ -918,6 +919,7 @@ static DECLFW(B4014) {
for (x = 0; x < 256; x++)
X6502_DMW(0x2004, X6502_DMR(t + x));
SpriteDMA = V;
}
#define PAL(c) ((c) + cc)

View File

@ -46,16 +46,19 @@ static uint8 TriMode=0;
static int32 tristep=0;
static int32 wlcount[4]={0,0,0,0}; /* Wave length counters. */
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
// APU registers:
uint8 PSG[0x10]; // $4000-$400F / Channels 1-4
uint8 DMCFormat=0; // $4010 / Play mode and frequency
uint8 RawDALatch=0; // $4011 / 7-bit DAC / 0xxxxxxx
uint8 DMCAddressLatch=0; // $4012 / Start of DMC waveform is at address $C000 + $40*$xx
uint8 DMCSizeLatch=0; // $4013 / Length of DMC waveform is $10*$xx + 1 bytes (128*$xx + 8 samples)
uint8 EnabledChannels=0; // $4015 / Sound channels enable and status
uint8 IRQFrameMode=0; // $4017 / Frame counter control / xx000000
uint8 EnabledChannels=0; /* Byte written to $4015 */
/*static*/ ENVUNIT EnvUnits[3];
uint8 InitialRawDALatch=0; // used only for lua
ENVUNIT EnvUnits[3];
static const int RectDuties[4]={1,2,4,6};
@ -119,18 +122,10 @@ static const uint32 PALDMCTable[0x10]=
176, 148, 132, 118, 98, 78, 66, 50
};
// $4010 - Frequency
// $4011 - Actual data outputted
// $4012 - Address register: $c000 + V*64
// $4013 - Size register: Size in bytes = (V+1)*64
/*static*/ int32 DMCacc=1;
/*static*/ int32 DMCPeriod=0;
/*static*/ uint8 DMCBitCount=0;
/*static*/ uint8 DMCAddressLatch=0,DMCSizeLatch=0; /* writes to 4012 and 4013 */
/*static*/ uint8 DMCFormat=0; /* Write to $4010 */
static uint32 DMCAddress=0;
static int32 DMCSize=0;
static uint8 DMCShift=0;

View File

@ -84,6 +84,7 @@
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>