mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
dsp: renamed R09 to WR1 in some tests, removed unused code in DSPTables.cpp, added showing of origin file in dspspy (please fix if [runningUcode - 1] is wrong)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3417 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
f8a221dea2
commit
ff7f9020fe
@ -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<u16> &code)
|
||||
}
|
||||
}
|
||||
|
||||
void CodeToHeader(const std::vector<u16> &code, const char *name, std::string &header)
|
||||
void CodeToHeader(const std::vector<u16> &code, std::string _filename,
|
||||
const char *name, std::string &header)
|
||||
{
|
||||
std::vector<u16> code_copy = code;
|
||||
// Add some nops at the end to align the size a bit.
|
||||
@ -121,6 +123,9 @@ void CodeToHeader(const std::vector<u16> &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<u16> &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<u16> &code, const char *name, std::string &h
|
||||
header.append("};\n");
|
||||
}
|
||||
|
||||
void CodesToHeader(const std::vector<u16> *codes, int numCodes,
|
||||
const char *name, std::string &header)
|
||||
void CodesToHeader(const std::vector<u16> *codes, const std::vector<std::string> filenames,
|
||||
int numCodes, const char *name, std::string &header)
|
||||
{
|
||||
char buffer[1024];
|
||||
int reserveSize = 0;
|
||||
@ -155,6 +160,15 @@ void CodesToHeader(const std::vector<u16> *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);
|
||||
|
@ -27,9 +27,10 @@ bool Assemble(const char *text, std::vector<u16> &code);
|
||||
bool Disassemble(const std::vector<u16> &code, bool line_numbers, std::string &text);
|
||||
bool Compare(const std::vector<u16> &code1, const std::vector<u16> &code2);
|
||||
void GenRandomCode(int size, std::vector<u16> &code);
|
||||
void CodeToHeader(const std::vector<u16> &code, const char *name, std::string &header);
|
||||
void CodesToHeader(const std::vector<u16> *codes, int numCodes,
|
||||
const char *name, std::string &header);
|
||||
void CodeToHeader(const std::vector<u16> &code, std::string _filename,
|
||||
const char *name, std::string &header);
|
||||
void CodesToHeader(const std::vector<u16> *codes, const std::vector<std::string> filenames,
|
||||
int numCodes, const char *name, std::string &header);
|
||||
|
||||
// Big-endian, for writing straight to file using File::WriteStringToFile.
|
||||
void CodeToBinaryStringBE(const std::vector<u16> &code, std::string &str);
|
||||
|
@ -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];
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user