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 "ppu.h"
#include "x6502abbrev.h"
int vblankScanLines = 0; //Used to calculate scanlines 240-261 (vblank)
int offsetStringToInt(unsigned int type, const char* offsetBuffer)
{
int offset = 0;
@ -504,7 +504,7 @@ void BreakHit(bool force = false) {
///fires a breakpoint
void breakpoint() {
int i;
int i;
uint16 A=0;
uint8 brk_type,opcode[3] = {0};
@ -534,6 +534,7 @@ void breakpoint() {
return;
}
//if we're running for a scanline, we want to check if we've hit the cycle limit
if (dbgstate.runline) {
uint64 ts = timestampbase;
ts+=timestamp;
@ -611,8 +612,16 @@ void breakpoint() {
int debug_tracing;
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)
breakpoint();
if(debug_loggingCD) LogCDData();

View File

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

View File

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

View File

@ -28,4 +28,4 @@ enum PPUPHASE {
PPUPHASE_VBL, PPUPHASE_BG, PPUPHASE_OBJ
};
extern PPUPHASE ppuphase;
extern PPUPHASE ppuphase;

View File

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