]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Optional short absolute disassembly (-$xxxx.w/$FFFFxxx.w)
authorToni Wilen <twilen@winuae.net>
Thu, 18 Aug 2022 18:11:21 +0000 (21:11 +0300)
committerToni Wilen <twilen@winuae.net>
Thu, 18 Aug 2022 18:11:21 +0000 (21:11 +0300)
disasm.cpp
include/disasm.h

index eb4702a6119e51e3f56f6f733ee875cfc07dff9a..20933b71bbd1c382bcc2159af79c7749fba11d19 100644 (file)
 #include "debugmem.h"
 #include "disasm.h"
 
-int disasm_flags = DISASM_FLAG_LC_MNEMO | DISASM_FLAG_LC_REG | DISASM_FLAG_LC_SIZE | DISASM_FLAG_LC_HEX | DISASM_FLAG_CC | DISASM_FLAG_EA | DISASM_FLAG_VAL | DISASM_FLAG_WORDS;
+int disasm_flags = DISASM_FLAG_LC_MNEMO | DISASM_FLAG_LC_REG | DISASM_FLAG_LC_SIZE | DISASM_FLAG_LC_HEX |
+       DISASM_FLAG_CC | DISASM_FLAG_EA | DISASM_FLAG_VAL | DISASM_FLAG_WORDS | DISASM_FLAG_ABSSHORTLONG;
 int disasm_min_words = 5;
 int disasm_max_words = 16;
 TCHAR disasm_hexprefix[3] = { '$', 0 };
 
 static TCHAR disasm_areg, disasm_dreg;
 static TCHAR disasm_pcreg[3], disasm_fpreg[3];
+static bool absshort_long = false;
 
 void disasm_init(void)
 {
@@ -28,6 +30,7 @@ void disasm_init(void)
        }
        disasm_areg = (disasm_flags & DISASM_FLAG_LC_REG) ? 'a' : 'A';
        disasm_dreg = (disasm_flags & DISASM_FLAG_LC_REG) ? 'd' : 'D';
+       absshort_long = (disasm_flags & DISASM_FLAG_ABSSHORTLONG) != 0;
 
 }
 
@@ -560,10 +563,20 @@ uaecptr ShowEA(void *f, uaecptr pc, uae_u16 opcode, int reg, amodes mode, wordsi
                }
                break;
        case absw:
-               addr = (uae_s32)(uae_s16)get_iword_debug (pc);
-               _stprintf (buffer, disasm_lc_hex(_T("$%04X")), (uae_u16)addr);
-               pc += 2;
-               showea_val(buffer, opcode, addr, size);
+               {
+                       addr = (uae_s32)(uae_s16)get_iword_debug (pc);
+                       uae_s16 saddr = (uae_s16)addr;
+                       TCHAR w = (disasm_flags & DISASM_FLAG_LC_REG) ? 'w' : 'W';
+                       if (absshort_long) {
+                               _stprintf(buffer, disasm_lc_hex(_T("$%08X.%c")), addr, w);
+                       } else if (saddr < 0) {
+                               _stprintf(buffer, disasm_lc_hex(_T("-$%04X.%c")), -saddr, w);
+                       } else {
+                               _stprintf(buffer, disasm_lc_hex(_T("$%04X.%c")), saddr, w);
+                       }
+                       pc += 2;
+                       showea_val(buffer, opcode, addr, size);
+               }
                break;
        case absl:
                addr = get_ilong_debug (pc);
index 4ed91a9dda4582775d4a654fbe9425aad9fb0f20..a877c2d08bc8f3ffe9b6f415be244be4163edb47 100644 (file)
@@ -24,3 +24,4 @@ extern TCHAR disasm_hexprefix[3];
 #define DISASM_FLAG_EA 64
 #define DISASM_FLAG_VAL 128
 #define DISASM_FLAG_WORDS 256
+#define DISASM_FLAG_ABSSHORTLONG 512