From: Toni Wilen Date: Fri, 23 Sep 2022 17:33:58 +0000 (+0300) Subject: DMA debugger initial start support X-Git-Tag: 41000~141 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=6742dc00bf162359bd05657743e87c3cb930e176;p=francis%2Fwinuae.git DMA debugger initial start support --- diff --git a/blitter.cpp b/blitter.cpp index f6350a08..db692f5e 100644 --- a/blitter.cpp +++ b/blitter.cpp @@ -2170,8 +2170,8 @@ void restore_blitter_start(void) void restore_blitter_finish (void) { - record_dma_reset(); - record_dma_reset(); + record_dma_reset(0); + record_dma_reset(0); blitter_cycle_exact = currprefs.blitter_cycle_exact; immediate_blits = currprefs.immediate_blits; if (blt_statefile_type == 0) { diff --git a/custom.cpp b/custom.cpp index cc656282..10449025 100644 --- a/custom.cpp +++ b/custom.cpp @@ -11217,7 +11217,7 @@ static void vsync_handler_post(void) record_copper_reset(); } if (debug_dma) { - record_dma_reset(); + record_dma_reset(0); } #endif @@ -13393,6 +13393,10 @@ void custom_reset(bool hardreset, bool keyboardreset) expamem_reset(hardreset); #endif +#if 0 + record_dma_reset(-1); +#endif + } void custom_dumpstate(int mode) diff --git a/debug.cpp b/debug.cpp index 826950ad..0ed27bcd 100644 --- a/debug.cpp +++ b/debug.cpp @@ -1310,13 +1310,29 @@ static int nr_cop_records[2], curr_cop_set, selected_cop_set; static struct dma_rec *dma_record[2]; static int dma_record_toggle, dma_record_frame[2]; -void record_dma_reset (void) +static void dma_record_init(void) +{ + if (!dma_record[0]) { + dma_record[0] = xmalloc(struct dma_rec, NR_DMA_REC_HPOS * NR_DMA_REC_VPOS); + dma_record[1] = xmalloc(struct dma_rec, NR_DMA_REC_HPOS * NR_DMA_REC_VPOS); + record_dma_reset(0); + dma_record_toggle = 0; + dma_record_frame[0] = -1; + dma_record_frame[1] = -1; + } +} + +void record_dma_reset(int start) { int v, h; struct dma_rec *dr, *dr2; - if (!dma_record[0]) + if (start && !dma_record[0]) { + dma_record_init(); + } + if (!dma_record[0]) { return; + } dma_record_toggle ^= 1; dr = dma_record[dma_record_toggle]; for (v = 0; v < NR_DMA_REC_VPOS; v++) { @@ -1328,6 +1344,9 @@ void record_dma_reset (void) dr2->addr = 0xffffffff; } } + if (start && !debug_dma) { + debug_dma = start; + } } void record_copper_reset (void) @@ -2007,12 +2026,7 @@ void record_dma_write(uae_u16 reg, uae_u32 dat, uae_u32 addr, int hpos, int vpos struct dma_rec *dr; if (!dma_record[0]) { - dma_record[0] = xmalloc(struct dma_rec, NR_DMA_REC_HPOS * NR_DMA_REC_VPOS); - dma_record[1] = xmalloc(struct dma_rec, NR_DMA_REC_HPOS * NR_DMA_REC_VPOS); - dma_record_toggle = 0; - record_dma_reset(); - dma_record_frame[0] = -1; - dma_record_frame[1] = -1; + dma_record_init(); } if (hpos >= NR_DMA_REC_HPOS || vpos >= NR_DMA_REC_VPOS) @@ -2086,18 +2100,6 @@ void record_dma_clear(int hpos, int vpos) dr->cf_reg = 0xffff; } -static void dma_record_init(void) -{ - if (!dma_record[0]) { - dma_record[0] = xmalloc(struct dma_rec, NR_DMA_REC_HPOS * NR_DMA_REC_VPOS); - dma_record[1] = xmalloc(struct dma_rec, NR_DMA_REC_HPOS * NR_DMA_REC_VPOS); - dma_record_toggle = 0; - record_dma_reset(); - dma_record_frame[0] = -1; - dma_record_frame[1] = -1; - } -} - void record_cia_access(int r, int mask, uae_u16 value, bool rw, int hpos, int vpos) { struct dma_rec* dr; @@ -6531,7 +6533,7 @@ static bool debug_line (TCHAR *input) } else if (*inptr == 'o') { if (debug_dma) { console_out_f (_T("DMA debugger disabled\n"), debug_dma); - record_dma_reset(); + record_dma_reset(0); reset_drawing(); debug_dma = 0; } @@ -6586,7 +6588,7 @@ static bool debug_line (TCHAR *input) decode_dma_record (v2, v1, cmd == 'v', nextcmd == 'l'); } else { if (debug_dma) { - record_dma_reset(); + record_dma_reset(0); reset_drawing(); } debug_dma = v1 < 0 ? -v1 : 1; diff --git a/include/debug.h b/include/debug.h index 6b55b72c..61acd657 100644 --- a/include/debug.h +++ b/include/debug.h @@ -289,7 +289,7 @@ extern void record_dma_write(uae_u16 reg, uae_u32 v, uae_u32 addr, int hpos, int extern void record_dma_read_value(uae_u32 v); extern void record_dma_read_value_wide(uae_u64 v, bool quad); extern void record_dma_replace(int hpos, int vpos, int type, int extra); -extern void record_dma_reset(void); +extern void record_dma_reset(int); extern void record_dma_event(uae_u32 evt, int hpos, int vpos); extern void record_dma_event_data(uae_u32 evt, int hpos, int vpos, uae_u32 data); extern void record_dma_clear(int hpos, int vpos); diff --git a/main.cpp b/main.cpp index 45c6b778..318109f5 100644 --- a/main.cpp +++ b/main.cpp @@ -763,8 +763,8 @@ static int default_config; void uae_reset (int hardreset, int keyboardreset) { if (debug_dma) { - record_dma_reset (); - record_dma_reset (); + record_dma_reset(0); + record_dma_reset(0); } currprefs.quitstatefile[0] = changed_prefs.quitstatefile[0] = 0; diff --git a/newcpu.cpp b/newcpu.cpp index c1784150..861eef58 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -6331,8 +6331,8 @@ void m68k_go (int may_quit) /* We may have been restoring state, but we're done now. */ if (isrestore ()) { if (debug_dma) { - record_dma_reset (); - record_dma_reset (); + record_dma_reset(0); + record_dma_reset(0); } restored = savestate_restore_finish (); memory_map_dump ();