DSPSpy: Require user to specify a test_main label

This makes the point where execution starts more obvious compared to a start_of_test label at the end of the include, and allows putting other functions at the start of the file.  This change also modifies the existing tests to build with this change.
This commit is contained in:
Pokechu22 2021-08-15 15:26:03 -07:00
parent 5f7c852d22
commit 51c26d82a5
16 changed files with 26 additions and 17 deletions

View File

@ -1,6 +1,8 @@
incdir "tests"
include "dsp_base.inc"
test_main:
; Test parameters
lri $AC0.M, #0x0000 ; start
lri $AC0.L, #0x0000 ; start

View File

@ -2,7 +2,6 @@
; See https://github.com/dolphin-emu/dolphin/pull/5997
incdir "tests"
include "dsp_base.inc"
jmp test_main
; Writes the passed format, start and end addresses to the accelerator registers,
; then reads them back to registers.

View File

@ -5,7 +5,7 @@ include "dsp_base.inc"
;
; 3d80 andc'ls $AC1.M : $AX0.L, $AC0.M
test_main:
clr $ACC0
clr $ACC1
lri $AX0.L, #0x0000
@ -14,7 +14,7 @@ include "dsp_base.inc"
lri $AC0.M, #0x0004
lri $AC1.M, #0x1234
andc'ls $AC1.M : $AX0.L, $AC0.M
cw 0x3d80 ; andc'ls $AC1.M : $AX0.L, $AC0.M
call send_back

View File

@ -2,6 +2,8 @@
incdir "tests"
include "dsp_base.inc"
test_main:
clr $acc0
tst $acc0

View File

@ -12,6 +12,7 @@ TEST_ADDR: equ 0xFFA0 ; 0x0000
TEST_MEM: equ 0x00A0 ; 0x0000
TEST_MEM_2: equ 0x01A0 ; 0x0100
test_main:
LRI $AC0.L, #0xf00f
SR @TEST_REG, $AC0.L
SR @TEST_MEM, $AC0.L

View File

@ -27,6 +27,7 @@ include "dsp_base.inc"
; And thus it's tricky to implement in software too :p
; test using indexing register 1 - 0 is used in send_back
test_main:
lri $AR1, #16
lri $IX1, #32
lri $WR1, #0

View File

@ -97,7 +97,7 @@ ORG 0x10
lrri $ac1.m, @$ar0
lr $ar0, @REGS_BASE
jmp start_of_test
jmp test_main
; This is where we jump when we're done testing, see above.
; We just fall into a loop, playing dead until someone resets the DSP.
@ -281,6 +281,3 @@ dma_copy:
lr $sr, @(REGS_BASE+19)
ret ; from send_back
; Obviously this must be included directly before your test code
start_of_test:

View File

@ -6,13 +6,14 @@ include "dsp_base.inc"
; We can call send_back at any time to send data back to the PowerPC.
lri $AC0.M, #0x1000
call send_back
test_main:
lri $AC0.M, #0x1000
call send_back
set40
lri $AC0.M, #0x1000
set16
call send_back
set40
lri $AC0.M, #0x1000
set16
call send_back
; We're done, DO NOT DELETE THIS LINE
jmp end_of_test
jmp end_of_test

View File

@ -30,7 +30,7 @@ include "dsp_base.inc"
; I really don't know how the above could possibly be efficiently implemented in hardware.
; And thus it's tricky to implement in software too :p
test_main:
; test using indexing register 1 - 0 is used in send_back
lri $AR1, #16
lri $IX1, #32

View File

@ -2,6 +2,7 @@
incdir "tests"
include "dsp_base.inc"
test_main:
lri $AR0, #0x001c
lri $AR1, #0x001d
lri $AR2, #0x001e

View File

@ -1,6 +1,7 @@
incdir "tests"
include "dsp_base.inc"
test_main:
CLR $acc0
CLR $acc1
LRI $ac0.h, #0x0050

View File

@ -2,8 +2,9 @@
incdir "tests"
include "dsp_base.inc"
; Results is in capitails like this: UNSIGNED
; Results are in capitals like this: UNSIGNED
test_main:
CLR15
; Test MULXMVZ - SET15

View File

@ -2,6 +2,7 @@
incdir "tests"
include "dsp_base.inc"
test_main:
clr $ACC0
neg $ACC0

View File

@ -10,6 +10,7 @@ include "dsp_base.inc"
// 0x02cb is the same opcode, but arithmetic.
// We'll call it asrn, no arguments.
test_main:
clr $ACC0
clr $ACC1
lri $AC0.H, #0

View File

@ -1,6 +1,7 @@
incdir "tests"
include "dsp_base.inc"
test_main:
; Test what happens various values are written to every register
LRI $ar0, #0xffff
CALL set_all_regs

View File

@ -2,7 +2,7 @@ incdir "tests"
include "dsp_base.inc"
; Reads regs from 0xFF80 to 0xFF8D and sends them back
test_main:
lr $AC0.M, @0xff80
call send_back