dolphin/Source/DSPSpy/tests/mul_test.ds
Pokechu22 51c26d82a5 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.
2021-08-22 10:49:46 -07:00

252 lines
3.7 KiB
Plaintext

; This test checks the effect of SET15 on multiplications.
incdir "tests"
include "dsp_base.inc"
; Results are in capitals like this: UNSIGNED
test_main:
CLR15
; Test MULXMVZ - SET15
CLR $ACC0
CLRP
LRI $AX0.L, #0xFFFF
LRI $AX1.H, #0x100
MULXMVZ $AX0.L, $AX1.H, $ACC0 ; SIGNED
MOVP $ACC0
call send_back
CLR $ACC0
CLRP
SET15
LRI $AX0.L, #0xFFFF
LRI $AX1.H, #0x100
MULXMVZ $AX0.L, $AX1.H, $ACC0 ; UNSIGNED
MOVP $ACC0
call send_back
CLR15
; Test MULXMV - SET15
CLR $ACC0
CLRP
LRI $AX0.L, #0xFFFF
LRI $AX1.H, #0x100
MULXMV $AX0.L, $AX1.H, $ACC0 ; SIGNED
MOVP $ACC0
call send_back
CLR $ACC0
CLRP
SET15
LRI $AX0.L, #0xFFFF
LRI $AX1.H, #0x100
MULXMV $AX0.L, $AX1.H, $ACC0 ; UNSIGNED
MOVP $ACC0
call send_back
CLR15
; Test MULXAC - SET15
CLR $ACC0
CLRP
LRI $AX0.L, #0xFFFF
LRI $AX1.H, #0x100
MULXAC $AX0.L, $AX1.H, $ACC0 ; SIGNED
MOVP $ACC0
call send_back
CLR $ACC0
CLRP
SET15
LRI $AX0.L, #0xFFFF
LRI $AX1.H, #0x100
MULXAC $AX0.L, $AX1.H, $ACC0 ; UNSIGNED
MOVP $ACC0
call send_back
CLR15
; Test MULX - SET15
CLR $ACC0
CLRP
LRI $AX0.L, #0xFFFF
LRI $AX1.H, #0x100
MULX $AX0.L, $AX1.H ; SIGNED
MOVP $ACC0
call send_back
CLR $ACC0
CLRP
SET15
LRI $AX0.L, #0xFFFF
LRI $AX1.H, #0x100
MULX $AX0.L, $AX1.H ; UNSIGNED
MOVP $ACC0
call send_back
CLR15
; Test MADDX - SET15
CLR $ACC0
CLRP
LRI $AX0.L, #0xFFFF
LRI $AX1.L, #0x100
MADDX $AX0.L, $AX1.L ; SIGNED
MOVP $ACC0
call send_back
CLR $ACC0
CLRP
SET15
LRI $AX0.L, #0xFFFF
LRI $AX1.L, #0x100
MADDX $AX0.L, $AX1.L ; SIGNED (!)
MOVP $ACC0
call send_back
CLR15
; Test MULC - SET15
CLR $ACC0
CLRP
LRI $AC0.M, #0xFFFF
LRI $AX0.H, #0x100
MULC $AC0.M, $AX0.H ; SIGNED
MOVP $ACC0
call send_back
CLR $ACC0
CLRP
SET15
LRI $AC0.M, #0xFFFF
LRI $AX0.H, #0x100
MULC $AC0.M, $AX0.H ; SIGNED (!)
MOVP $ACC0
call send_back
CLR15
; Test MULCAC - SET15
CLR $ACC0
CLRP
LRI $AC0.M, #0xFFFF
LRI $AX0.H, #0x100
MULCAC $AC0.M, $AX0.H, $ACC0 ; SIGNED
MOVP $ACC0
call send_back
CLR $ACC0
CLRP
SET15
LRI $AC0.M, #0xFFFF
LRI $AX0.H, #0x100
MULCAC $AC0.M, $AX0.H, $ACC0 ; SIGNED (!)
MOVP $ACC0
call send_back
CLR15
; Test MUL - SET15
CLR $ACC0
CLRP
LRI $AX0.L, #0xFFFF
LRI $AX0.H, #0x100
MUL $AX0.L, $AX0.H ; SIGNED
MOVP $ACC0
call send_back
CLR $ACC0
SET15
LRI $AX0.L, #0xFFFF
LRI $AX0.H, #0x100
MUL $AX0.L, $AX0.H ; SIGNED (!)
MOVP $ACC0
call send_back
CLR15
; Test MULAC - SET15
CLR $ACC0
CLRP
LRI $AX0.L, #0xFFFF
LRI $AX0.H, #0x100
MULAC $AX0.L, $AX0.H, $ACC0 ; SIGNED
MOVP $ACC0
call send_back
CLR $ACC0
SET15
LRI $AX0.L, #0xFFFF
LRI $AX0.H, #0x100
MULAC $AX0.L, $AX0.H, $ACC0 ; SIGNED (!)
MOVP $ACC0
call send_back
CLR15
; We're done, DO NOT DELETE THIS LINE
jmp end_of_test
; test accelerator
; TODO: DSPSpy puts a 16-bit ramp at 0x10000000
LRIS $AC1.M, #0x0a ; 16-bit PCM audio
;SRS @SampleFormat, $AC1.M
; Start accelerator position
LRI $AC1.M, #0x0100
SRS @ACCAH, $AC1.M
LRI $AC1.M, #0x1000
SRS @ACCAH, $AC1.M
; Current accelerator position
LRI $AC1.M, #0x0100
SRS @ACCAH, $AC1.M
LRI $AC1.M, #0x1000
SRS @ACCAH, $AC1.M
; End accelerator position
LRI $AC1.M, #0x0100
SRS @ACCAH, $AC1.M
LRI $AC1.M, #0x2000
SRS @ACCAH, $AC1.M
; Now to the interesting parameter - gain.
LRI $AC1.M, #0xFFFF
SRS @GAIN, $AC1.M
; Let's now load a sample through the accelerator.
LRS $AC1.M, @ARAM
call send_back
jmp end_of_test
; test addpaxz
call send_back
clrp
lri $AX0.L, #0x1111
lri $AX0.H, #0x2222
call send_back
clrp
addpaxz $ACC0, $AX0.H
call send_back
clrp
set40
addpaxz $ACC0, $AX0.H
set16
call send_back
clrp
set15
addpaxz $ACC0, $AX0.H
clr15
call send_back
jmp end_of_test