; 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
