Merge pull request #5449 from ligfx/dsptoolcleanup1

DSPTool cleanups + extract tests to DSPAssemblyTest
This commit is contained in:
shuffle2 2017-06-05 19:40:21 -07:00 committed by GitHub
commit 96d868f961
15 changed files with 577 additions and 444 deletions

View File

@ -100,88 +100,6 @@ bool Compare(const std::vector<u16>& code1, const std::vector<u16>& code2)
return code1.size() == code2.size() && code1.size() == count_equal; return code1.size() == code2.size() && code1.size() == count_equal;
} }
void GenRandomCode(u32 size, std::vector<u16>& code)
{
code.resize(size);
for (u32 i = 0; i < size; i++)
{
code[i] = rand() ^ (rand() << 8);
}
}
void CodeToHeader(const std::vector<u16>& code, std::string _filename, const char* name,
std::string& header)
{
std::vector<u16> code_padded = code;
// Pad with nops to 32byte boundary
while (code_padded.size() & 0x7f)
code_padded.push_back(0);
header.clear();
header.reserve(code_padded.size() * 4);
header.append("#define NUM_UCODES 1\n\n");
std::string filename;
SplitPath(_filename, nullptr, &filename, nullptr);
header.append(
StringFromFormat("const char* UCODE_NAMES[NUM_UCODES] = {\"%s\"};\n\n", filename.c_str()));
header.append("const unsigned short dsp_code[NUM_UCODES][0x1000] = {\n");
header.append("\t{\n\t\t");
for (u32 j = 0; j < code_padded.size(); j++)
{
if (j && ((j & 15) == 0))
header.append("\n\t\t");
header.append(StringFromFormat("0x%04x, ", code_padded[j]));
}
header.append("\n\t},\n");
header.append("};\n");
}
void CodesToHeader(const std::vector<u16>* codes, const std::vector<std::string>* filenames,
u32 numCodes, const char* name, std::string& header)
{
std::vector<std::vector<u16>> codes_padded;
u32 reserveSize = 0;
for (u32 i = 0; i < numCodes; i++)
{
codes_padded.push_back(codes[i]);
// Pad with nops to 32byte boundary
while (codes_padded.at(i).size() & 0x7f)
codes_padded.at(i).push_back(0);
reserveSize += (u32)codes_padded.at(i).size();
}
header.clear();
header.reserve(reserveSize * 4);
header.append(StringFromFormat("#define NUM_UCODES %u\n\n", numCodes));
header.append("const char* UCODE_NAMES[NUM_UCODES] = {\n");
for (u32 i = 0; i < numCodes; i++)
{
std::string filename;
if (!SplitPath(filenames->at(i), nullptr, &filename, nullptr))
filename = filenames->at(i);
header.append(StringFromFormat("\t\"%s\",\n", filename.c_str()));
}
header.append("};\n\n");
header.append("const unsigned short dsp_code[NUM_UCODES][0x1000] = {\n");
for (u32 i = 0; i < numCodes; i++)
{
if (codes[i].size() == 0)
continue;
header.append("\t{\n\t\t");
for (u32 j = 0; j < codes_padded.at(i).size(); j++)
{
if (j && ((j & 15) == 0))
header.append("\n\t\t");
header.append(StringFromFormat("0x%04x, ", codes_padded.at(i).at(j)));
}
header.append("\n\t},\n");
}
header.append("};\n");
}
void CodeToBinaryStringBE(const std::vector<u16>& code, std::string& str) void CodeToBinaryStringBE(const std::vector<u16>& code, std::string& str)
{ {
str.resize(code.size() * 2); str.resize(code.size() * 2);

View File

@ -14,11 +14,6 @@ namespace DSP
bool Assemble(const std::string& text, std::vector<u16>& code, bool force = false); bool Assemble(const std::string& text, std::vector<u16>& code, bool force = false);
bool Disassemble(const std::vector<u16>& code, bool line_numbers, std::string& text); 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); bool Compare(const std::vector<u16>& code1, const std::vector<u16>& code2);
void GenRandomCode(u32 size, std::vector<u16>& code);
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,
u32 numCodes, const char* name, std::string& header);
// Big-endian, for writing straight to file using File::WriteStringToFile. // Big-endian, for writing straight to file using File::WriteStringToFile.
void CodeToBinaryStringBE(const std::vector<u16>& code, std::string& str); void CodeToBinaryStringBE(const std::vector<u16>& code, std::string& str);

View File

