Hello all
A quick question about calling an assembly function from C on a C6713 DSK.
I've already looked at sections 7.3 to 7.5 in http://www.ti.com/lit/ug/spru187o/spru187o.pdf.
I am writing a function to multiply two complex numbers together in assembly, but first I wanted to be able to access two floating point numbers and find the product using the MPYSP instruction.
When I step through my program I can't see the values I thought I passed to my assembly (2.1 and 1.3) in the registers A4 and B4 as expected, I get 1.067869798e+09 and 1.074161254e+09 instead. I don't know what I am doing wrong.
See below for my code.
Many thanks,
Jack
.global _cmplx_mult_sp ;ASM function callable from C _cmplx_mult_sp: ;LDW .D1 A4,A3 ; Load first floating point number? - not sure if this is required ;LDW .D2 B4,A2 ; Load second floating point number? ;NOP 4 MPYSP A4,B4,B3 ; Multiply the two floating point numbers NOP 5 .end
Simplified C code:
extern float cmplx_mult_sp(float x, float y); void main(void) { float test = 0.0, a = 2.1, b = 1.3; test = cmplx_mult_sp(a,b); }