Debugger: compile Debug.cpp, Debugger_Help.cpp, Commands, and MemoryTextFile.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2021-05-06 15:22:14 +01:00
parent 22a9c64010
commit 50599e9535
11 changed files with 162 additions and 197 deletions

View file

@ -5,6 +5,8 @@ set(SOURCE_FILES
Tfe/tfearch.cpp
Tfe/tfesupp.cpp
Debugger/Debug.cpp
Debugger/Debugger_Help.cpp
Debugger/Debugger_Color.cpp
Debugger/Debugger_Disassembler.cpp
Debugger/Debugger_Symbols.cpp
@ -13,6 +15,8 @@ set(SOURCE_FILES
Debugger/Debugger_Assembler.cpp
Debugger/Debugger_Parser.cpp
Debugger/Debugger_Range.cpp
Debugger/Debugger_Commands.cpp
Debugger/Util_MemoryTextFile.cpp
SSI263.cpp
Speaker.cpp
@ -77,8 +81,9 @@ set(SOURCE_FILES
linux/network/tfe2.cpp
linux/network/slirp2.cpp
linux/duplicates/Debug.cpp
linux/duplicates/Debug_Display.cpp
linux/duplicates/AppleWin.cpp
linux/duplicates/Debugger_Display.cpp
linux/duplicates/Debugger_Win32.cpp
linux/duplicates/Joystick.cpp
linux/duplicates/SerialComms.cpp
linux/duplicates/PropertySheet.cpp
@ -134,6 +139,20 @@ set(HEADER_FILES
SaveState_Structs_v1.h
Debugger/Debug.h
Debugger/DebugDefs.h
Debugger/Debugger_Color.h
Debugger/Debugger_Console.h
Debugger/Debugger_Disassembler.h
Debugger/Debugger_DisassemblerData.h
Debugger/Debugger_Display.h
Debugger/Debugger_Help.h
Debugger/Debugger_Parser.h
Debugger/Debugger_Range.h
Debugger/Debugger_Symbols.h
Debugger/Debugger_Types.h
Debugger/Debugger_Win32.h
Debugger/Util_MemoryTextFile.h
Debugger/Util_Text.h
Configuration/PropertySheetHelper.h

View file

@ -0,0 +1,3 @@
void SingleStep(bool /* bReinit */)
{
}

View file

@ -1,176 +0,0 @@
#include "StdAfx.h"
#include "Common.h"
#include "Debug.h"
#include "DebugDefs.h"
#include "CPU.h"
#include "Core.h"
#include "Interface.h"
const int MIN_DISPLAY_CONSOLE_LINES = 5; // doesn't include ConsoleInput
int g_iWindowThis = WINDOW_CODE; // TODO: FIXME! should be offset into WindowConfig!!!
void WindowUpdateDisasmSize()
{
g_nDisasmWinHeight = (MAX_DISPLAY_LINES - g_nConsoleDisplayLines) / 2;
g_nDisasmCurLine = MAX(0, (g_nDisasmWinHeight - 1) / 2);
}
void WindowUpdateConsoleDisplayedSize()
{
g_nConsoleDisplayLines = MIN_DISPLAY_CONSOLE_LINES;
#if USE_APPLE_FONT
g_bConsoleFullWidth = true;
g_nConsoleDisplayWidth = CONSOLE_WIDTH - 1;
if (g_iWindowThis == WINDOW_CONSOLE)
{
g_nConsoleDisplayLines = MAX_DISPLAY_LINES;
g_nConsoleDisplayWidth = CONSOLE_WIDTH - 1;
g_bConsoleFullWidth = true;
}
#else
g_nConsoleDisplayWidth = (CONSOLE_WIDTH / 2) + 10;
g_bConsoleFullWidth = false;
// g_bConsoleFullWidth = false;
// g_nConsoleDisplayWidth = CONSOLE_WIDTH - 10;
if (g_iWindowThis == WINDOW_CONSOLE)
{
g_nConsoleDisplayLines = MAX_DISPLAY_LINES;
g_nConsoleDisplayWidth = CONSOLE_WIDTH - 1;
g_bConsoleFullWidth = true;
}
#endif
}
void InitDisasm()
{
g_nDisasmCurAddress = regs.pc;
DisasmCalcTopBotAddress();
}
void DebugInitialize()
{
WindowUpdateDisasmSize();
ConfigColorsReset();
WindowUpdateConsoleDisplayedSize();
extern bool g_bSymbolsDisplayMissingFile;
g_bSymbolsDisplayMissingFile = false;
g_iCommand = CMD_SYMBOLS_ROM;
CmdSymbolsLoad(0);
g_iCommand = CMD_SYMBOLS_APPLESOFT;
CmdSymbolsLoad(0);
g_iCommand = CMD_SYMBOLS_USER_1;
CmdSymbolsLoad(0);
g_bSymbolsDisplayMissingFile = true;
g_iConfigDisasmBranchType = DISASM_BRANCH_PLAIN;
}
void DebugReset(void)
{
}
void DebugBegin()
{
// This is called every time the debugger is entered.
g_nAppMode = MODE_DEBUG;
GetFrame().FrameRefreshStatus(DRAW_TITLE | DRAW_DISK_STATUS);
if (GetMainCpu() == CPU_6502)
{
g_aOpcodes = & g_aOpcodes6502[ 0 ]; // Apple ][, ][+, //e
g_aOpmodes[ AM_2 ].m_nBytes = 1;
g_aOpmodes[ AM_3 ].m_nBytes = 1;
}
else
{
g_aOpcodes = & g_aOpcodes65C02[ 0 ]; // Enhanced Apple //e
g_aOpmodes[ AM_2 ].m_nBytes = 2;
g_aOpmodes[ AM_3 ].m_nBytes = 3;
}
InitDisasm();
}
DWORD extbench = 0;
// NOTE: BreakpointSource_t and g_aBreakpointSource must match!
const char *g_aBreakpointSource[ NUM_BREAKPOINT_SOURCES ] =
{ // Used to be one char, since ArgsCook also uses // TODO/FIXME: Parser use Param[] ?
// Used for both Input & Output!
// Regs
"A", // Reg A
"X", // Reg X
"Y", // Reg Y
// Special
"PC", // Program Counter -- could use "$"
"S" , // Stack Pointer
// Flags -- .8 Moved: Flag names from g_aFlagNames[] to "inlined" g_aBreakpointSource[]
"P", // Processor Status
"C", // ---- ---1 Carry
"Z", // ---- --1- Zero
"I", // ---- -1-- Interrupt
"D", // ---- 1--- Decimal
"B", // ---1 ---- Break
"R", // --1- ---- Reserved
"V", // -1-- ---- Overflow
"N", // 1--- ---- Sign
// Misc
"OP", // Opcode/Instruction/Mnemonic
"M", // Mem RW
"M", // Mem READ_ONLY
"M", // Mem WRITE_ONLY
// TODO: M0 ram bank 0, M1 aux ram ?
};
WORD g_nDisasmTopAddress = 0;
WORD g_nDisasmBotAddress = 0;
WORD g_nDisasmCurAddress = 0;
bool g_bDisasmCurBad = false;
int g_nDisasmCurLine = 0; // Aligned to Top or Center
int g_iDisasmCurState = CURSOR_NORMAL;
int g_nDisasmWinHeight = 0;
MemorySearchResults_t g_vMemorySearchResults;
int g_iCommand; // last command (enum) // used for consecutive commands
bool g_bConfigDisasmAddressView = true;
int g_bConfigDisasmClick = 4; // GH#462 alt=1, ctrl=2, shift=4 bitmask (default to Shift-Click)
bool g_bConfigDisasmAddressColon = true;
bool g_bConfigDisasmOpcodesView = true;
bool g_bConfigDisasmOpcodeSpaces = true;
int g_iConfigDisasmTargets = DISASM_TARGET_BOTH;
int g_iConfigDisasmBranchType = DISASM_BRANCH_FANCY;
int g_bConfigDisasmImmediateChar = DISASM_IMMED_BOTH;
int g_iConfigDisasmScroll = 3; // favor 3 byte opcodes
// Config - Info
bool g_bConfigInfoTargetPointer = false;
MemoryTextFile_t g_ConfigState;
int FindParam(LPCTSTR pLookupName, Match_e eMatch, int & iParam_, int iParamBegin, int iParamEnd )
{
throw std::runtime_error("FindParam: not implemented");
}
void DebugDisplay ( BOOL bInitDisasm )
{
throw std::runtime_error("DebugDisplay: not implemented");
}
Update_t Help_Arg_1( int iCommandHelp )
{
throw std::runtime_error("Help_Arg_1: not implemented");
}

View file

@ -1,19 +0,0 @@
#include "StdAfx.h"
#include "Debug.h"
// NOTE: Keep in sync ConsoleColors_e g_anConsoleColor !
COLORREF g_anConsoleColor[ NUM_CONSOLE_COLORS ] =
{ // # <Bright Blue Green Red>
RGB( 0, 0, 0 ), // 0 0000 K
RGB( 255, 32, 32 ), // 1 1001 R
RGB( 0, 255, 0 ), // 2 1010 G
RGB( 255, 255, 0 ), // 3 1011 Y
RGB( 64, 64, 255 ), // 4 1100 B
RGB( 255, 0, 255 ), // 5 1101 M Purple/Magenta now used for warnings.
RGB( 0, 255, 255 ), // 6 1110 C
RGB( 255, 255, 255 ), // 7 1111 W
RGB( 255, 128, 0 ), // 8 0011 Orange
RGB( 128, 128, 128 ), // 9 0111 Grey
RGB( 80, 192, 255 ) // Lite Blue
};

View file

@ -0,0 +1,62 @@
#include "StdAfx.h"
#include "Debug.h"
#include "Keyboard.h"
// NOTE: Keep in sync ConsoleColors_e g_anConsoleColor !
COLORREF g_anConsoleColor[ NUM_CONSOLE_COLORS ] =
{ // # <Bright Blue Green Red>
RGB( 0, 0, 0 ), // 0 0000 K
RGB( 255, 32, 32 ), // 1 1001 R
RGB( 0, 255, 0 ), // 2 1010 G
RGB( 255, 255, 0 ), // 3 1011 Y
RGB( 64, 64, 255 ), // 4 1100 B
RGB( 255, 0, 255 ), // 5 1101 M Purple/Magenta now used for warnings.
RGB( 0, 255, 255 ), // 6 1110 C
RGB( 255, 255, 255 ), // 7 1111 W
RGB( 255, 128, 0 ), // 8 0011 Orange
RGB( 128, 128, 128 ), // 9 0111 Grey
RGB( 80, 192, 255 ) // Lite Blue
};
VideoScannerDisplayInfo g_videoScannerDisplayInfo;
char g_aDebuggerVirtualTextScreen[ DEBUG_VIRTUAL_TEXT_HEIGHT ][ DEBUG_VIRTUAL_TEXT_WIDTH ];
void DrawConsoleCursor()
{
}
HDC GetDebuggerMemDC(void)
{
return nullptr;
}
void KeybQueueKeypress(WPARAM /* key */, Keystroke_e /* bASCII */)
{
}
void UpdateDisplay(Update_t /* bUpdate */)
{
}
void StretchBltMemToFrameDC(void)
{
}
void ReleaseDebuggerMemDC(void)
{
}
void ReleaseConsoleFontDC(void)
{
}
HDC GetConsoleFontDC(void)
{
return nullptr;
}
void DrawConsoleInput()
{
}

View file

@ -0,0 +1,24 @@
#include "StdAfx.h"
#include "Debug.h"
Update_t CmdConfigFont(int /* nArgs */)
{
return UPDATE_NOTHING;
}
Update_t CmdConfigGetFont(int /* nArgs */)
{
return UPDATE_NOTHING;
}
void ProcessClipboardCommands()
{
}
void FontsDestroy()
{
}
void FontsInitialize()
{
}

View file

@ -90,3 +90,18 @@ void KeybLoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
void KeybReset()
{
}
bool KeybGetShiftStatus()
{
return false;
}
bool KeybGetAltStatus()
{
return false;
}
bool KeybGetCtrlStatus()
{
return false;
}

View file

@ -25,3 +25,11 @@ int vsnprintf_s(char *buffer, size_t sizeOfBuffer, size_t count, const char *for
buffer[sizeOfBuffer - 1] = 0;
return res;
}
LPSTR _strupr( LPSTR str )
{
LPSTR ret = str;
for ( ; *str; str++)
*str = toupper(*str);
return ret;
}

View file

@ -37,6 +37,8 @@ int vsnprintf_s(
#define _snprintf snprintf
#define wsprintf sprintf
#define sscanf_s sscanf
#define _tcsncmp strncmp
#define _tcsncat strncat
inline bool IsCharLower(char ch) {
return isascii(ch) && islower(ch);
@ -47,3 +49,5 @@ inline bool IsCharUpper(char ch) {
}
DWORD CharLowerBuff(LPTSTR lpsz, DWORD cchLength);
LPSTR _strupr( LPSTR str );

View file

@ -29,3 +29,8 @@ LRESULT WINAPI SendMessage(HWND,UINT,WPARAM,LPARAM)
{
return 0;
}
void WINAPI PostQuitMessage(INT status)
{
throw status;
}

View file

@ -19,3 +19,23 @@ UINT_PTR SetTimer(HWND,UINT_PTR,UINT,TIMERPROC);
BOOL KillTimer(HWND hWnd, UINT uIDEvent);
HWND WINAPI GetDlgItem(HWND,INT);
LRESULT WINAPI SendMessage(HWND,UINT,WPARAM,LPARAM);
void WINAPI PostQuitMessage(INT);
#define VK_BACK 0x08
#define VK_TAB 0x09
#define VK_RETURN 0x0D
#define VK_SHIFT 0x10
#define VK_CONTROL 0x11
#define VK_MENU 0x12
#define VK_ESCAPE 0x1B
#define VK_SPACE 0x20
#define VK_PRIOR 0x21
#define VK_NEXT 0x22
#define VK_END 0x23
#define VK_HOME 0x24
#define VK_LEFT 0x25
#define VK_UP 0x26
#define VK_RIGHT 0x27
#define VK_DOWN 0x28
#define VK_OEM_3 0xC0 // '`~' for US
#define VK_OEM_8 0xDF