fix for new-PPU debug information (address and pixel)

This commit is contained in:
rainwarrior 2015-01-28 18:12:06 +00:00
parent 53544c7f79
commit 7ad8b79cd3
5 changed files with 20 additions and 6 deletions

View File

@ -271,7 +271,7 @@ uint8 GetMem(uint16 A) {
case 3: return PPU[3]; case 3: return PPU[3];
case 4: return SPRAM[PPU[3]]; case 4: return SPRAM[PPU[3]];
case 5: return XOffset; case 5: return XOffset;
case 6: return RefreshAddr&0xFF; case 6: return FCEUPPU_PeekAddress() & 0xFF;
case 7: return VRAMBuffer; case 7: return VRAMBuffer;
} }
// feos: added more registers // feos: added more registers
@ -296,7 +296,7 @@ uint8 GetMem(uint16 A) {
} }
uint8 GetPPUMem(uint8 A) { uint8 GetPPUMem(uint8 A) {
uint16 tmp=RefreshAddr&0x3FFF; uint16 tmp = FCEUPPU_PeekAddress() & 0x3FFF;
if (tmp<0x2000) return VPage[tmp>>10][tmp]; if (tmp<0x2000) return VPage[tmp>>10][tmp];
if (tmp>=0x3F00) return PALRAM[tmp&0x1F]; if (tmp>=0x3F00) return PALRAM[tmp&0x1F];
@ -624,13 +624,14 @@ static void breakpoint(uint8 *opcode, uint16 A, int size) {
// PPU Mem breaks // PPU Mem breaks
if ((watchpoint[i].flags & brk_type) && ((A >= 0x2000) && (A < 0x4000)) && ((A&7) == 7)) if ((watchpoint[i].flags & brk_type) && ((A >= 0x2000) && (A < 0x4000)) && ((A&7) == 7))
{ {
const uint32 PPUAddr = FCEUPPU_PeekAddress();
if (watchpoint[i].endaddress) if (watchpoint[i].endaddress)
{ {
if ((watchpoint[i].address <= RefreshAddr) && (watchpoint[i].endaddress >= RefreshAddr)) if ((watchpoint[i].address <= PPUAddr) && (watchpoint[i].endaddress >= PPUAddr))
BreakHit(i); BreakHit(i);
} else } else
{ {
if (watchpoint[i].address == RefreshAddr) if (watchpoint[i].address == PPUAddr)
BreakHit(i); BreakHit(i);
} }
} }

View File

@ -116,7 +116,7 @@ extern void IncrementInstructionsCounters();
//internal variables that debuggers will want access to //internal variables that debuggers will want access to
extern uint8 *vnapage[4],*VPage[8]; extern uint8 *vnapage[4],*VPage[8];
extern uint8 PPU[4],PALRAM[0x20],SPRAM[0x100],VRAMBuffer,PPUGenLatch,XOffset; extern uint8 PPU[4],PALRAM[0x20],SPRAM[0x100],VRAMBuffer,PPUGenLatch,XOffset;
extern uint32 RefreshAddr; extern uint32 FCEUPPU_PeekAddress();
extern int debug_loggingCD; extern int debug_loggingCD;
extern int numWPs; extern int numWPs;

View File

@ -855,7 +855,7 @@ void UpdateDebugger(bool jump_to_pc)
sprintf(str, "%04X", (int)X.PC); sprintf(str, "%04X", (int)X.PC);
SetDlgItemText(hDebug, IDC_DEBUGGER_VAL_PC, str); SetDlgItemText(hDebug, IDC_DEBUGGER_VAL_PC, str);
sprintf(str, "%04X", (int)RefreshAddr); sprintf(str, "%04X", (int)FCEUPPU_PeekAddress());
SetDlgItemText(hDebug, IDC_DEBUGGER_VAL_PPU, str); SetDlgItemText(hDebug, IDC_DEBUGGER_VAL_PPU, str);
sprintf(str, "%02X", PPU[3]); sprintf(str, "%02X", PPU[3]);
SetDlgItemText(hDebug, IDC_DEBUGGER_VAL_SPR, str); SetDlgItemText(hDebug, IDC_DEBUGGER_VAL_SPR, str);

View File

@ -1880,6 +1880,15 @@ void FCEUPPU_SaveState(void) {
RefreshAddrT = RefreshAddr; RefreshAddrT = RefreshAddr;
} }
uint32 FCEUPPU_PeekAddress()
{
if (newppu)
{
return ppur.get_2007access() & 0x3FFF;
}
return RefreshAddr & 0x3FFF;
}
//--------------------- //---------------------
int pputime = 0; int pputime = 0;
@ -2025,6 +2034,8 @@ int FCEUX_PPU_Loop(int skip) {
g_rasterpos = 0; g_rasterpos = 0;
ppur.status.sl = sl; ppur.status.sl = sl;
linestartts = timestamp * 48 + X.count; // pixel timestamp for debugger
const int yp = sl - 1; const int yp = sl - 1;
ppuphase = PPUPHASE_BG; ppuphase = PPUPHASE_BG;

View File

@ -16,10 +16,12 @@ extern uint8 PPUCHRRAM;
void FCEUPPU_SaveState(void); void FCEUPPU_SaveState(void);
void FCEUPPU_LoadState(int version); void FCEUPPU_LoadState(int version);
uint32 FCEUPPU_PeekAddress();
uint8* FCEUPPU_GetCHR(uint32 vadr, uint32 refreshaddr); uint8* FCEUPPU_GetCHR(uint32 vadr, uint32 refreshaddr);
void ppu_getScroll(int &xpos, int &ypos); void ppu_getScroll(int &xpos, int &ypos);
#ifdef _MSC_VER #ifdef _MSC_VER
#define FASTCALL __fastcall #define FASTCALL __fastcall
#else #else