2017-05-20 00:36:04 +00:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2017-05-20 00:36:04 +00:00
|
|
|
#include "DSPTestText.h"
|
|
|
|
|
|
|
|
const char s_dsp_test_text[8434] = R"(
|
2009-04-18 11:31:37 +00:00
|
|
|
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
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
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
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
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
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
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
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
ACH0: equ 0x10
|
|
|
|
ACH1: equ 0x11
|
|
|
|
ACL0: equ 0x1e
|
|
|
|
ACL1: equ 0x1f
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
DSP_CR_IMEM: equ 2
|
|
|
|
DSP_CR_TO_CPU: equ 1
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
REGS_BASE: equ 0x0f80
|
|
|
|
MEM_HI: equ 0x0f7E
|
|
|
|
MEM_LO: equ 0x0f7F
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
; Interrupt vectors 8 vectors, 2 opcodes each
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
jmp irq0
|
|
|
|
jmp irq1
|
|
|
|
jmp irq2
|
|
|
|
jmp irq3
|
|
|
|
jmp irq4
|
|
|
|
jmp irq5
|
|
|
|
jmp irq6
|
|
|
|
jmp irq7
|
2017-05-20 00:07:26 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
; Main code at 0x10
|
|
|
|
CW 0x1302
|
|
|
|
CW 0x1303
|
|
|
|
CW 0x1204
|
|
|
|
CW 0x1305
|
|
|
|
CW 0x1306
|
2010-06-09 01:37:08 +00:00
|
|
|
|
UnitTests: Update DSP test text for old renames
This change makes assembling DSPTestText match DSPTestBinary, though HermesText doesn't yet match HermesBinary.
The test data was originally added on April 18, 2009 in e7e4ef4481d1c5dcce6463414d815843ae15b8e2. Then, set16 and set40 were swapped on April 22, 2009 89178f411cf1e8ef61b005197545618e53a0d4e8, which updated the DSPSpy version of dsp_code, but not the version in DSPTool used for testing. So, when the test was made, the assembled data matched the text, but a few days after it no longer did.
Similarly, on Jul 7, 2009 in 1654c582ab9a6323a31802c4b241c0cffc9d3bca the conditional instructions were adjusted, and 0x1706 was changed from JRL to JRNC and 0x0297 was changed from JGE to JC.
For what it's worth, devkitPro made the same changes on May 31, 2010 in https://github.com/devkitPro/gamecube-tools/commit/8a65c85c9b4748ed3dab3c0c85aeb0df95d58cfb and updated their version of the asnd ucode (which is this ucode) on June 11, 2011 in https://github.com/devkitpro/libogc/commit/b1b8ecab3af3745c8df0b401abd512bdf5fcc011 (though this update also includes other feature changes). Note that at the time, they didn't reassemble the ucode unless they made changes to it; the assembled was stored in the repo until https://github.com/devkitPro/libogc/compare/bfb705fe1607a3031d18b65d603975b68a1cffd4~...d20f9bdcfb43260c6c759f4fb98d724931443f93.
This fixes the following failures with Hermes:
!! 0015 : 8e00 vs 8f00 - set16 vs set40
!! 016f : 8e00 vs 8f00 - set16 vs set40
and with Hermes:
!! 0014 : 8e00 vs 8f00 - set16 vs set40
!! 0063 : 8e00 vs 8f00 - set16 vs set40
!! 019b : 1706 vs 1701 - jrnc $AR0 vs jrl $AR0
!! 01bf : 0297 vs 0290 - jc 0x01dc vs jge 0x01dc
!! 01d2 : 0297 vs 0290 - jc 0x01dc vs jge 0x01dc
Hermes has the remaining failures:
!! 027b : 03c0 vs 03a0 - andcf $AC1.M, #0x8000 vs andf $AC1.M, #0x8000
!! 027d : 029d vs 0294 - jlz 0x027a vs jnz 0x027a
2022-06-14 04:46:03 +00:00
|
|
|
s16
|
2009-04-18 11:31:37 +00:00
|
|
|
lri $r12, #0x00ff
|
2017-05-20 00:07:26 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
main:
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
cw 0x8900
|
2017-05-20 00:07:26 +00:00
|
|
|
cw 0x8100
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
; get address of memory dump and copy it
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
call wait_for_dsp_mbox
|
|
|
|
si @DMBH, #0x8888
|
|
|
|
si @DMBL, #0xdead
|
|
|
|
si @DIRQ, #0x0001
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
call wait_for_cpu_mbox
|
|
|
|
lrs $ACL0, @CMBL
|
|
|
|
andi $acl1, #0x7fff
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
sr @MEM_HI, $ACL1
|
|
|
|
sr @MEM_LO, $ACL0
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
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
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
; get address of registers and DMA them to memory
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
call wait_for_dsp_mbox
|
|
|
|
si @DMBH, #0x8888
|
|
|
|
si @DMBL, #0xbeef
|
|
|
|
si @DIRQ, #0x0001
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
call wait_for_cpu_mbox
|
|
|
|
lrs $ACL0, @CMBL
|
|
|
|
andi $acl1, #0x7fff
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
sr @MEM_HI, $ACL1
|
|
|
|
sr @MEM_LO, $ACL0
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
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
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
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
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
cw 0x8600
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
JMP ende
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
; call dump_memory
|
|
|
|
; call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
; 0x041e
|
2017-05-20 00:07:26 +00:00
|
|
|
;
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2017-05-20 00:07:26 +00:00
|
|
|
cw 0x00de
|
|
|
|
cw 0x03f1
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x0200
|
|
|
|
cw 0x0a60
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x1c7e
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x8100
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x8900
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x009f
|
|
|
|
cw 0x00a0
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x00de
|
|
|
|
cw 0x03f1
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x5d00
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x0e50
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x0750
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x0270
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x5d00
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x00da
|
|
|
|
cw 0x03f2
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x8600
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
JGE g_0c4d
|
|
|
|
; cw 0x0290
|
|
|
|
; cw 0x0c4d
|
2009-04-18 11:31:37 +00:00
|
|
|
; call send_back JX0
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x00de
|
|
|
|
cw 0x03f3
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x5c00
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
JLE g_0c38
|
|
|
|
; cw 0x0293
|
2009-04-18 11:31:37 +00:00
|
|
|
; cw 0x0c38 JX3
|
|
|
|
; call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
JMP g_0c52
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
; cw 0x029f
|
|
|
|
; cw 0x0c52
|
|
|
|
; call send_back
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
g_0c38:
|
2017-05-20 00:07:26 +00:00
|
|
|
cw 0x00db
|
|
|
|
cw 0x03f7
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x009e
|
|
|
|
cw 0x8000
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x4600
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
JMP g_0c44
|
2017-05-20 00:07:26 +00:00
|
|
|
; cw 0x029f
|
|
|
|
; cw 0x0c44
|
2009-04-18 11:31:37 +00:00
|
|
|
; call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
g_0c3f:
|
|
|
|
cw 0x00db
|
|
|
|
cw 0x03f7
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x009e
|
|
|
|
cw 0x8000
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x5600
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
g_0c44:
|
|
|
|
cw 0x00fe
|
|
|
|
cw 0x03f5
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x1fda
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x7c00
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x1f5e
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x00fe
|
|
|
|
cw 0x03f2
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
JMP g_0c52
|
|
|
|
; cw 0x029f
|
|
|
|
; cw 0x0c52
|
2009-04-18 11:31:37 +00:00
|
|
|
; call send_back
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
g_0c4d:
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x00de
|
|
|
|
cw 0x03f4
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x5d00
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
JLE g_0c3f
|
|
|
|
; cw 0x0293
|
|
|
|
; cw 0x0c3f
|
2009-04-18 11:31:37 +00:00
|
|
|
; call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
g_0c52:
|
|
|
|
cw 0x8900
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x00dd
|
|
|
|
cw 0x03f5
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x1501
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x8100
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x00dc
|
|
|
|
cw 0x03f6
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x008b
|
|
|
|
cw 0x009f
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x0080
|
|
|
|
cw 0x0a00
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x0900
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
BLOOPI #0x50, g_0c65
|
2017-05-20 00:07:26 +00:00
|
|
|
; cw 0x1150
|
|
|
|
; cw 0x0c65
|
2009-04-18 11:31:37 +00:00
|
|
|
; call send_back
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
|
2017-05-20 00:07:26 +00:00
|
|
|
cw 0x1878
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x4c00
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x1cfe
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x001f
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x1fd9
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
|
|
|
g_0c65:
|
2017-05-20 00:07:26 +00:00
|
|
|
cw 0x1b18
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x009f
|
|
|
|
cw 0x0a60
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x1fc3
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x5c00
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x00fe
|
|
|
|
cw 0x03f1
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x00fc
|
|
|
|
cw 0x03f6
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
cw 0x008b
|
|
|
|
cw 0xffff
|
2009-04-18 11:31:37 +00:00
|
|
|
call send_back
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
ende:
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
dead_loop:
|
|
|
|
jmp dead_loop
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
do_dma:
|
|
|
|
sr @DSMAH, $r1c
|
|
|
|
sr @DSMAL, $r1e
|
|
|
|
sr @DSPA, $r18
|
|
|
|
sr @DSCR, $r19
|
|
|
|
sr @DSBL, $r1a
|
|
|
|
wait_dma:
|
|
|
|
LRS $ACL1, @DSCR
|
2009-04-18 12:27:24 +00:00
|
|
|
andcf $acl1, #0x0004
|
|
|
|
JLZ wait_dma
|
2009-04-18 11:31:37 +00:00
|
|
|
RET
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
wait_for_dsp_mbox:
|
|
|
|
lrs $ACL1, @DMBH
|
2009-04-18 12:27:24 +00:00
|
|
|
andcf $acl1, #0x8000
|
|
|
|
jlz wait_for_dsp_mbox
|
2009-04-18 11:31:37 +00:00
|
|
|
ret
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
wait_for_cpu_mbox:
|
|
|
|
lrs $ACL1, @cmbh
|
|
|
|
andcf $acl1, #0x8000
|
|
|
|
jlnz wait_for_cpu_mbox
|
|
|
|
ret
|
2017-05-20 00:07:26 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
irq0:
|
|
|
|
lri $acl0, #0x0000
|
|
|
|
jmp irq
|
|
|
|
irq1:
|
|
|
|
lri $acl0, #0x0001
|
|
|
|
jmp irq
|
|
|
|
irq2:
|
|
|
|
lri $acl0, #0x0002
|
|
|
|
jmp irq
|
2017-05-20 00:07:26 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
irq3:
|
|
|
|
lri $acl0, #0x0003
|
|
|
|
jmp irq
|
|
|
|
irq4:
|
|
|
|
lri $acl0, #0x0004
|
|
|
|
jmp irq
|
|
|
|
irq5:
|
|
|
|
; jmp finale
|
UnitTests: Update DSP test text for old renames
This change makes assembling DSPTestText match DSPTestBinary, though HermesText doesn't yet match HermesBinary.
The test data was originally added on April 18, 2009 in e7e4ef4481d1c5dcce6463414d815843ae15b8e2. Then, set16 and set40 were swapped on April 22, 2009 89178f411cf1e8ef61b005197545618e53a0d4e8, which updated the DSPSpy version of dsp_code, but not the version in DSPTool used for testing. So, when the test was made, the assembled data matched the text, but a few days after it no longer did.
Similarly, on Jul 7, 2009 in 1654c582ab9a6323a31802c4b241c0cffc9d3bca the conditional instructions were adjusted, and 0x1706 was changed from JRL to JRNC and 0x0297 was changed from JGE to JC.
For what it's worth, devkitPro made the same changes on May 31, 2010 in https://github.com/devkitPro/gamecube-tools/commit/8a65c85c9b4748ed3dab3c0c85aeb0df95d58cfb and updated their version of the asnd ucode (which is this ucode) on June 11, 2011 in https://github.com/devkitpro/libogc/commit/b1b8ecab3af3745c8df0b401abd512bdf5fcc011 (though this update also includes other feature changes). Note that at the time, they didn't reassemble the ucode unless they made changes to it; the assembled was stored in the repo until https://github.com/devkitPro/libogc/compare/bfb705fe1607a3031d18b65d603975b68a1cffd4~...d20f9bdcfb43260c6c759f4fb98d724931443f93.
This fixes the following failures with Hermes:
!! 0015 : 8e00 vs 8f00 - set16 vs set40
!! 016f : 8e00 vs 8f00 - set16 vs set40
and with Hermes:
!! 0014 : 8e00 vs 8f00 - set16 vs set40
!! 0063 : 8e00 vs 8f00 - set16 vs set40
!! 019b : 1706 vs 1701 - jrnc $AR0 vs jrl $AR0
!! 01bf : 0297 vs 0290 - jc 0x01dc vs jge 0x01dc
!! 01d2 : 0297 vs 0290 - jc 0x01dc vs jge 0x01dc
Hermes has the remaining failures:
!! 027b : 03c0 vs 03a0 - andcf $AC1.M, #0x8000 vs andf $AC1.M, #0x8000
!! 027d : 029d vs 0294 - jlz 0x027a vs jnz 0x027a
2022-06-14 04:46:03 +00:00
|
|
|
s16
|
2009-04-18 11:31:37 +00:00
|
|
|
mrr $r0d, $r1c
|
|
|
|
mrr $r0d, $r1e
|
|
|
|
clr $acc0
|
|
|
|
mrr $r1e, $r0d
|
|
|
|
mrr $r1c, $r0d
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
rti
|
2017-05-20 00:07:26 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
lri $acl0, #0x0005
|
|
|
|
jmp irq
|
|
|
|
irq6:
|
|
|
|
lri $acl0, #0x0006
|
|
|
|
jmp irq
|
|
|
|
irq7:
|
|
|
|
lri $acl0, #0x0007
|
|
|
|
jmp irq
|
2017-05-20 00:07:26 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
irq:
|
|
|
|
lrs $ACL1, @DMBH
|
2009-04-18 12:27:24 +00:00
|
|
|
andcf $acl1, #0x8000
|
|
|
|
jlz irq
|
2009-04-18 11:31:37 +00:00
|
|
|
si @DMBH, #0x8BAD
|
|
|
|
sr @DMBL, $r0b
|
2017-05-20 00:07:26 +00:00
|
|
|
;sr @DMBL, $acl0
|
2009-04-18 11:31:37 +00:00
|
|
|
si @DIRQ, #0x0001
|
|
|
|
halt
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
send_back:
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
; 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
|
2017-05-20 00:07:26 +00:00
|
|
|
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
lri $r18, #0x0000
|
|
|
|
lri $r19, #1 ;(DSP_CR_IMEM | DSP_CR_TO_CPU)
|
|
|
|
lri $r1a, #0x200
|
|
|
|
lr $r1c, @MEM_HI
|
|
|
|
lr $r1e, @MEM_LO
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
lri $r01, #8+8
|
2017-05-20 00:07:26 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
bloop $r01, dma_copy
|
|
|
|
call do_dma
|
|
|
|
addi $r1e, #0x200
|
|
|
|
mrr $r1f, $r18
|
|
|
|
addi $r1f, #0x100
|
|
|
|
mrr $r18, $r1f
|
|
|
|
nop
|
|
|
|
dma_copy:
|
|
|
|
nop
|
2017-05-20 00:07:26 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
call wait_for_dsp_mbox
|
|
|
|
si @DMBH, #0x8888
|
|
|
|
si @DMBL, #0xfeeb
|
|
|
|
si @DIRQ, #0x0001
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
; wait for answer before we execute the next op
|
2009-04-18 11:31:37 +00:00
|
|
|
call wait_for_cpu_mbox
|
|
|
|
lrs $ACL0, @CMBL
|
|
|
|
andi $acl1, #0x7fff
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
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
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
UnitTests: Update DSP test text for old renames
This change makes assembling DSPTestText match DSPTestBinary, though HermesText doesn't yet match HermesBinary.
The test data was originally added on April 18, 2009 in e7e4ef4481d1c5dcce6463414d815843ae15b8e2. Then, set16 and set40 were swapped on April 22, 2009 89178f411cf1e8ef61b005197545618e53a0d4e8, which updated the DSPSpy version of dsp_code, but not the version in DSPTool used for testing. So, when the test was made, the assembled data matched the text, but a few days after it no longer did.
Similarly, on Jul 7, 2009 in 1654c582ab9a6323a31802c4b241c0cffc9d3bca the conditional instructions were adjusted, and 0x1706 was changed from JRL to JRNC and 0x0297 was changed from JGE to JC.
For what it's worth, devkitPro made the same changes on May 31, 2010 in https://github.com/devkitPro/gamecube-tools/commit/8a65c85c9b4748ed3dab3c0c85aeb0df95d58cfb and updated their version of the asnd ucode (which is this ucode) on June 11, 2011 in https://github.com/devkitpro/libogc/commit/b1b8ecab3af3745c8df0b401abd512bdf5fcc011 (though this update also includes other feature changes). Note that at the time, they didn't reassemble the ucode unless they made changes to it; the assembled was stored in the repo until https://github.com/devkitPro/libogc/compare/bfb705fe1607a3031d18b65d603975b68a1cffd4~...d20f9bdcfb43260c6c759f4fb98d724931443f93.
This fixes the following failures with Hermes:
!! 0015 : 8e00 vs 8f00 - set16 vs set40
!! 016f : 8e00 vs 8f00 - set16 vs set40
and with Hermes:
!! 0014 : 8e00 vs 8f00 - set16 vs set40
!! 0063 : 8e00 vs 8f00 - set16 vs set40
!! 019b : 1706 vs 1701 - jrnc $AR0 vs jrl $AR0
!! 01bf : 0297 vs 0290 - jc 0x01dc vs jge 0x01dc
!! 01d2 : 0297 vs 0290 - jc 0x01dc vs jge 0x01dc
Hermes has the remaining failures:
!! 027b : 03c0 vs 03a0 - andcf $AC1.M, #0x8000 vs andf $AC1.M, #0x8000
!! 027d : 029d vs 0294 - jlz 0x027a vs jnz 0x027a
2022-06-14 04:46:03 +00:00
|
|
|
send_back_40:
|
2017-05-20 00:07:26 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
cw 0x8e00
|
2017-05-20 00:07:26 +00:00
|
|
|
call send_back
|
2009-04-18 11:31:37 +00:00
|
|
|
cw 0x8f00
|
2017-05-20 00:07:26 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
ret
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
dump_memory:
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
lri $r02, #0x0000
|
|
|
|
lri $acl0, #0x1000
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
lri $r01, #0x1000
|
|
|
|
bloop $r01, _fill_loop2
|
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
mrr $r03, $acl0
|
|
|
|
cw 0x80f0
|
2017-05-20 00:07:26 +00:00
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
mrr $r1f, $r00
|
|
|
|
mrr $r00, $r02
|
|
|
|
srri @$r00, $r1b
|
|
|
|
mrr $r02, $r00
|
|
|
|
mrr $r00, $r1f
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
addis $AC0.M, #0x1
|
|
|
|
|
2009-04-18 11:31:37 +00:00
|
|
|
_fill_loop2:
|
|
|
|
nop
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2017-05-20 00:07:26 +00:00
|
|
|
|
|
|
|
ret
|
2017-05-20 00:36:04 +00:00
|
|
|
)";
|