]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
ex debugger command that shows last PC (cpu/copper) write access and value written.
authorToni Wilen <twilen@winuae.net>
Tue, 1 May 2018 13:27:54 +0000 (16:27 +0300)
committerToni Wilen <twilen@winuae.net>
Tue, 1 May 2018 13:27:54 +0000 (16:27 +0300)
custom.cpp
debug.cpp
include/custom.h

index a4b7ea557fa74d297c7ec3ea918e1223b05e45f8..a2e80ab69d6fde65a0ec777e1c25e3b450ed79ef 100644 (file)
@@ -415,6 +415,8 @@ static bool ddfstop_matched;
 static int bitplane_overrun, bitplane_overrun_hpos;
 static int bitplane_overrun_fetch_cycle, bitplane_overrun_cycle_diagram_shift;
 
+struct custom_store custom_storage[256];
+
 enum plfstate
 {
        plf_idle,
@@ -9102,6 +9104,7 @@ void custom_reset (bool hardreset, bool keyboardreset)
        lightpen_x[1] = -1;
        lightpen_y[1] = -1;
        nr_armed = 0;
+       memset(custom_storage, 0, sizeof(custom_storage));
 
        if (!savestate_state) {
                cia_hsync = 0;
@@ -9581,12 +9584,15 @@ static int REGPARAM2 custom_wput_1 (int hpos, uaecptr addr, uae_u32 value, int n
 {
        addr &= 0x1FE;
        value &= 0xffff;
+       custom_storage[addr >> 1].value = (uae_u16)value;
+       custom_storage[addr >> 1].pc = copper_access ? cop_state.ip | 1 : M68K_GETPC;
 #ifdef ACTION_REPLAY
 #ifdef ACTION_REPLAY_COMMON
-       ar_custom[addr+0]=(uae_u8)(value>>8);
-       ar_custom[addr+1]=(uae_u8)(value);
+       ar_custom[addr + 0]=(uae_u8)(value >> 8);
+       ar_custom[addr + 1]=(uae_u8)(value);
 #endif
 #endif
+
        switch (addr) {
        case 0x00E: CLXDAT (); break;
 
index d6f40cc3bfaeae5965bc5a04d00305be47c6cae8..5ac73ff387cf38be17b75fe9df1245b6e35589fa 100644 (file)
--- a/debug.cpp
+++ b/debug.cpp
@@ -162,7 +162,7 @@ static const TCHAR help[] = {
        _T("  fo <num> <reg> <oper> <val> [<mask> <val2>] Conditional register breakpoint.\n")
        _T("   reg=Dx,Ax,PC,USP,ISP,VBR,SR. oper:!=,==,<,>,>=,<=,-,!- (-=val to val2 range).\n")
        _T("  f <addr1> <addr2>     Step forward until <addr1> <= PC <= <addr2>.\n")
-       _T("  e                     Dump contents of all custom registers, ea = AGA colors.\n")
+       _T("  e[x]                  Dump contents of all custom registers, ea = AGA colors.\n")
        _T("  i [<addr>]            Dump contents of interrupt and trap vectors.\n")
        _T("  il [<mask>]           Exception breakpoint.\n")
        _T("  o <0-2|addr> [<lines>]View memory as Copper instructions.\n")
@@ -1186,11 +1186,14 @@ static void dumpmem (uaecptr addr, uaecptr *nxmem, int lines)
        *nxmem = addr;
 }
 
-static void dump_custom_regs (int aga)
+static void dump_custom_regs(bool aga, bool ext)
 {
-       int len, i, j, end;
+       int len, end;
        uae_u8 *p1, *p2, *p3, *p4;
+       TCHAR extra1[256], extra2[256];
 
+       extra1[0] = 0;
+       extra2[0] = 0;
        if (aga) {
                dump_aga_custom();
                return;
@@ -1198,7 +1201,7 @@ static void dump_custom_regs (int aga)
 
        p1 = p2 = save_custom (&len, 0, 1);
        p1 += 4; // skip chipset type
-       for (i = 0; i < 4; i++) {
+       for (int i = 0; i < 4; i++) {
                p4 = p1 + 0xa0 + i * 16;
                p3 = save_audio (i, &len, 0);
                p4[0] = p3[12];
@@ -1220,19 +1223,26 @@ static void dump_custom_regs (int aga)
                end++;
        end++;
        end /= 2;
-       for (i = 0; i < end; i++) {
+       for (int i = 0; i < end; i++) {
                uae_u16 v1, v2;
                int addr1, addr2;
-               j = end + i;
+               int j = end + i;
                addr1 = custd[i].adr & 0x1ff;
                addr2 = custd[j].adr & 0x1ff;
                v1 = (p1[addr1 + 0] << 8) | p1[addr1 + 1];
                v2 = (p1[addr2 + 0] << 8) | p1[addr2 + 1];
-               console_out_f (_T("%03X %s\t%04X\t%03X %s\t%04X\n"),
-                       addr1, custd[i].name, v1,
-                       addr2, custd[j].name, v2);
+               if (ext) {
+                       struct custom_store *cs;
+                       cs = &custom_storage[addr1 >> 1];
+                       _stprintf(extra1, _T("\t%04X %08X %s"), cs->value, cs->pc & ~1, (cs->pc & 1) ? _T("COP") : _T("CPU"));
+                       cs = &custom_storage[addr2 >> 1];
+                       _stprintf(extra2, _T("\t%04X %08X %s"), cs->value, cs->pc & ~1, (cs->pc & 1) ? _T("COP") : _T("CPU"));
+               }
+               console_out_f (_T("%03X %s\t%04X%s\t%03X %s\t%04X%s\n"),
+                       addr1, custd[i].name, v1, extra1,
+                       addr2, custd[j].name, v2, extra2);
        }
-       free (p2);
+       xfree(p2);
 }
 
 static void dump_vectors (uaecptr addr)
@@ -5256,7 +5266,15 @@ static bool debug_line (TCHAR *input)
                        }
                        break;
                }
-               case 'e': dump_custom_regs (tolower(*inptr) == 'a'); break;
+               case 'e':
+               {
+                       bool aga = tolower(*inptr) == 'a';
+                       if (aga)
+                               next_char(&inptr);
+                       bool ext = tolower(*inptr) == 'x';
+                       dump_custom_regs(aga, ext);
+               }
+               break;
                case 'r':
                {
                        if (*inptr == 'c') {
@@ -5294,7 +5312,7 @@ static bool debug_line (TCHAR *input)
                                        debugmem_list_segment(0, addr);
                                }
                        } else if (*inptr == 'c') {
-                               screenshot(0, 1, 1);
+                               screenshot(-1, 1, 1);
                        } else if (*inptr == 'p') {
                                inptr++;
                                debug_sprite (&inptr);
index 28373ea54335405e7a3573138e0d4a75468accdd..2e2243b7c117f3971151d87df6826e4b2183a475 100644 (file)
@@ -243,4 +243,11 @@ extern void getsyncregisters(uae_u16 *phsstrt, uae_u16 *phsstop, uae_u16 *pvsstr
 int is_bitplane_dma (int hpos);
 void custom_cpuchange(void);
 
+struct custom_store
+{
+       uae_u16 value;
+       uae_u32 pc;
+};
+extern struct custom_store custom_storage[256];
+
 #endif /* UAE_CUSTOM_H */