@ -6,6 +6,7 @@
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/DSP/DSPCodeUtil.h" #include "Core/DSP/DSPCodeUtil.h"
#include "Core/DSP/DSPDisassembler.h"
#include "Core/DSP/DSPHost.h" #include "Core/DSP/DSPHost.h"
#include "Core/DSP/DSPTables.h" #include "Core/DSP/DSPTables.h"
@ -38,176 +39,80 @@ void DSP::Host::UpdateDebugger()
{ {
} }
// This test goes from text ASM to binary to text ASM and once again back to binary. static void CodeToHeader(const std::vector<u16>& code, std::string filename, const char* name,
// Then the two binaries are compared. std::string& header)
static bool RoundTrip(const std::vector<u16>& code1)
{ {
std::vector<u16> code2; std::vector<u16> code_padded = code;
std::string text; // Pad with nops to 32byte boundary
if (!DSP::Disassemble(code1, false, text)) while (code_padded.size() & 0x7f)
code_padded.push_back(0);
header.clear();
header.reserve(code_padded.size() * 4);
header.append("#define NUM_UCODES 1\n\n");
std::string filename_without_extension;
SplitPath(filename, nullptr, &filename_without_extension, nullptr);
header.append(StringFromFormat("const char* UCODE_NAMES[NUM_UCODES] = {\"%s\"};\n\n",
filename_without_extension.c_str()));
header.append("const unsigned short dsp_code[NUM_UCODES][0x1000] = {\n");
header.append("\t{\n\t\t");
for (u32 j = 0; j < code_padded.size(); j++)
{ {
printf("RoundTrip: Disassembly failed.\n"); if (j && ((j & 15) == 0))
return false; header.append("\n\t\t");
header.append(StringFromFormat("0x%04x, ", code_padded[j]));
} }
if (!DSP::Assemble(text, code2)) header.append("\n\t},\n");
{
printf("RoundTrip: Assembly failed.\n"); header.append("};\n");
return false;
}
if (!DSP::Compare(code1, code2))
{
DSP::Disassemble(code1, true, text);
printf("%s", text.c_str());
}
return true;
} }
// This test goes from text ASM to binary to text ASM and once again back to binary. static void CodesToHeader(const std::vector<u16>* codes, const std::vector<std::string>* filenames,
// Very convenient for testing. Then the two binaries are compared. u32 num_codes, const char* name, std::string& header)
static bool SuperTrip(const char* asm_code)
{ {
std::vector<u16> code1, code2; std::vector<std::vector<u16>> codes_padded;
std::string text; u32 reserveSize = 0;
if (!DSP::Assemble(asm_code, code1)) for (u32 i = 0; i < num_codes; i++)
{ {
printf("SuperTrip: First assembly failed\n"); codes_padded.push_back(codes[i]);
return false; // Pad with nops to 32byte boundary
while (codes_padded.at(i).size() & 0x7f)
codes_padded.at(i).push_back(0);
reserveSize += (u32)codes_padded.at(i).size();
} }
printf("First assembly: %i words\n", (int)code1.size()); header.clear();
if (!DSP::Disassemble(code1, false, text)) header.reserve(reserveSize * 4);
header.append(StringFromFormat("#define NUM_UCODES %u\n\n", num_codes));
header.append("const char* UCODE_NAMES[NUM_UCODES] = {\n");
for (u32 i = 0; i < num_codes; i++)
{ {
printf("SuperTrip: Disassembly failed\n"); std::string filename;
return false; if (!SplitPath(filenames->at(i), nullptr, &filename, nullptr))
filename = filenames->at(i);
header.append(StringFromFormat("\t\"%s\",\n", filename.c_str()));
} }
else header.append("};\n\n");
header.append("const unsigned short dsp_code[NUM_UCODES][0x1000] = {\n");
for (u32 i = 0; i < num_codes; i++)
{ {
printf("Disass:\n"); if (codes[i].size() == 0)
printf("%s", text.c_str()); continue;
}
if (!DSP::Assemble(text, code2))
{
printf("SuperTrip: Second assembly failed\n");
return false;
}
/*
std::string text2;
Disassemble(code1, true, &text1);
Disassemble(code2, true, &text2);
File::WriteStringToFile(text1, "code1.txt");
File::WriteStringToFile(text2, "code2.txt");
*/
return true;
}
static void RunAsmTests() header.append("\t{\n\t\t");
{ for (u32 j = 0; j < codes_padded.at(i).size(); j++)
bool fail = false;
#define CHK(a) \
if (!SuperTrip(a)) \
printf("FAIL\n%s\n", a), fail = true;
// Let's start out easy - a trivial instruction..
CHK(" NOP\n");
// Now let's do several.
CHK(" NOP\n"
" NOP\n"
" NOP\n");
// Turning it up a notch.
CHK(" SET16\n"
" SET40\n"
" CLR15\n"
" M0\n"
" M2\n");
// Time to try labels and parameters, and comments.
CHK("DIRQ_TEST: equ 0xfffb ; DSP Irq Request\n"
" si @0xfffc, #0x8888\n"
" si @0xfffd, #0xbeef\n"
" si @DIRQ_TEST, #0x0001\n");
// Let's see if registers roundtrip. Also try predefined labels.
CHK(" si @0xfffc, #0x8888\n"
" si @0xfffd, #0xbeef\n"
" si @DIRQ, #0x0001\n");
// Let's try some messy extended instructions.
// CHK(" MULMV'SN $AX0.L, $AX0.H, $ACC0 : @$AR2, $AC1.M\n");
//" ADDAXL'MV $ACC1, $AX1.L : $AX1.H, $AC1.M\n");
// Let's get brutal. We generate random code bytes and make sure that they can
// be roundtripped. We don't expect it to always succeed but it'll be sure to generate
// interesting test cases.
/*
std::vector<u16> hermes;
if (!LoadBinary("testdata/hermes.bin", &hermes))
PanicAlert("Failed to load hermes rom");
RoundTrip(hermes);
*/
/*
std::vector<u16> code;
std::string text_orig;
File::ReadFileToString("testdata/dsp_test.S", &text_orig);
if (!Assemble(text_orig.c_str(), &code))
{
printf("SuperTrip: First assembly failed\n");
return;
}*/
/*
{
std::vector<u16> code;
code.clear();
for (int i = 0; i < sizeof(dsp_test)/4; i++)
{ {
code.push_back(dsp_test[i] >> 16); if (j && ((j & 15) == 0))
code.push_back(dsp_test[i] & 0xFFFF); header.append("\n\t\t");
header.append(StringFromFormat("0x%04x, ", codes_padded.at(i).at(j)));
} }
header.append("\n\t},\n");
SaveBinary(code, "dsp_test2.bin"); }
RoundTrip(code); header.append("};\n");
}*/
// if (Compare(code, hermes))
// printf("Successs\n");
/*
{
std::vector<u16> code;
std::string text;
LoadBinary("testdata/dsp_test.bin", &code);
Disassemble(code, true, &text);
Assemble(text.c_str(), &code);
Disassemble(code, true, &text);
printf("%s", text.c_str());
}*/
/*
puts("Insane Random Code Test\n");
std::vector<u16> rand_code;
GenRandomCode(30, &rand_code);
std::string rand_code_text;
Disassemble(rand_code, true, &rand_code_text);
printf("%s", rand_code_text.c_str());
RoundTrip(rand_code);
if (File::ReadFileToString("C:/devkitPro/examples/wii/asndlib/dsptest/dsp_test.ds", &dsp_test))
SuperTrip(dsp_test.c_str());
//.File::ReadFileToString("C:/devkitPro/trunk/libogc/libasnd/dsp_mixer/dsp_mixer.s", &dsp_test);
// This is CLOSE to working. Sorry about the local path btw. This is preliminary code.
*/
std::string dsp_test;
if (File::ReadFileToString("Testdata/dsp_test.s", dsp_test))
fail = fail || !SuperTrip(dsp_test.c_str());
if (!fail)
printf("All passed!\n");
} }
// Usage: // Usage:
// Run internal tests:
// dsptool test
// Disassemble a file: // Disassemble a file:
// dsptool -d -o asdf.txt asdf.bin // dsptool -d -o asdf.txt asdf.bin
// Disassemble a file, output to standard output: // Disassemble a file, output to standard output:
@ -218,7 +123,6 @@ static void RunAsmTests()
// dsptool [-f] -h asdf.h asdf.txt // dsptool [-f] -h asdf.h asdf.txt
// Print results from DSPSpy register dump // Print results from DSPSpy register dump
// dsptool -p dsp_dump0.bin // dsptool -p dsp_dump0.bin
// So far, all this binary can do is test partially that itself works correctly.
int main(int argc, const char* argv[]) int main(int argc, const char* argv[])
{ {
if (argc == 1 || (argc == 2 && (!strcmp(argv[1], "--help") || (!strcmp(argv[1], "-?"))))) if (argc == 1 || (argc == 2 && (!strcmp(argv[1], "--help") || (!strcmp(argv[1], "-?")))))
@ -241,12 +145,6 @@ int main(int argc, const char* argv[])
return 0; return 0;
} }
if (argc == 2 && !strcmp(argv[1], "test"))
{
RunAsmTests();
return 0;
}
std::string input_name; std::string input_name;
std::string output_header_name; std::string output_header_name;
std::string output_name; std::string output_name;
@ -488,7 +386,7 @@ int main(int argc, const char* argv[])
} }
} }
DSP::CodesToHeader(codes, &files, lines, output_header_name.c_str(), header); CodesToHeader(codes, &files, lines, output_header_name.c_str(), header);
File::WriteStringToFile(header, output_header_name + ".h"); File::WriteStringToFile(header, output_header_name + ".h");
delete[] codes; delete[] codes;
@ -517,7 +415,7 @@ int main(int argc, const char* argv[])
if (!output_header_name.empty()) if (!output_header_name.empty())
{ {
std::string header; std::string header;
DSP::CodeToHeader(code, input_name, output_header_name.c_str(), header); CodeToHeader(code, input_name, output_header_name.c_str(), header);
File::WriteStringToFile(header, output_header_name + ".h"); File::WriteStringToFile(header, output_header_name + ".h");
} }
} }

