Win32 - Debugger - Shows scanlines 241-261 (vblank)

This commit is contained in:
adelikat 2009-03-12 19:29:22 +00:00
parent 7099dcfeea
commit 48c3f49058
5 changed files with 30 additions and 9 deletions

View File

@ -13,10 +13,10 @@
#include "driver.h" #include "driver.h"
#include "ppu.h" #include "ppu.h"
#include "x6502abbrev.h" #include "x6502abbrev.h"
int vblankScanLines = 0; //Used to calculate scanlines 240-261 (vblank)
int offsetStringToInt(unsigned int type, const char* offsetBuffer) int offsetStringToInt(unsigned int type, const char* offsetBuffer)
{ {
int offset = 0; int offset = 0;
@ -534,6 +534,7 @@ void breakpoint() {
return; return;
} }
//if we're running for a scanline, we want to check if we've hit the cycle limit //if we're running for a scanline, we want to check if we've hit the cycle limit
if (dbgstate.runline) { if (dbgstate.runline) {
uint64 ts = timestampbase; uint64 ts = timestampbase;
ts+=timestamp; ts+=timestamp;
@ -611,8 +612,16 @@ void breakpoint() {
int debug_tracing; int debug_tracing;
void DebugCycle() { void DebugCycle() {
if (scanline == 240)
{
vblankScanLines = (timestamp / 114); //114 approximates the number of timestamps per scanline during vblank. Approx 2508
//FCEUI_printf("ts: %d line: %d\n", timestamp, vblankScanLines); //Debug
}
else
vblankScanLines = 0;
if (numWPs || dbgstate.step || dbgstate.runline || dbgstate.stepout || watchpoint[64].flags || dbgstate.badopbreak) if (numWPs || dbgstate.step || dbgstate.runline || dbgstate.stepout || watchpoint[64].flags || dbgstate.badopbreak)
breakpoint(); breakpoint();
if(debug_loggingCD) LogCDData(); if(debug_loggingCD) LogCDData();

View File

@ -47,6 +47,8 @@ extern int myNumWPs;
// ################################## End of SP CODE ########################### // ################################## End of SP CODE ###########################
extern int vblankScanLines;
int childwnd; int childwnd;
extern readfunc ARead[0x10000]; extern readfunc ARead[0x10000];
@ -544,7 +546,11 @@ void UpdateDebugger()
if (ppupixel>341) //maximum number of pixels per scanline if (ppupixel>341) //maximum number of pixels per scanline
ppupixel = 0; //Currently pixel display is borked until Run 128 lines is clicked, this keeps garbage from displaying ppupixel = 0; //Currently pixel display is borked until Run 128 lines is clicked, this keeps garbage from displaying
if (scanline == 240 && vblankScanLines < 22)
sprintf(str, "Scanline %d, PPU pixel %d", scanline+vblankScanLines,ppupixel);
else
sprintf(str, "Scanline %d, PPU pixel %d", scanline,ppupixel); sprintf(str, "Scanline %d, PPU pixel %d", scanline,ppupixel);
SetDlgItemText(hDebug, IDC_DEBUGGER_VAL_SLINE, str); SetDlgItemText(hDebug, IDC_DEBUGGER_VAL_SLINE, str);
tmp = X.S|0x0100; tmp = X.S|0x0100;
@ -1254,6 +1260,8 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
uint64 ts=timestampbase; uint64 ts=timestampbase;
ts+=timestamp; ts+=timestamp;
ts+=341/3; ts+=341/3;
//if (scanline == 240) vblankScanLines++;
//else vblankScanLines = 0;
FCEUI_Debugger().runline_end_time=ts; FCEUI_Debugger().runline_end_time=ts;
} }
FCEUI_SetEmulationPaused(0); FCEUI_SetEmulationPaused(0);
@ -1270,6 +1278,8 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
ts+=timestamp; ts+=timestamp;
ts+=128*341/3; ts+=128*341/3;
FCEUI_Debugger().runline_end_time=ts; FCEUI_Debugger().runline_end_time=ts;
//if (scanline+128 >= 240 && scanline+128 <= 257) vblankScanLines = (scanline+128)-240;
//else vblankScanLines = 0;
} }
FCEUI_SetEmulationPaused(0); FCEUI_SetEmulationPaused(0);
UpdateDebugger(); UpdateDebugger();

View File

@ -68,7 +68,7 @@ static uint32 ppulut2[256];
static uint32 ppulut3[128]; static uint32 ppulut3[128];
PPUPHASE ppuphase; PPUPHASE ppuphase;
int test = 0;
template<typename T, int BITS> template<typename T, int BITS>
struct BITREVLUT { struct BITREVLUT {
@ -1680,9 +1680,11 @@ int FCEUPPU_Loop(int skip)
DEBUG(FCEUD_UpdatePPUView(scanline, 1)); DEBUG(FCEUD_UpdatePPUView(scanline, 1));
DoLine(); DoLine();
} }
if(MMC5Hack && (ScreenON || SpriteON)) MMC5_hb(scanline); if(MMC5Hack && (ScreenON || SpriteON)) MMC5_hb(scanline);
for(x=1,max=0,maxref=0;x<7;x++) for(x=1,max=0,maxref=0;x<7;x++)
{ {
if(deempcnt[x]>max) if(deempcnt[x]>max)
{ {
max=deempcnt[x]; max=deempcnt[x];

View File

@ -419,7 +419,7 @@ void X6502_Run(int32 cycles)
cycles*=16; // 16*4=64 cycles*=16; // 16*4=64
_count+=cycles; _count+=cycles;
extern int test; test++;
while(_count>0) while(_count>0)
{ {
int32 temp; int32 temp;