From 760db6899c82a044a5c9ad4fe64c44e6ab6c3354 Mon Sep 17 00:00:00 2001 From: dwsJason Date: Fri, 7 Sep 2018 20:11:49 -0400 Subject: [PATCH] Dump out load segment addresses to 0x011000 for the profiler, so it can match up the symbols with the trace data --- src/sysvid.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/sysvid.c b/src/sysvid.c index 3398d24..729c5e6 100644 --- a/src/sysvid.c +++ b/src/sysvid.c @@ -34,6 +34,7 @@ segment "system"; #include #include #include +#include #endif #ifdef __MSVC__ @@ -262,6 +263,55 @@ void PrepareSprites() (*handles[2])>>16, (*handles[3])>>16 ); } + +struct LoadSegRec { + Word userID; + Pointer startAddr; + Word LoadFileNo; + Word LoadSegNo; + Word LoadSegKind; + }; +typedef struct LoadSegRec LoadSegRec; + +// +// Summarize the LoadSegments +// +void GetLoadSegments() +{ + long* outData = (long*)0x011000; // hard coded address, so kegs can shit this out + int idx; +static LoadSegRec result; + + outData[0] = 16; // first value, the number of segments + + printf("$%08p GetLoadSegments\n", (Pointer)&GetLoadSegments); + printf("$%04X userid\n", userid()); + + for (idx = 1; idx < 255; ++idx) + { + // userid, loadfilenum, segnum, outptr + memset(&result, 0, sizeof(LoadSegRec)); + GetLoadSegInfo(0,1,idx, (Pointer)&result); + + if (toolerror()) + { + printf("toolerror = $%04X\n", toolerror()); + break; + } + else + { + Pointer pMem = *(Pointer*)result.startAddr; + printf("Seg:%d userid=$%04X ptr=%08p\n", idx, result.userID, pMem); + outData[idx] = (long)pMem; + } + + //printf("Seg:%d $%08p\n", idx, *(Pointer)result.startAddr); + } + + //sys_sleep(30000); // Wait 30 seconds + +} + #endif @@ -303,6 +353,8 @@ sysvid_init(void) } printf("SUCCESS\n"); + GetLoadSegments(); + // Allocate Bank E1 memory - Actual Video memory printf("Allocate Bank $E1 memory\n"); hndl = NewHandle(0x8000, userid(), 0xC003, (pointer) 0xE12000);