Binary file not shown.

Binary file not shown.

View File

@ -2,4 +2,11 @@ add_dolphin_test(MMIOTest MMIOTest.cpp)
add_dolphin_test(PageFaultTest PageFaultTest.cpp) add_dolphin_test(PageFaultTest PageFaultTest.cpp)
add_dolphin_test(CoreTimingTest CoreTimingTest.cpp) add_dolphin_test(CoreTimingTest CoreTimingTest.cpp)
add_dolphin_test(DSPAssemblyTest
DSP/DSPAssemblyTest.cpp
DSP/DSPTestBinary.cpp
DSP/DSPTestText.cpp
DSP/HermesBinary.cpp
)
add_dolphin_test(ESFormatsTest IOS/ES/FormatsTest.cpp IOS/ES/TestBinaryData.cpp) add_dolphin_test(ESFormatsTest IOS/ES/FormatsTest.cpp IOS/ES/TestBinaryData.cpp)

View File

@ -0,0 +1,155 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Common/FileUtil.h"
#include "Core/DSP/DSPCodeUtil.h"
#include "Core/DSP/DSPDisassembler.h"
#include "DSPTestBinary.h"
#include "DSPTestText.h"
#include "HermesBinary.h"
#include <gtest/gtest.h>
static bool RoundTrippableDissassemble(const std::vector<u16>& code, std::string& text)
{
DSP::AssemblerSettings settings;
settings.ext_separator = '\'';
settings.decode_names = true;
settings.decode_registers = true;
// These two prevent roundtripping.
settings.show_hex = false;
settings.show_pc = false;
DSP::DSPDisassembler disasm(settings);
return disasm.Disassemble(0x0000, code, 0x0000, text);
}
// This test goes from text ASM to binary to text ASM and once again back to binary.
// Then the two binaries are compared.
static bool RoundTrip(const std::vector<u16>& code1)
{
std::vector<u16> code2;
std::string text;
if (!RoundTrippableDissassemble(code1, text))
{
printf("RoundTrip: Disassembly failed.\n");
return false;
}
if (!DSP::Assemble(text, code2))
{
printf("RoundTrip: Assembly failed.\n");
return false;
}
if (!DSP::Compare(code1, code2))
{
DSP::Disassemble(code1, true, text);
printf("%s", text.c_str());
}
return true;
}
// This test goes from text ASM to binary to text ASM and once again back to binary.
// Very convenient for testing. Then the two binaries are compared.
static bool SuperTrip(const char* asm_code)
{
std::vector<u16> code1, code2;
std::string text;
if (!DSP::Assemble(asm_code, code1))
{
printf("SuperTrip: First assembly failed\n");
return false;
}
printf("First assembly: %i words\n", (int)code1.size());
if (!RoundTrippableDissassemble(code1, text))
{
printf("SuperTrip: Disassembly failed\n");
return false;
}
else
{
printf("Disassembly:\n");
printf("%s", text.c_str());
}
if (!DSP::Assemble(text, code2))
{
printf("SuperTrip: Second assembly failed\n");
return false;
}
return true;
}
// Let's start out easy - a trivial instruction..
TEST(DSPAssembly, TrivialInstruction)
{
ASSERT_TRUE(SuperTrip(" NOP\n"));
}
// Now let's do several.
TEST(DSPAssembly, SeveralTrivialInstructions)
{
ASSERT_TRUE(SuperTrip(" NOP\n"
" NOP\n"
" NOP\n"));
}
// Turning it up a notch.
TEST(DSPAssembly, SeveralNoParameterInstructions)
{
ASSERT_TRUE(SuperTrip(" SET16\n"
" SET40\n"
" CLR15\n"
" M0\n"
" M2\n"));
}
// Time to try labels and parameters, and comments.
TEST(DSPAssembly, LabelsParametersAndComments)
{
ASSERT_TRUE(SuperTrip("DIRQ_TEST: equ 0xfffb ; DSP Irq Request\n"
" si @0xfffc, #0x8888\n"
" si @0xfffd, #0xbeef\n"
" si @DIRQ_TEST, #0x0001\n"));
}
// Let's see if registers roundtrip. Also try predefined labels.
TEST(DSPAssembly, RegistersAndPredefinedLabels)
{
ASSERT_TRUE(SuperTrip(" si @0xfffc, #0x8888\n"
" si @0xfffd, #0xbeef\n"
" si @DIRQ, #0x0001\n"));
}
// Let's try some messy extended instructions.
TEST(DSPAssembly, ExtendedInstructions)
{
ASSERT_TRUE(SuperTrip(" MULMV'SN $AX0.L, $AX0.H, $ACC0 : @$AR2, $AC1.M\n"
" ADDAXL'MV $ACC1, $AX1.L : $AX1.H, $AC1.M\n"));
}
TEST(DSPAssembly, HermesBinary)
{
ASSERT_TRUE(RoundTrip(s_hermes_bin));
}
TEST(DSPAssembly, DSPTestText)
{
ASSERT_TRUE(SuperTrip(s_dsp_test_text));
}
TEST(DSPAssembly, DSPTestBinary)
{
ASSERT_TRUE(RoundTrip(s_dsp_test_bin));
}
/*
if (File::ReadFileToString("C:/devkitPro/examples/wii/asndlib/dsptest/dsp_test.ds", &dsp_test))
SuperTrip(dsp_test.c_str());
//.File::ReadFileToString("C:/devkitPro/trunk/libogc/libasnd/dsp_mixer/dsp_mixer.s", &dsp_test);
// This is CLOSE to working. Sorry about the local path btw. This is preliminary code.
*/

