diff --git a/Source/Core/DSPCore/Src/DSPCodeUtil.cpp b/Source/Core/DSPCore/Src/DSPCodeUtil.cpp index 3e76694a4a..fda14e29f8 100644 --- a/Source/Core/DSPCore/Src/DSPCodeUtil.cpp +++ b/Source/Core/DSPCore/Src/DSPCodeUtil.cpp @@ -20,6 +20,7 @@ #include "Common.h" #include "FileUtil.h" +#include "StringUtil.h" #include "DSPCodeUtil.h" #include "assemble.h" #include "disassemble.h" @@ -111,7 +112,8 @@ void GenRandomCode(int size, std::vector &code) } } -void CodeToHeader(const std::vector &code, const char *name, std::string &header) +void CodeToHeader(const std::vector &code, std::string _filename, + const char *name, std::string &header) { std::vector code_copy = code; // Add some nops at the end to align the size a bit. @@ -121,6 +123,9 @@ void CodeToHeader(const std::vector &code, const char *name, std::string &h header.clear(); header.reserve(code.size() * 4); header.append("#define NUM_UCODES 1\n\n"); + std::string filename; + SplitPath(_filename, NULL, &filename, NULL); + header.append("const char* UCODE_NAMES[NUM_UCODES] = {\"%s\"};\n\n", filename.c_str()); header.append("#ifndef _MSCVER\n"); sprintf(buffer, "const unsigned short %s[NUM_UCODES][0x1000] = {\n", name); header.append(buffer); @@ -130,7 +135,7 @@ void CodeToHeader(const std::vector &code, const char *name, std::string &h header.append("#endif\n\n"); header.append("\t{\n\t\t"); - for (int j = 0; j < code.size(); j++) + for (int j = 0; j < code.size(); j++) { if (j && ((j & 15) == 0)) header.append("\n\t\t"); @@ -142,8 +147,8 @@ void CodeToHeader(const std::vector &code, const char *name, std::string &h header.append("};\n"); } -void CodesToHeader(const std::vector *codes, int numCodes, - const char *name, std::string &header) +void CodesToHeader(const std::vector *codes, const std::vector filenames, + int numCodes, const char *name, std::string &header) { char buffer[1024]; int reserveSize = 0; @@ -155,6 +160,15 @@ void CodesToHeader(const std::vector *codes, int numCodes, header.reserve(reserveSize * 4); sprintf(buffer, "#define NUM_UCODES %d\n\n", numCodes); header.append(buffer); + sprintf(buffer, "const char* UCODE_NAMES[NUM_UCODES] = {\n"); + for (int i = 0; i < numCodes; i++) + { + std::string filename; + SplitPath(filenames.at(i), NULL, &filename, NULL); + sprintf(buffer, "%s\t\"%s\",\n", buffer, filename.c_str()); + } + sprintf(buffer, "%s};\n\n", buffer); + header.append(buffer); header.append("#ifndef _MSCVER\n"); sprintf(buffer, "const unsigned short %s[NUM_UCODES][0x1000] = {\n", name); header.append(buffer); diff --git a/Source/Core/DSPCore/Src/DSPCodeUtil.h b/Source/Core/DSPCore/Src/DSPCodeUtil.h index 7cd7cf5a2f..9652a93b28 100644 --- a/Source/Core/DSPCore/Src/DSPCodeUtil.h +++ b/Source/Core/DSPCore/Src/DSPCodeUtil.h @@ -27,9 +27,10 @@ bool Assemble(const char *text, std::vector &code); bool Disassemble(const std::vector &code, bool line_numbers, std::string &text); bool Compare(const std::vector &code1, const std::vector &code2); void GenRandomCode(int size, std::vector &code); -void CodeToHeader(const std::vector &code, const char *name, std::string &header); -void CodesToHeader(const std::vector *codes, int numCodes, - const char *name, std::string &header); +void CodeToHeader(const std::vector &code, std::string _filename, + const char *name, std::string &header); +void CodesToHeader(const std::vector *codes, const std::vector filenames, + int numCodes, const char *name, std::string &header); // Big-endian, for writing straight to file using File::WriteStringToFile. void CodeToBinaryStringBE(const std::vector &code, std::string &str); diff --git a/Source/Core/DSPCore/Src/DSPTables.cpp b/Source/Core/DSPCore/Src/DSPTables.cpp index f1afb2074c..8512c83296 100644 --- a/Source/Core/DSPCore/Src/DSPTables.cpp +++ b/Source/Core/DSPCore/Src/DSPTables.cpp @@ -434,12 +434,6 @@ const pdlabel_t regnames[] = {0x21, "ACC1", "Accu Full 1",}, {0x22, "AX0", "Extra Accu 0",}, {0x23, "AX1", "Extra Accu 1",}, - - // Old names for the wrapping registers, for compatibility. - {0x08, "R08", "Wrapping Register 0(08)",}, - {0x09, "R09", "Wrapping Register 1(09)",}, - {0x0a, "R10", "Wrapping Register 2(10)",}, - {0x0b, "R11", "Wrapping Register 3(11)",}, }; u8 opSize[OPTABLE_SIZE]; diff --git a/Source/DSPSpy/main_spy.cpp b/Source/DSPSpy/main_spy.cpp index 653068518d..14773b5c86 100644 --- a/Source/DSPSpy/main_spy.cpp +++ b/Source/DSPSpy/main_spy.cpp @@ -321,7 +321,7 @@ void handle_dsp_mail(void) while (DSP_CheckMailTo()); } - CON_Printf(2, 1, "UCode: %d/%d, Last mail: %08x", runningUcode, NUM_UCODES, mail); + CON_Printf(2, 1, "UCode: %d/%d %s, Last mail: %08x", runningUcode, NUM_UCODES, UCODE_NAMES[runningUcode - 1], mail); } } diff --git a/Source/DSPSpy/tests/dr_test.ds b/Source/DSPSpy/tests/dr_test.ds index 2eb3d31ec0..63dd252eca 100644 --- a/Source/DSPSpy/tests/dr_test.ds +++ b/Source/DSPSpy/tests/dr_test.ds @@ -2,7 +2,7 @@ incdir "tests" include "dsp_base.inc" -; Tests done using AR1 = 0x0010, IX1 = 0. WR1 (wrap 1) means R09. +; Tests done using AR1 = 0x0010, IX1 = 0. WR1 (wrap 1) means WR1. ; WR1 = 0 ; 10, 10, 10, 10, ; WR1 = 1 @@ -29,7 +29,7 @@ include "dsp_base.inc" ; test using indexing register 1 - 0 is used in send_back lri $AR1, #16 lri $IX1, #32 -lri $R09, #0 +lri $WR1, #0 call send_back ; 1 nx'dr : $AR1 @@ -40,7 +40,7 @@ nx'dr : $AR1 call send_back ; 1 lri $AR1, #16 -lri $R09, #1 +lri $WR1, #1 call send_back ; 1 nx'dr : $AR1 call send_back ; 1 @@ -52,7 +52,7 @@ nx'dr : $AR1 call send_back ; 1 lri $AR1, #16 -lri $R09, #2 +lri $WR1, #2 call send_back ; 1 nx'dr : $AR1 call send_back ; 1 @@ -72,7 +72,7 @@ nx'dr : $AR1 call send_back ; 1 lri $AR1, #16 -lri $R09, #3 +lri $WR1, #3 call send_back ; 1 nx'dr : $AR1 @@ -99,7 +99,7 @@ nx'dr : $AR1 call send_back ; 1 lri $AR1, #16 -lri $R09, #4 +lri $WR1, #4 call send_back ; 1 nx'dr : $AR1 @@ -126,7 +126,7 @@ nx'dr : $AR1 call send_back ; 1 lri $AR1, #16 -lri $R09, #5 +lri $WR1, #5 call send_back ; 1 nx'dr : $AR1 @@ -153,7 +153,7 @@ nx'dr : $AR1 call send_back ; 1 lri $AR1, #16 -lri $R09, #6 +lri $WR1, #6 call send_back ; 1 nx'dr : $AR1 @@ -186,7 +186,7 @@ nx'dr : $AR1 call send_back ; 1 lri $AR1, #16 -lri $R09, #7 +lri $WR1, #7 call send_back ; 1 nx'dr : $AR1 @@ -219,7 +219,7 @@ nx'dr : $AR1 call send_back ; 1 lri $AR1, #16 -lri $R09, #8 +lri $WR1, #8 call send_back ; 1 nx'dr : $AR1 @@ -308,7 +308,7 @@ nx'dr : $AR1 call send_back ; 1 -lri $R09, #0xFFFF +lri $WR1, #0xFFFF ; We're done, DO NOT DELETE THIS LINE jmp end_of_test diff --git a/Source/DSPSpy/tests/ir_test.ds b/Source/DSPSpy/tests/ir_test.ds index e7ee5e332a..422de885a7 100644 --- a/Source/DSPSpy/tests/ir_test.ds +++ b/Source/DSPSpy/tests/ir_test.ds @@ -34,7 +34,7 @@ include "dsp_base.inc" ; test using indexing register 1 - 0 is used in send_back lri $AR1, #16 lri $IX1, #32 -lri $R09, #0 +lri $WR1, #0 call send_back ; 1 nx'ir : $AR1 @@ -45,7 +45,7 @@ nx'ir : $AR1 call send_back ; 1 lri $AR1, #16 -lri $R09, #1 +lri $WR1, #1 call send_back ; 1 nx'ir : $AR1 call send_back ; 1 @@ -57,7 +57,7 @@ nx'ir : $AR1 call send_back ; 1 lri $AR1, #16 -lri $R09, #2 +lri $WR1, #2 call send_back ; 1 nx'ir : $AR1 call send_back ; 1 @@ -77,7 +77,7 @@ nx'ir : $AR1 call send_back ; 1 lri $AR1, #16 -lri $R09, #3 +lri $WR1, #3 call send_back ; 1 nx'ir : $AR1 @@ -104,7 +104,7 @@ nx'ir : $AR1 call send_back ; 1 lri $AR1, #16 -lri $R09, #4 +lri $WR1, #4 call send_back ; 1 nx'ir : $AR1 @@ -131,7 +131,7 @@ nx'ir : $AR1 call send_back ; 1 lri $AR1, #16 -lri $R09, #5 +lri $WR1, #5 call send_back ; 1 nx'ir : $AR1 @@ -158,7 +158,7 @@ nx'ir : $AR1 call send_back ; 1 lri $AR1, #16 -lri $R09, #6 +lri $WR1, #6 call send_back ; 1 nx'ir : $AR1 @@ -191,7 +191,7 @@ nx'ir : $AR1 call send_back ; 1 lri $AR1, #16 -lri $R09, #7 +lri $WR1, #7 call send_back ; 1 nx'ir : $AR1 @@ -224,7 +224,7 @@ nx'ir : $AR1 call send_back ; 1 lri $AR1, #16 -lri $R09, #8 +lri $WR1, #8 call send_back ; 1 nx'ir : $AR1 @@ -313,7 +313,7 @@ nx'ir : $AR1 call send_back ; 1 -lri $R09, #0xFFFF +lri $WR1, #0xFFFF ; We're done, DO NOT DELETE THIS LINE jmp end_of_test diff --git a/Source/DSPTool/Src/main.cpp b/Source/DSPTool/Src/main.cpp index 7bc9943b00..c928d5f097 100644 --- a/Source/DSPTool/Src/main.cpp +++ b/Source/DSPTool/Src/main.cpp @@ -356,7 +356,7 @@ int main(int argc, const char *argv[]) } - CodesToHeader(codes, lines, output_header_name.c_str(), header); + CodesToHeader(codes, files, lines, output_header_name.c_str(), header); File::WriteStringToFile(true, header, (output_header_name + ".h").c_str()); delete[] codes; @@ -379,7 +379,7 @@ int main(int argc, const char *argv[]) if (!output_header_name.empty()) { std::string header; - CodeToHeader(code, output_header_name.c_str(), header); + CodeToHeader(code, input_name, output_header_name.c_str(), header); File::WriteStringToFile(true, header, (output_header_name + ".h").c_str()); } }