MCPcopy Create free account
hub / github.com/TASEmulators/fceux / DisassembleWithDebug

Function DisassembleWithDebug

src/drivers/Qt/SymbolicDebug.cpp:96–514  ·  view source on GitHub ↗

--------------------------------------------------------------

Source from the content-addressed store, hash-verified

94}
95//--------------------------------------------------------------
96int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str, debugSymbol_t *symOut, debugSymbol_t *symOut2 )
97{
98 debugSymbol_t *sym = NULL;
99 debugSymbol_t *sym2 = NULL;
100 static char chr[8]={0};
101 uint16_t tmp,tmp2;
102 char stmp[128], stmp2[128];
103 bool symDebugEnable, showTrace;
104
105 symDebugEnable = (flags & ASM_DEBUG_SYMS ) ? true : false;
106 showTrace = (flags & ASM_DEBUG_TRACES) ? true : false;
107
108 //these may be replaced later with passed-in values to make a lighter-weight disassembly mode that may not query the referenced values
109 #define RX (X.X)
110 #define RY (X.Y)
111
112 switch (opcode[0])
113 {
114 #define relative(a) { \
115 if (((a)=opcode[1])&0x80) (a) = addr-(((a)-1)^0xFF); \
116 else (a)+=addr; \
117 }
118 #define absolute(a) { \
119 (a) = opcode[1] | opcode[2]<<8; \
120 }
121 #define zpIndex(a,i) { \
122 (a) = (opcode[1]+(i))&0xFF; \
123 }
124 #define indirectX(a) { \
125 (a) = (opcode[1]+RX)&0xFF; \
126 (a) = GetMem((a)) | (GetMem(((a)+1)&0xff))<<8; \
127 }
128 #define indirectY(a) { \
129 (a) = GetMem(opcode[1]) | (GetMem((opcode[1]+1)&0xff))<<8; \
130 (a) += RY; \
131 }
132
133
134 #ifdef BRK_3BYTE_HACK
135 case 0x00:
136 sprintf(str,"BRK %02X %02X", opcode[1], opcode[2]);
137 break;
138 #else
139 case 0x00: strcpy(str,"BRK"); break;
140 #endif
141
142 //odd, 1-byte opcodes
143 case 0x08: strcpy(str,"PHP"); break;
144 case 0x0A: strcpy(str,"ASL"); break;
145 case 0x18: strcpy(str,"CLC"); break;
146 case 0x28: strcpy(str,"PLP"); break;
147 case 0x2A: strcpy(str,"ROL"); break;
148 case 0x38: strcpy(str,"SEC"); break;
149 case 0x40: strcpy(str,"RTI"); break;
150 case 0x48: strcpy(str,"PHA"); break;
151 case 0x4A: strcpy(str,"LSR"); break;
152 case 0x58: strcpy(str,"CLI"); break;
153 case 0x60: strcpy(str,"RTS"); break;

Callers 2

updateAssemblyViewMethod · 0.85
FCEUD_TraceInstructionFunction · 0.85

Calls 2

replaceSymbolsFunction · 0.85
GetMemFunction · 0.85

Tested by

no test coverage detected