View File

@ -0,0 +1,52 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DSPTestBinary.h"
const std::vector<u16> s_dsp_test_bin = {
0x029f, 0x015b, 0x029f, 0x015f, 0x029f, 0x0163, 0x029f, 0x0167, 0x029f, 0x016b, 0x029f, 0x016f,
0x029f, 0x0180, 0x029f, 0x0184, 0x1302, 0x1303, 0x1204, 0x1305, 0x1306, 0x8e00, 0x0092, 0x00ff,
0x8900, 0x8100, 0x02bf, 0x014f, 0x16fc, 0x8888, 0x16fd, 0xdead, 0x16fb, 0x0001, 0x02bf, 0x0155,
0x26ff, 0x0340, 0x7fff, 0x00ff, 0x0f7e, 0x00fe, 0x0f7f, 0x0098, 0x0000, 0x0099, 0x0000, 0x009a,
0x2000, 0x00dc, 0x0f7e, 0x00de, 0x0f7f, 0x02bf, 0x013f, 0x02bf, 0x014f, 0x16fc, 0x8888, 0x16fd,
0xbeef, 0x16fb, 0x0001, 0x02bf, 0x0155, 0x26ff, 0x0340, 0x7fff, 0x00ff, 0x0f7e, 0x00fe, 0x0f7f,
0x0098, 0x0f80, 0x0099, 0x0000, 0x009a, 0x0080, 0x00dc, 0x0f7e, 0x00de, 0x0f7f, 0x02bf, 0x013f,
0x0080, 0x0f81, 0x1901, 0x1902, 0x1903, 0x1904, 0x1905, 0x1906, 0x1907, 0x1908, 0x1909, 0x190a,
0x190b, 0x190c, 0x190d, 0x190e, 0x190f, 0x1910, 0x1911, 0x1912, 0x1913, 0x1914, 0x1915, 0x1916,
0x1917, 0x1918, 0x1919, 0x191a, 0x191b, 0x191c, 0x191d, 0x191e, 0x191f, 0x00c0, 0x0f80, 0x0000,
0x0000, 0x0000, 0x0000, 0x8600, 0x02bf, 0x0194, 0x029f, 0x0136, 0x00de, 0x03f1, 0x02bf, 0x0194,
0x0200, 0x0a60, 0x02bf, 0x0194, 0x1c7e, 0x02bf, 0x0194, 0x8100, 0x02bf, 0x0194, 0x8900, 0x02bf,
0x0194, 0x009f, 0x00a0, 0x02bf, 0x0194, 0x00de, 0x03f1, 0x02bf, 0x0194, 0x5d00, 0x02bf, 0x0194,
0x0e50, 0x02bf, 0x0194, 0x0750, 0x02bf, 0x0194, 0x0270, 0x02bf, 0x0194, 0x5d00, 0x02bf, 0x0194,
0x00da, 0x03f2, 0x02bf, 0x0194, 0x8600, 0x02bf, 0x0194, 0x0290, 0x00e7, 0x00de, 0x03f3, 0x02bf,
0x0194, 0x5c00, 0x02bf, 0x0194, 0x0293, 0x00bc, 0x029f, 0x00f0, 0x00db, 0x03f7, 0x02bf, 0x0194,
0x009e, 0x8000, 0x02bf, 0x0194, 0x4600, 0x02bf, 0x0194, 0x029f, 0x00d4, 0x00db, 0x03f7, 0x02bf,
0x0194, 0x009e, 0x8000, 0x02bf, 0x0194, 0x5600, 0x02bf, 0x0194, 0x00fe, 0x03f5, 0x02bf, 0x0194,
0x1fda, 0x02bf, 0x0194, 0x7c00, 0x02bf, 0x0194, 0x1f5e, 0x02bf, 0x0194, 0x00fe, 0x03f2, 0x02bf,
0x0194, 0x029f, 0x00f0, 0x00de, 0x03f4, 0x02bf, 0x0194, 0x5d00, 0x02bf, 0x0194, 0x0293, 0x00c9,
0x8900, 0x02bf, 0x0194, 0x00dd, 0x03f5, 0x02bf, 0x0194, 0x1501, 0x02bf, 0x0194, 0x8100, 0x02bf,
0x0194, 0x00dc, 0x03f6, 0x02bf, 0x0194, 0x008b, 0x009f, 0x02bf, 0x0194, 0x0080, 0x0a00, 0x02bf,
0x0194, 0x0900, 0x02bf, 0x0194, 0x1150, 0x011d, 0x1878, 0x02bf, 0x0194, 0x4c00, 0x02bf, 0x0194,
0x1cfe, 0x02bf, 0x0194, 0x001f, 0x02bf, 0x0194, 0x1fd9, 0x02bf, 0x0194, 0x1b18, 0x02bf, 0x0194,
0x009f, 0x0a60, 0x02bf, 0x0194, 0x1fc3, 0x02bf, 0x0194, 0x5c00, 0x02bf, 0x0194, 0x00fe, 0x03f1,
0x02bf, 0x0194, 0x00fc, 0x03f6, 0x02bf, 0x0194, 0x008b, 0xffff, 0x02bf, 0x0194, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x029f, 0x013d, 0x00fc, 0xffce, 0x00fe, 0xffcf, 0x00f8,
0xffcd, 0x00f9, 0xffc9, 0x00fa, 0xffcb, 0x27c9, 0x03c0, 0x0004, 0x029d, 0x0149, 0x02df, 0x27fc,
0x03c0, 0x8000, 0x029d, 0x014f, 0x02df, 0x27fe, 0x03c0, 0x8000, 0x029c, 0x0155, 0x02df, 0x009e,
0x0000, 0x029f, 0x0188, 0x009e, 0x0001, 0x029f, 0x0188, 0x009e, 0x0002, 0x029f, 0x0188, 0x009e,
0x0003, 0x029f, 0x0188, 0x009e, 0x0004, 0x029f, 0x0188, 0x8e00, 0x1dbc, 0x1dbe, 0x8100, 0x1fcd,
0x1f8d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02ff, 0x009e, 0x0005, 0x029f, 0x0188,
0x009e, 0x0006, 0x029f, 0x0188, 0x009e, 0x0007, 0x029f, 0x0188, 0x27fc, 0x03c0, 0x8000, 0x029d,
0x0188, 0x16fc, 0x8bad, 0x00eb, 0xfffd, 0x16fb, 0x0001, 0x0021, 0x00e0, 0x0f80, 0x0080, 0x0f81,
0x1b01, 0x1b02, 0x1b03, 0x1b04, 0x1b05, 0x1b06, 0x1b07, 0x1b08, 0x1b09, 0x1b0a, 0x1b0b, 0x1b0c,
0x1b0d, 0x1b0e, 0x1b0f, 0x1b10, 0x1b11, 0x1b12, 0x1b13, 0x1b14, 0x1b15, 0x1b16, 0x1b17, 0x1b18,
0x1b19, 0x1b1a, 0x1b1b, 0x1b1c, 0x1b1d, 0x1b1e, 0x1b1f, 0x0098, 0x0000, 0x0099, 0x0001, 0x009a,
0x0200, 0x00dc, 0x0f7e, 0x00de, 0x0f7f, 0x0081, 0x0010, 0x0061, 0x01ce, 0x02bf, 0x013f, 0x0200,
0x0200, 0x1ff8, 0x0300, 0x0100, 0x1f1f, 0x0000, 0x0000, 0x02bf, 0x014f, 0x16fc, 0x8888, 0x16fd,
0xfeeb, 0x16fb, 0x0001, 0x02bf, 0x0155, 0x26ff, 0x0340, 0x7fff, 0x0080, 0x0f81, 0x1901, 0x1902,
0x1903, 0x1904, 0x1905, 0x1906, 0x1907, 0x1908, 0x1909, 0x190a, 0x190b, 0x190c, 0x190d, 0x190e,
0x190f, 0x1910, 0x1911, 0x1912, 0x1913, 0x1914, 0x1915, 0x1916, 0x1917, 0x1918, 0x1919, 0x191a,
0x191b, 0x191c, 0x191d, 0x191e, 0x191f, 0x00c0, 0x0f80, 0x02df, 0x8e00, 0x02bf, 0x0194, 0x8f00,
0x02df, 0x0082, 0x0000, 0x009e, 0x1000, 0x0081, 0x1000, 0x0061, 0x0215, 0x1c7e, 0x80f0, 0x1fe0,
0x1c02, 0x1b1b, 0x1c40, 0x1c1f, 0x0401, 0x0000, 0x02df, 0x0000};

