]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Reimplement debugger H DMA debugger output
authorToni Wilen <twilen@winuae.net>
Mon, 10 Mar 2025 18:04:34 +0000 (20:04 +0200)
committerToni Wilen <twilen@winuae.net>
Mon, 10 Mar 2025 18:04:34 +0000 (20:04 +0200)
debug.cpp

index 033da6d0c1641592efc2e0264534cadabc0fda2c..bda4d8d602a04ccd2238cffc3481aa978b6bf148 100644 (file)
--- a/debug.cpp
+++ b/debug.cpp
@@ -6623,45 +6623,39 @@ static void ppc_disasm(uaecptr addr, uaecptr *nextpc, int cnt)
 
 static void dma_disasm(int frames, int vp, int hp, int frames_end, int vp_end, int hp_end)
 {
-       if (!dma_record_data || frames < 0 || vp < 0 || hp < 0)
+       if (!dma_record_data || frames < 0 || vp < 0 || hp < 0) {
                return;
-#if 0
+       }
+       struct dma_rec *drs = find_dma_record(hp, vp, 0);
+       if (!drs) {
+               return;
+       }
+       struct dma_rec *dr = drs;
        for (;;) {
-               struct dma_rec *dr = NULL, *drs = NULL;
-               if (dma_record_frame[0] == frames) {
-                       drs = &dma_record[0][vp * NR_DMA_REC_HPOS];
-                       dr = &dma_record[0][vp * NR_DMA_REC_HPOS + hp];
-               } else if (dma_record_frame[1] == frames) {
-                       drs = &dma_record[1][vp * NR_DMA_REC_HPOS];
-                       dr = &dma_record[1][vp * NR_DMA_REC_HPOS + hp];
-               }
-               if (!dr)
-                       return;
-               TCHAR l1[16], l2[16], l3[16], l4[16];
-               if (get_record_dma_info(drs, dr, l1, l2, l3, l4, NULL, NULL, NULL, NULL)) {
+               TCHAR l1[30], l1b[30], l1c[30], l2[30], l3[30], l4[30], l5[30], l6[30];
+               if (get_record_dma_info(drs, dr, l1, l1b, l1c, l2, l3, l4, l5, l6, NULL, NULL)) {
                        TCHAR tmp[256];
-                       _stprintf(tmp, _T(" - %02d %02X %s"), dr->ipl, dr->hpos, l2);
+                       _stprintf(tmp, _T(" - %03d %s"), dr->hpos, l2);
                        while (_tcslen(tmp) < 20) {
                                _tcscat(tmp, _T(" "));
                        }
                        console_out_f(_T("%s %11s %11s\n"), tmp, l3, l4);
                }
-               hp++;
-               if (dr->end || hp >= NR_DMA_REC_HPOS) {
-                       hp = 0;
-                       vp++;
-                       if (vp >= maxvpos + 1) {
-                               vp = 0;
-                               frames++;
-                               break;
-                       }
+               dr++;
+               if (dr == dma_record_data + NR_DMA_REC_MAX) {
+                       dr = dma_record_data;
+               }
+               if (vp_end < 0 || hp_end < 0 || frames_end < 0) {
+                       break;
                }
-               if ((frames == frames_end && vp == vp_end && hp == hp_end) || frames > frames_end)
+               int vpc = dr->vpos[dma_record_vpos_type];
+               if (vpc > vp_end || vpc < vp) {
                        break;
-               if (vp_end < 0 || hp_end < 0 || frames_end < 0)
+               }
+               if (vpc == vp_end && dr->hpos >= hp_end) {
                        break;
+               }
        }
-#endif
 }
 
 static uaecptr nxdis, nxmem, asmaddr;
@@ -7019,7 +7013,7 @@ static bool debug_line (TCHAR *input)
 
                case 'H':
                        {
-                               int count, temp, badly, skip;
+                               int count, temp, badly, skip, dmadbg;
                                uae_u32 addr = 0;
                                uae_u32 oldpc = m68k_getpc ();
                                int lastframes, lastvpos, lasthpos;
@@ -7030,6 +7024,11 @@ static bool debug_line (TCHAR *input)
                                        badly = 1;
                                        inptr++;
                                }
+                               dmadbg = 0;
+                               if (inptr[0] == 'D') {
+                                       dmadbg = 1;
+                                       inptr++;
+                               }
 
                                if (more_params(&inptr))
                                        count = readint(&inptr, NULL);
@@ -7060,7 +7059,7 @@ static bool debug_line (TCHAR *input)
                                                if (badly) {
                                                        m68k_dumpstate(NULL, 0xffffffff);
                                                } else {
-                                                       if (lastvpos >= 0) {
+                                                       if (dmadbg && lastvpos >= 0) {
                                                                dma_disasm(lastframes, lastvpos, lasthpos, history[temp].fp, history[temp].vpos, history[temp].hpos);
                                                        }
                                                        lastframes = history[temp].fp;