diff --git a/oscar64/Compiler.cpp b/oscar64/Compiler.cpp index 5bd9547..5778a78 100644 --- a/oscar64/Compiler.cpp +++ b/oscar64/Compiler.cpp @@ -298,7 +298,7 @@ bool Compiler::GenerateCode(void) bool Compiler::WriteOutputFile(const char* targetPath) { - char prgPath[200], mapPath[200], asmPath[200]; + char prgPath[200], mapPath[200], asmPath[200], lblPath[200]; strcpy_s(prgPath, targetPath); int i = strlen(prgPath); @@ -308,10 +308,12 @@ bool Compiler::WriteOutputFile(const char* targetPath) strcpy_s(mapPath, prgPath); strcpy_s(asmPath, prgPath); + strcpy_s(lblPath, prgPath); strcat_s(prgPath, "prg"); strcat_s(mapPath, "map"); strcat_s(asmPath, "asm"); + strcat_s(lblPath, "lbl"); printf("Writing <%s>\n", prgPath); mLinker->WritePrgFile(prgPath); @@ -322,6 +324,9 @@ bool Compiler::WriteOutputFile(const char* targetPath) printf("Writing <%s>\n", asmPath); mLinker->WriteAsmFile(asmPath); + printf("Writing <%s>\n", lblPath); + mLinker->WriteLblFile(lblPath); + return true; } diff --git a/oscar64/Linker.cpp b/oscar64/Linker.cpp index cc46ed4..1add59d 100644 --- a/oscar64/Linker.cpp +++ b/oscar64/Linker.cpp @@ -379,6 +379,31 @@ bool Linker::WriteMapFile(const char* filename) return false; } +bool Linker::WriteLblFile(const char* filename) +{ + FILE* file; + fopen_s(&file, filename, "wb"); + if (file) + { + for (int i = 0; i < mObjects.Size(); i++) + { + LinkerObject* obj = mObjects[i]; + + if (obj->mFlags & LOBJF_REFERENCED) + { + if (obj->mIdent) + fprintf(file, "al %04x .%s\n", obj->mAddress, obj->mIdent->mString); + } + } + + fclose(file); + + return true; + } + else + return false; +} + bool Linker::WriteAsmFile(const char* filename) { FILE* file; diff --git a/oscar64/Linker.h b/oscar64/Linker.h index feadad9..38805dd 100644 --- a/oscar64/Linker.h +++ b/oscar64/Linker.h @@ -129,6 +129,7 @@ public: bool WritePrgFile(const char* filename); bool WriteMapFile(const char* filename); bool WriteAsmFile(const char* filename); + bool WriteLblFile(const char* filename); GrowingArray mReferences; GrowingArray mRegions;