View File

@ -0,0 +1,11 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "Common/CommonTypes.h"
#include <vector>
extern const std::vector<u16> s_dsp_test_bin;

View File

@ -1,4 +1,10 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DSPTestText.h"
const char s_dsp_test_text[8434] = R"(
DSCR: equ 0xffc9 ; DSP DMA Control Reg DSCR: equ 0xffc9 ; DSP DMA Control Reg
DSBL: equ 0xffcb ; DSP DMA Block Length DSBL: equ 0xffcb ; DSP DMA Block Length
DSPA: equ 0xffcd ; DSP DMA DMEM Address DSPA: equ 0xffcd ; DSP DMA DMEM Address
@ -240,7 +246,7 @@ main:
cw 0x8600 cw 0x8600
call send_back call send_back
JNS g_0c4d JGE g_0c4d
; cw 0x0290 ; cw 0x0290
; cw 0x0c4d ; cw 0x0c4d
; call send_back JX0 ; call send_back JX0
@ -630,10 +636,11 @@ dump_memory:
mrr $r02, $r00 mrr $r02, $r00
mrr $r00, $r1f mrr $r00, $r1f
addis $acc0, #0x1 addis $AC0.M, #0x1
_fill_loop2: _fill_loop2:
nop nop
ret ret
)";

