DSPTool: extract tests into a DSPAssemblyTest

- Moves all test code from DSPTool into UnitTests/Core/DSPAssemblyTest.
- Converts test files (which could only be loaded if they were in the
  shell's working directory, so basically never) into C++ values.
- Enables most of the commented-out tests.
- Removes non-deterministic random code test.
This commit is contained in:
Michael Maltese
2017-05-19 17:36:04 -07:00
parent 1580b6e627
commit 80710984dc
13 changed files with 322 additions and 192 deletions

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

@ -0,0 +1,646 @@
// 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
DSBL: equ 0xffcb ; DSP DMA Block Length
DSPA: equ 0xffcd ; DSP DMA DMEM Address
DSMAH: equ 0xffce ; DSP DMA Mem Address H
DSMAL: equ 0xffcf ; DSP DMA Mem Address L
ACSAH: equ 0xffd4
ACSAL: equ 0xffd5
ACEAH: equ 0xffd6
ACEAL: equ 0xffd7
ACCAH: equ 0xffd8
ACCAL: equ 0xffd9
AMDM: equ 0xffef ; ARAM DMA Request Mask
DIRQ: equ 0xfffb ; DSP Irq Request
DMBH: equ 0xfffc ; DSP Mailbox H
DMBL: equ 0xfffd ; DSP Mailbox L
CMBH: equ 0xfffe ; CPU Mailbox H
CMBL: equ 0xffff ; CPU Mailbox L
R00: equ 0x00
R01: equ 0x01
R02: equ 0x02
R03: equ 0x03
R04: equ 0x04
R05: equ 0x05
R06: equ 0x06
R07: equ 0x07
R08: equ 0x08
R09: equ 0x09
R0A: equ 0x0a
R0B: equ 0x0b
R0C: equ 0x0c
R0D: equ 0x0d
R0E: equ 0x0e
R0F: equ 0x0f
R10: equ 0x10
R11: equ 0x11
R12: equ 0x12
R13: equ 0x13
R14: equ 0x14
R15: equ 0x15
R16: equ 0x16
R17: equ 0x17
R18: equ 0x18
R19: equ 0x19
R1A: equ 0x1a
R1B: equ 0x1b
R1C: equ 0x1c
R1D: equ 0x1d
R1E: equ 0x1e
R1F: equ 0x1f
ACH0: equ 0x10
ACH1: equ 0x11
ACL0: equ 0x1e
ACL1: equ 0x1f
DSP_CR_IMEM: equ 2
DSP_CR_TO_CPU: equ 1
REGS_BASE: equ 0x0f80
MEM_HI: equ 0x0f7E
MEM_LO: equ 0x0f7F
; Interrupt vectors 8 vectors, 2 opcodes each
jmp irq0
jmp irq1
jmp irq2
jmp irq3
jmp irq4
jmp irq5
jmp irq6
jmp irq7
; Main code at 0x10
CW 0x1302
CW 0x1303
CW 0x1204
CW 0x1305
CW 0x1306
s40
lri $r12, #0x00ff
main:
cw 0x8900
cw 0x8100
; get address of memory dump and copy it
call wait_for_dsp_mbox
si @DMBH, #0x8888
si @DMBL, #0xdead
si @DIRQ, #0x0001
call wait_for_cpu_mbox
lrs $ACL0, @CMBL
andi $acl1, #0x7fff
sr @MEM_HI, $ACL1
sr @MEM_LO, $ACL0
lri $r18, #0
lri $r19, #0 ;(DSP_CR_IMEM | DSP_CR_TO_CPU)
lri $r1a, #0x2000
lr $r1c, @MEM_HI
lr $r1e, @MEM_LO
call do_dma
; get address of registers and DMA them to memory
call wait_for_dsp_mbox
si @DMBH, #0x8888
si @DMBL, #0xbeef
si @DIRQ, #0x0001
call wait_for_cpu_mbox
lrs $ACL0, @CMBL
andi $acl1, #0x7fff
sr @MEM_HI, $ACL1
sr @MEM_LO, $ACL0
lri $r18, #REGS_BASE
lri $r19, #0 ;(DSP_CR_IMEM | DSP_CR_TO_CPU)
lri $r1a, #0x80
lr $r1c, @MEM_HI
lr $r1e, @MEM_LO
call do_dma
lri $r00, #REGS_BASE+1
lrri $r01, @$r00
lrri $r02, @$r00
lrri $r03, @$r00
lrri $r04, @$r00
lrri $r05, @$r00
lrri $r06, @$r00
lrri $r07, @$r00
lrri $r08, @$r00
lrri $r09, @$r00
lrri $r0a, @$r00
lrri $r0b, @$r00
lrri $r0c, @$r00
lrri $r0d, @$r00
lrri $r0e, @$r00
lrri $r0f, @$r00
lrri $r10, @$r00
lrri $r11, @$r00
lrri $r12, @$r00
lrri $r13, @$r00
lrri $r14, @$r00
lrri $r15, @$r00
lrri $r16, @$r00
lrri $r17, @$r00
lrri $r18, @$r00
lrri $r19, @$r00
lrri $r1a, @$r00
lrri $r1b, @$r00
lrri $r1c, @$r00
lrri $r1d, @$r00
lrri $r1e, @$r00
lrri $r1f, @$r00
lr $r00, @REGS_BASE
nop
nop
nop
nop
cw 0x8600
call send_back
JMP ende
; call dump_memory
; call send_back
; 0x041e
;
cw 0x00de
cw 0x03f1
call send_back
cw 0x0200
cw 0x0a60
call send_back
cw 0x1c7e
call send_back
cw 0x8100
call send_back
cw 0x8900
call send_back
cw 0x009f
cw 0x00a0
call send_back
cw 0x00de
cw 0x03f1
call send_back
cw 0x5d00
call send_back
cw 0x0e50
call send_back
cw 0x0750
call send_back
cw 0x0270
call send_back
cw 0x5d00
call send_back
cw 0x00da
cw 0x03f2
call send_back
cw 0x8600
call send_back
JGE g_0c4d
; cw 0x0290
; cw 0x0c4d
; call send_back JX0
cw 0x00de
cw 0x03f3
call send_back
cw 0x5c00
call send_back
JLE g_0c38
; cw 0x0293
; cw 0x0c38 JX3
; call send_back
JMP g_0c52
; cw 0x029f
; cw 0x0c52
; call send_back
g_0c38:
cw 0x00db
cw 0x03f7
call send_back
cw 0x009e
cw 0x8000
call send_back
cw 0x4600
call send_back
JMP g_0c44
; cw 0x029f
; cw 0x0c44
; call send_back
g_0c3f:
cw 0x00db
cw 0x03f7
call send_back
cw 0x009e
cw 0x8000
call send_back
cw 0x5600
call send_back
g_0c44:
cw 0x00fe
cw 0x03f5
call send_back
cw 0x1fda
call send_back
cw 0x7c00
call send_back
cw 0x1f5e
call send_back
cw 0x00fe
cw 0x03f2
call send_back
JMP g_0c52
; cw 0x029f
; cw 0x0c52
; call send_back
g_0c4d:
cw 0x00de
cw 0x03f4
call send_back
cw 0x5d00
call send_back
JLE g_0c3f
; cw 0x0293
; cw 0x0c3f
; call send_back
g_0c52:
cw 0x8900
call send_back
cw 0x00dd
cw 0x03f5
call send_back
cw 0x1501
call send_back
cw 0x8100
call send_back
cw 0x00dc
cw 0x03f6
call send_back
cw 0x008b
cw 0x009f
call send_back
cw 0x0080
cw 0x0a00
call send_back
cw 0x0900
call send_back
BLOOPI #0x50, g_0c65
; cw 0x1150
; cw 0x0c65
; call send_back
cw 0x1878
call send_back
cw 0x4c00
call send_back
cw 0x1cfe
call send_back
cw 0x001f
call send_back
cw 0x1fd9
call send_back
g_0c65:
cw 0x1b18
call send_back
cw 0x009f
cw 0x0a60
call send_back
cw 0x1fc3
call send_back
cw 0x5c00
call send_back
cw 0x00fe
cw 0x03f1
call send_back
cw 0x00fc
cw 0x03f6
call send_back
cw 0x008b
cw 0xffff
call send_back
ende:
nop
nop
nop
nop
nop
nop
nop
dead_loop:
jmp dead_loop
do_dma:
sr @DSMAH, $r1c
sr @DSMAL, $r1e
sr @DSPA, $r18
sr @DSCR, $r19
sr @DSBL, $r1a
wait_dma:
LRS $ACL1, @DSCR
andcf $acl1, #0x0004
JLZ wait_dma
RET
wait_for_dsp_mbox:
lrs $ACL1, @DMBH
andcf $acl1, #0x8000
jlz wait_for_dsp_mbox
ret
wait_for_cpu_mbox:
lrs $ACL1, @cmbh
andcf $acl1, #0x8000
jlnz wait_for_cpu_mbox
ret
irq0:
lri $acl0, #0x0000
jmp irq
irq1:
lri $acl0, #0x0001
jmp irq
irq2:
lri $acl0, #0x0002
jmp irq
irq3:
lri $acl0, #0x0003
jmp irq
irq4:
lri $acl0, #0x0004
jmp irq
irq5:
; jmp finale
s40
mrr $r0d, $r1c
mrr $r0d, $r1e
clr $acc0
mrr $r1e, $r0d
mrr $r1c, $r0d
nop
nop
nop
nop
nop
nop
rti
lri $acl0, #0x0005
jmp irq
irq6:
lri $acl0, #0x0006
jmp irq
irq7:
lri $acl0, #0x0007
jmp irq
irq:
lrs $ACL1, @DMBH
andcf $acl1, #0x8000
jlz irq
si @DMBH, #0x8BAD
sr @DMBL, $r0b
;sr @DMBL, $acl0
si @DIRQ, #0x0001
halt
send_back:
; store registers to reg table
sr @REGS_BASE, $r00
lri $r00, #(REGS_BASE + 1)
srri @$r00, $r01
srri @$r00, $r02
srri @$r00, $r03
srri @$r00, $r04
srri @$r00, $r05
srri @$r00, $r06
srri @$r00, $r07
srri @$r00, $r08
srri @$r00, $r09
srri @$r00, $r0a
srri @$r00, $r0b
srri @$r00, $r0c
srri @$r00, $r0d
srri @$r00, $r0e
srri @$r00, $r0f
srri @$r00, $r10
srri @$r00, $r11
srri @$r00, $r12
srri @$r00, $r13
srri @$r00, $r14
srri @$r00, $r15
srri @$r00, $r16
srri @$r00, $r17
srri @$r00, $r18
srri @$r00, $r19
srri @$r00, $r1a
srri @$r00, $r1b
srri @$r00, $r1c
srri @$r00, $r1d
srri @$r00, $r1e
srri @$r00, $r1f
lri $r18, #0x0000
lri $r19, #1 ;(DSP_CR_IMEM | DSP_CR_TO_CPU)
lri $r1a, #0x200
lr $r1c, @MEM_HI
lr $r1e, @MEM_LO
lri $r01, #8+8
bloop $r01, dma_copy
call do_dma
addi $r1e, #0x200
mrr $r1f, $r18
addi $r1f, #0x100
mrr $r18, $r1f
nop
dma_copy:
nop
call wait_for_dsp_mbox
si @DMBH, #0x8888
si @DMBL, #0xfeeb
si @DIRQ, #0x0001
; wait for answer before we execute the next op
call wait_for_cpu_mbox
lrs $ACL0, @CMBL
andi $acl1, #0x7fff
lri $r00, #REGS_BASE+1
lrri $r01, @$r00
lrri $r02, @$r00
lrri $r03, @$r00
lrri $r04, @$r00
lrri $r05, @$r00
lrri $r06, @$r00
lrri $r07, @$r00
lrri $r08, @$r00
lrri $r09, @$r00
lrri $r0a, @$r00
lrri $r0b, @$r00
lrri $r0c, @$r00
lrri $r0d, @$r00
lrri $r0e, @$r00
lrri $r0f, @$r00
lrri $r10, @$r00
lrri $r11, @$r00
lrri $r12, @$r00
lrri $r13, @$r00
lrri $r14, @$r00
lrri $r15, @$r00
lrri $r16, @$r00
lrri $r17, @$r00
lrri $r18, @$r00
lrri $r19, @$r00
lrri $r1a, @$r00
lrri $r1b, @$r00
lrri $r1c, @$r00
lrri $r1d, @$r00
lrri $r1e, @$r00
lrri $r1f, @$r00
lr $r00, @REGS_BASE
ret
send_back_16:
cw 0x8e00
call send_back
cw 0x8f00
ret
dump_memory:
lri $r02, #0x0000
lri $acl0, #0x1000
lri $r01, #0x1000
bloop $r01, _fill_loop2
mrr $r03, $acl0
cw 0x80f0
mrr $r1f, $r00
mrr $r00, $r02
srri @$r00, $r1b
mrr $r02, $r00
mrr $r00, $r1f
addis $AC0.M, #0x1
_fill_loop2:
nop
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;

File diff suppressed because it is too large Load Diff