===========================================================================
| 3047 | |
| 3048 | //=========================================================================== |
| 3049 | void DrawTargets ( int line) |
| 3050 | { |
| 3051 | if (! ((g_iWindowThis == WINDOW_CODE) || ((g_iWindowThis == WINDOW_DATA)))) |
| 3052 | return; |
| 3053 | |
| 3054 | int aTarget[3]; |
| 3055 | _6502_GetTargets( regs.pc, &aTarget[0],&aTarget[1],&aTarget[2], NULL ); |
| 3056 | GetTargets_IgnoreDirectJSRJMP(ReadByteFromMemory(regs.pc), aTarget[2]); |
| 3057 | |
| 3058 | aTarget[1] = aTarget[2]; // Move down as we only have 2 lines |
| 3059 | |
| 3060 | RECT rect; |
| 3061 | int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg; |
| 3062 | |
| 3063 | int iAddress = MAX_DISPLAY_TARGET_PTR_LINES; |
| 3064 | while (iAddress--) |
| 3065 | { |
| 3066 | // .6 Bugfix: DrawTargets() should draw target byte for IO address: R PC FB33 |
| 3067 | // if ((aTarget[iAddress] >= APPLE_IO_BEGIN) && (aTarget[iAddress] <= APPLE_IO_END)) |
| 3068 | // aTarget[iAddress] = NO_6502_TARGET; |
| 3069 | |
| 3070 | std::string sAddress = "-none-"; |
| 3071 | std::string sData; |
| 3072 | |
| 3073 | #if DEBUG_FORCE_DISPLAY // Targets |
| 3074 | if (aTarget[iAddress] == NO_6502_TARGET) |
| 3075 | aTarget[iAddress] = 0; |
| 3076 | #endif |
| 3077 | if (aTarget[iAddress] != NO_6502_TARGET) |
| 3078 | { |
| 3079 | sAddress = WordToHexStr(aTarget[iAddress]); |
| 3080 | if (iAddress) |
| 3081 | sData = ByteToHexStr(ReadByteFromMemory(aTarget[iAddress])); |
| 3082 | else |
| 3083 | { |
| 3084 | WORD nAddr = aTarget[iAddress]; |
| 3085 | WORD nData = ReadWordFromMemory(nAddr); |
| 3086 | |
| 3087 | // 2.9.4.3 Handle stack wrap around for edge cases of fetching 16-bit return address when SP == 0x1FF |
| 3088 | // See: |
| 3089 | // DrawStack() |
| 3090 | // DrawTargets() |
| 3091 | if (nAddr == _6502_STACK_END) |
| 3092 | { |
| 3093 | int nRTSLo = ReadByteFromMemory( ((nAddr + 0) & _6502_STACK_END) | _6502_STACK_BEGIN ); |
| 3094 | int nRTSHi = ReadByteFromMemory( ((nAddr + 1) & _6502_STACK_END) | _6502_STACK_BEGIN ); |
| 3095 | int nRTS = (nRTSHi << 8) | nRTSLo; |
| 3096 | nData = ++nRTS & _6502_MEM_END; // /!\ NOTE: 6502 increments return address when popping from stack |
| 3097 | } |
| 3098 | |
| 3099 | sData = WordToHexStr(nData); |
| 3100 | } |
| 3101 | } |
| 3102 | |
| 3103 | rect.left = DISPLAY_TARGETS_COLUMN; |
| 3104 | rect.top = (line+iAddress) * g_nFontHeight; |
| 3105 | int nColumn = rect.left + (7 * nFontWidth); |
| 3106 | rect.right = nColumn; |
no test coverage detected