View File

@ -0,0 +1,9 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <string>
extern const char s_dsp_test_text[8434];

View File

@ -0,0 +1,69 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "HermesBinary.h"
const std::vector<u16> s_hermes_bin = {
0x029f, 0x02b3, 0x029f, 0x02b4, 0x029f, 0x02b5, 0x029f, 0x02b6, 0x029f, 0x02b7, 0x029f, 0x02b8,
0x029f, 0x02b9, 0x029f, 0x02ba, 0x0092, 0x00ff, 0x0093, 0x0000, 0x8e00, 0x8c00, 0x8b00, 0x16fc,
0xdcd1, 0x16fd, 0x0000, 0x16fb, 0x0001, 0x02bf, 0x027a, 0x02bf, 0x0280, 0x16fc, 0xdcd1, 0x8100,
0x009e, 0xcdd1, 0x8200, 0x0295, 0x0057, 0x8900, 0x27ff, 0x0380, 0x0111, 0x0295, 0x00af, 0x0380,
0x0112, 0x0295, 0x00d0, 0x0380, 0x0123, 0x0295, 0x00a2, 0x0380, 0x0222, 0x0295, 0x00ee, 0x0380,
0x0666, 0x0295, 0x0091, 0x0380, 0x0777, 0x0295, 0x02bb, 0x0380, 0x0888, 0x0295, 0x02ca, 0x0380,
0x0999, 0x0295, 0x0051, 0x16fd, 0x0004, 0x16fb, 0x0001, 0x029f, 0x001d, 0x16fd, 0x0003, 0x16fb,
0x0001, 0x029f, 0x001d, 0x8900, 0x27ff, 0x0380, 0x0001, 0x0295, 0x0063, 0x0380, 0x0002, 0x0295,
0x8000, 0x029f, 0x001d, 0x8e00, 0x02bf, 0x0280, 0x25ff, 0x02bf, 0x0280, 0x25ff, 0x02bf, 0x0280,
0x25ff, 0x02bf, 0x0280, 0x00c5, 0xffff, 0x0340, 0x0fff, 0x1c9f, 0x02bf, 0x0280, 0x00c7, 0xffff,
0x02bf, 0x0280, 0x00c6, 0xffff, 0x02bf, 0x0280, 0x00c0, 0xffff, 0x02bf, 0x0280, 0x20ff, 0x0340,
0x0fff, 0x1f5f, 0x02bf, 0x0280, 0x21ff, 0x02bf, 0x0280, 0x23ff, 0x1205, 0x1206, 0x029f, 0x80b5,
0x0021, 0x0080, 0x0054, 0x0901, 0x0098, 0x1000, 0x00de, 0x0010, 0x00dc, 0x0011, 0x02bf, 0x026a,
0x16fd, 0x0004, 0x16fb, 0x0001, 0x029f, 0x001d, 0x02bf, 0x0280, 0x26fe, 0x00dc, 0xffff, 0x00fe,
0x0000, 0x00fc, 0x0001, 0x16fb, 0x0000, 0x029f, 0x001d, 0x8100, 0x00de, 0x0000, 0x00dc, 0x0001,
0x0804, 0x00f8, 0x0002, 0x16fb, 0x0000, 0x0080, 0x0010, 0x0900, 0x0840, 0x02bf, 0x026a, 0x0081,
0x0054, 0x009d, 0x0000, 0x0098, 0x0400, 0x0078, 0x00c9, 0x1b3d, 0x1b3d, 0x0000, 0x00de, 0x0010,
0x00dc, 0x0011, 0x029f, 0x00fe, 0x8100, 0x00de, 0x0000, 0x00dc, 0x0001, 0x0804, 0x00f8, 0x0002,
0x16fb, 0x0000, 0x0080, 0x0010, 0x0099, 0x0000, 0x0840, 0x02bf, 0x026a, 0x00de, 0x0010, 0x00dc,
0x0011, 0x0080, 0x0054, 0x0900, 0x0098, 0x1000, 0x02bf, 0x026a, 0x029f, 0x00fe, 0x8100, 0x00de,
0x0000, 0x00dc, 0x0001, 0x0804, 0x00f8, 0x0002, 0x16fb, 0x0000, 0x0080, 0x0010, 0x0900, 0x0840,
0x02bf, 0x026a, 0x0088, 0xbb80, 0x00da, 0x001d, 0x00db, 0x001c, 0x00df, 0x0015, 0x0340, 0x0003,
0x0300, 0x01d8, 0x1c7f, 0x0313, 0x1c7f, 0x8100, 0x00de, 0x0015, 0x02c0, 0x0020, 0x029d, 0x0224,
0x00de, 0x0016, 0x00dc, 0x0017, 0xb100, 0x0294, 0x0123, 0x0804, 0x00f8, 0x0002, 0x02bf, 0x0239,
0xb100, 0x0295, 0x021c, 0x1cde, 0x1cfc, 0x00ca, 0x0018, 0x00cb, 0x0019, 0x0081, 0x0054, 0x0098,
0x0400, 0x8100, 0x8900, 0x00d0, 0x0012, 0x00de, 0x0013, 0xb100, 0x0295, 0x0150, 0x0a00, 0x0b00,
0x1ff8, 0x0009, 0x0009, 0x7900, 0x0295, 0x0143, 0x7800, 0x0295, 0x014b, 0x029f, 0x0139, 0x7800,
0x00f0, 0x0012, 0x00fe, 0x0013, 0x0800, 0x029f, 0x0150, 0x00f0, 0x0012, 0x00fe, 0x0013, 0x1f1d,
0x16c9, 0x0000, 0x02bf, 0x0286, 0x00c4, 0x0020, 0x00c5, 0x0021, 0x8100, 0x00d0, 0x001a, 0x00de,
0x001b, 0x8900, 0x1fe8, 0x8200, 0x0080, 0x01c3, 0x0272, 0x0080, 0x01a2, 0x0078, 0x0210, 0x183c,
0x6b00, 0x1498, 0x14f8, 0x4c00, 0x0280, 0x7fff, 0x0293, 0x0174, 0x009e, 0x7fff, 0x029f, 0x0179,
0x0280, 0x8000, 0x0273, 0x009e, 0x8000, 0x1b3e, 0x183c, 0x6900, 0x1498, 0x14f8, 0x4c00, 0x0280,
0x7fff, 0x0293, 0x0187, 0x009e, 0x7fff, 0x029f, 0x018c, 0x0280, 0x8000, 0x0273, 0x009e, 0x8000,
0x1b3e, 0x8900, 0x00d1, 0x001e, 0x00df, 0x001f, 0x8100, 0x00d0, 0x001a, 0x00de, 0x001b, 0x4d00,
0x8100, 0x1fc8, 0x8200, 0x1706, 0x00f1, 0x001e, 0x00ff, 0x001f, 0x029f, 0x0210, 0x5d00, 0x8100,
0x1fc6, 0x1f87, 0x00d9, 0x0014, 0x7200, 0x1cde, 0x1cfc, 0x1fdc, 0x02a0, 0x001f, 0x02bd, 0x0286,
0x8100, 0x1fc8, 0x8200, 0x0293, 0x01a2, 0x00f1, 0x001e, 0x00ff, 0x001f, 0x1fc6, 0x1f87, 0x8900,
0x1fea, 0x1fab, 0x8200, 0x0297, 0x01dc, 0x029f, 0x0299, 0x5d00, 0x00f1, 0x001e, 0x00ff, 0x001f,
0x8100, 0x1fc6, 0x1f87, 0x00d9, 0x0014, 0x7200, 0x8900, 0x1fea, 0x1fab, 0x8200, 0x0297, 0x01dc,
0x1cde, 0x1cfc, 0x029f, 0x0299, 0x01ec, 0x0200, 0x01f7, 0x0204, 0x0804, 0x00f8, 0x0002, 0x02bf,
0x0239, 0xb100, 0x0295, 0x01e8, 0x02bf, 0x0286, 0x029f, 0x0299, 0x0a00, 0x0b00, 0x029f, 0x0206,
0x1fe7, 0x195c, 0x03a0, 0x0001, 0x027d, 0x14f8, 0x1488, 0x1f7c, 0x1f5c, 0x029f, 0x0206, 0x195c,
0x1fdc, 0x0240, 0xff00, 0x1f7e, 0x1408, 0x1f5c, 0x029f, 0x0206, 0x195b, 0x1f5b, 0x029f, 0x0206,
0x195b, 0x195a, 0x1f04, 0x9000, 0x6e00, 0x14f8, 0x1f5c, 0x1f25, 0x9800, 0x6e00, 0x14f8, 0x1f7c,
0x0000, 0x8100, 0x1fc6, 0x1f87, 0xb100, 0x0294, 0x021c, 0x0804, 0x00f8, 0x0002, 0x02bf, 0x0239,
0x00e6, 0x0016, 0x00e7, 0x0017, 0x00fa, 0x001d, 0x00fb, 0x001c, 0x8100, 0x00de, 0x0000, 0x00dc,
0x0001, 0x0080, 0x0010, 0x0901, 0x0840, 0x02bf, 0x026a, 0x16fc, 0xdcd1, 0x00dc, 0x0002, 0x00fc,
0xfffd, 0x16fb, 0x0001, 0x029f, 0x001d, 0x8100, 0x00de, 0x0026, 0x00dc, 0x0027, 0x00fe, 0x0020,
0x00fc, 0x0021, 0x1c9e, 0x1cbc, 0x00de, 0x0024, 0x00dc, 0x0025, 0x00fe, 0x0018, 0x00fc, 0x0019,
0x1d5e, 0x1d7c, 0x00de, 0x0022, 0x00dc, 0x0023, 0x00fe, 0x0016, 0x00fc, 0x0017, 0x00fe, 0x0028,
0x00fc, 0x0029, 0x1cde, 0x1cfc, 0x00df, 0x0015, 0x03c0, 0x0004, 0x02dd, 0x00f0, 0x0022, 0x00f0,
0x0023, 0x00f0, 0x0024, 0x00f0, 0x0025, 0x02df, 0x00fe, 0xffce, 0x00fc, 0xffcf, 0x00e0, 0xffcd,
0x00f9, 0xffc9, 0x00f8, 0xffcb, 0x27c9, 0x03c0, 0x0004, 0x029d, 0x0274, 0x02df, 0x27fc, 0x03c0,
0x8000, 0x029d, 0x027a, 0x02df, 0x27fe, 0x03c0, 0x8000, 0x029c, 0x0280, 0x02df, 0x1f87, 0x147b,
0x1405, 0x00e6, 0xffce, 0x00fc, 0xffcf, 0x16cd, 0x0034, 0x16cb, 0x0020, 0x26c9, 0x02c0, 0x0004,
0x029d, 0x0291, 0x0082, 0x0034, 0x02df, 0x1fc7, 0x14ff, 0x0240, 0x000f, 0x0295, 0x02a3, 0x0200,
0x0034, 0x1c5e, 0x176f, 0x00e6, 0xffce, 0x00e7, 0xffcf, 0x16cd, 0x0034, 0x16cb, 0x0020, 0x26c9,
0x02c0, 0x0004, 0x029d, 0x02ab, 0x0082, 0x0034, 0x176f, 0x02ff, 0x02ff, 0x02ff, 0x02ff, 0x02ff,
0x02ff, 0x02ff, 0x02ff, 0x8100, 0x00de, 0xfffe, 0x0260, 0x8000, 0x1c1e, 0x8100, 0x0210, 0x00fc,
0xfffc, 0x00fe, 0xfffd, 0x8100, 0x029f, 0x001d, 0x8100, 0x009e, 0x0000, 0x02a0, 0x0001, 0x00f3,
0xfffc, 0x00fe, 0xfffd, 0x8100, 0x029f, 0x001d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000};

View File

@ -0,0 +1,11 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "Common/CommonTypes.h"
#include <vector>
extern const std::vector<u16> s_hermes_bin;

View File

@ -59,6 +59,7 @@
<!--Lump all of the tests (and supporting code) into one binary--> <!--Lump all of the tests (and supporting code) into one binary-->
<ClCompile Include="*.cpp" /> <ClCompile Include="*.cpp" />
<ClCompile Include="*\*.cpp" /> <ClCompile Include="*\*.cpp" />
<ClCompile Include="*\*\*.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Text Include="CMakeLists.txt" /> <Text Include="CMakeLists.txt" />