--- hatari/src/debug/debugInfo.c 2019/04/09 08:56:47 1.1.1.8 +++ hatari/src/debug/debugInfo.c 2019/04/09 08:59:18 1.1.1.10 @@ -83,14 +83,13 @@ static Uint32 DebugInfo_GetSysbase(Uint3 if (warnings) { fprintf(stderr, "Invalid TOS sysbase ROM address (0x%x)!\n", *rombase); } - return 0; + *rombase = 0; } if (*rombase != TosAddress) { if (warnings) { fprintf(stderr, "os_beg (0x%x) != TOS address (0x%x), header in RAM not set up yet?\n", *rombase, TosAddress); } - return 0; } return sysbase; } @@ -152,6 +151,22 @@ static Uint32 GetBasepageValue(unsigned } /** + * DebugInfo_DTA: if no DTA address given, get one from current + * basepage and ask GEMDOS to show its info. + */ +static void DebugInfo_DTA(FILE *fp, Uint32 dta_addr) +{ + if (!dta_addr) { + dta_addr = GetBasepageValue(0x20); + if (!dta_addr) { + fprintf(fp, "ERROR: no valid basepage!\n"); + return; + } + } + GemDOS_InfoDTA(fp, dta_addr); +} + +/** * DebugInfo_GetTEXT: return current program TEXT segment address * or zero if basepage missing/invalid. For virtual debugger variable. */ @@ -160,14 +175,14 @@ Uint32 DebugInfo_GetTEXT(void) return GetBasepageValue(0x08); } /** - * DebugInfo_GetTEXTEnd: return current program TEXT segment end address + * DebugInfo_GetTEXTEnd: return address following current program TEXT segment * or zero if basepage missing/invalid. For virtual debugger variable. */ Uint32 DebugInfo_GetTEXTEnd(void) { Uint32 addr = GetBasepageValue(0x08); if (addr) { - return addr + GetBasepageValue(0x0C) - 1; + return addr + GetBasepageValue(0x0C); } return 0; } @@ -348,13 +363,13 @@ static void DebugInfo_OSHeader(FILE *fp, { Uint32 sysbase, rombase; - sysbase = DebugInfo_GetSysbase(&rombase, false); + sysbase = DebugInfo_GetSysbase(&rombase, true); if (!sysbase) { return; } fprintf(fp, "OS header information:\n"); DebugInfo_PrintOSHeader(fp, sysbase); - if (sysbase != rombase) { + if (sysbase != rombase && rombase) { fprintf(fp, "\nROM TOS OS header information:\n"); DebugInfo_PrintOSHeader(fp, rombase); return; @@ -652,6 +667,7 @@ static const struct { { true, "dspmemdump",DebugInfo_DspMemDump, DebugInfo_DspMemArgs, "Dump DSP memory from given
" }, { true, "dspregs", DebugInfo_DspRegister,NULL, "Show DSP register contents" }, #endif + { false, "dta", DebugInfo_DTA, NULL, "Show current [or given] DTA information" }, { true, "file", DebugInfo_FileParse, DebugInfo_FileArgs, "Parse commands from given debugger input " }, { false,"gemdos", GemDOS_Info, NULL, "Show GEMDOS HDD emu information (with , show opcodes)" }, { true, "history", History_Show, NULL, "Show history of last instructions" },