]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
DMA debugger initial start support
authorToni Wilen <twilen@winuae.net>
Fri, 23 Sep 2022 17:33:58 +0000 (20:33 +0300)
committerToni Wilen <twilen@winuae.net>
Fri, 23 Sep 2022 17:33:58 +0000 (20:33 +0300)
blitter.cpp
custom.cpp
debug.cpp
include/debug.h
main.cpp
newcpu.cpp

index f6350a08785308cb1daed0dfcba99f6926c4659d..db692f5e4a0a30b8725579693b3b75f412f51429 100644 (file)
@@ -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) {
index cc6562820638260f8c55123377b4bcac9a7d4e4d..104490255263107214ecfe6fef13d06b90d7ea27 100644 (file)
@@ -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)
index 826950ad1ddfe122e589efe73ca4aa564ad82fc8..0ed27bcd19d17b4904efbb59d2cfd750d2f4ded8 100644 (file)
--- 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;
index 6b55b72ca93c866ff9be711f04c35306c38dda59..61acd657d534cb4929226392d3afb1ded05a89d0 100644 (file)
@@ -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);
index 45c6b7784006d1a7d036022ee52c39a4654cce4e..318109f50782c0075bf09865ea983d83db6e6edb 100644 (file)
--- 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;
 
index c17841506d6d05d831ab8b9e9eeee4ae7231e2a2..861eef58fc27170b9b4d4a493cdabe8073233061 100644 (file)
@@ -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 ();