Get the data needed to disassemble one line of opcodes. Fills in the DisasmLine info. Disassembly formatting flags returned @parama sTargetValue_ indirect/indexed final value ===========================================================================
| 169 | // @parama sTargetValue_ indirect/indexed final value |
| 170 | //=========================================================================== |
| 171 | int GetDisassemblyLine(WORD nBaseAddress, DisasmLine_t& line_) |
| 172 | // char *sAddress_, char *sOpCodes_, |
| 173 | // char *sTarget_, char *sTargetOffset_, int & nTargetOffset_, |
| 174 | // char *sTargetPointer_, char *sTargetValue_, |
| 175 | // char *sImmediate_, char & nImmediate_, char *sBranch_ ) |
| 176 | { |
| 177 | line_.Clear(); |
| 178 | |
| 179 | int iOpcode; |
| 180 | int iOpmode; |
| 181 | int nOpbyte; |
| 182 | |
| 183 | iOpcode = _6502_GetOpmodeOpbyte(nBaseAddress, iOpmode, nOpbyte, &line_.pDisasmData); |
| 184 | const DisasmData_t* pData = line_.pDisasmData; // Disassembly_IsDataAddress( nBaseAddress ); |
| 185 | |
| 186 | line_.iOpcode = iOpcode; |
| 187 | line_.iOpmode = iOpmode; |
| 188 | line_.nOpbyte = nOpbyte; |
| 189 | |
| 190 | #if _DEBUG |
| 191 | // if (iLine != 41) |
| 192 | // return nOpbytes; |
| 193 | #endif |
| 194 | |
| 195 | if (iOpmode == AM_M) |
| 196 | line_.bTargetImmediate = true; |
| 197 | |
| 198 | if ((iOpmode >= AM_IZX) && (iOpmode <= AM_NA)) |
| 199 | line_.bTargetIndirect = true; // () |
| 200 | |
| 201 | if ((iOpmode >= AM_IZX) && (iOpmode <= AM_NZY)) |
| 202 | line_.bTargetIndexed = true; // () |
| 203 | |
| 204 | if (((iOpmode >= AM_A) && (iOpmode <= AM_ZY)) || line_.bTargetIndirect) |
| 205 | line_.bTargetValue = true; // #$ |
| 206 | |
| 207 | if ((iOpmode == AM_AX) || (iOpmode == AM_ZX) || (iOpmode == AM_IZX) || (iOpmode == AM_IAX)) |
| 208 | line_.bTargetX = true; // ,X |
| 209 | |
| 210 | if ((iOpmode == AM_AY) || (iOpmode == AM_ZY) || (iOpmode == AM_NZY)) |
| 211 | line_.bTargetY = true; // ,Y |
| 212 | |
| 213 | unsigned int nMinBytesLen = (DISASM_DISPLAY_MAX_OPCODES * (2 + g_bConfigDisasmOpcodeSpaces)); // 2 char for byte (or 3 with space) |
| 214 | |
| 215 | int bDisasmFormatFlags = 0; |
| 216 | |
| 217 | // Composite string that has the symbol or target nAddress |
| 218 | WORD nTarget = 0; |
| 219 | |
| 220 | if ((iOpmode != AM_IMPLIED) && |
| 221 | (iOpmode != AM_1) && |
| 222 | (iOpmode != AM_2) && |
| 223 | (iOpmode != AM_3)) |
| 224 | { |
| 225 | // Assume target address starts after the opcode ... |
| 226 | // BUT in the Assembler Directive / Data Disassembler case for define addr/word |
| 227 | // the opcode literally IS the target address! |
| 228 | if (pData) |
no test coverage detected