This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

汇编语言转化,IAR到CCS



大家好,最近做一个血氧仪,基于ti的参考设计。

TI的源码中有一段汇编语言,平台是iar,因为用习惯了ccs,想转化到ccs平台。

不过没有学过汇编,没能做到。

请问大家能给点指导吗?谢谢!

IAR代码如下:

//*****************************************************************************
//16x16=>32 multiply
//int32_t mul16(register int16_t x, register int16_t y)

// Use with IAR versions >= 4.0
public mul16

RSEG CODE
mul16

#define x1 r9
#define z0 r14
#define z1 r15
#define x r12
#define y r13

push r9

clr z0
mov z0,z1
mov z0,x1
tst x
jge xbooth_2
mov #-1,x1
jmp xbooth_2

xbooth_6
add x,z1
addc x1,z0
xbooth_1
rla x
rlc x1
xbooth_2
rra y
jc xbooth_5
jne xbooth_1
jmp xbooth_4

xbooth_5
sub x,z1
subc x1,z0
xbooth_3
rla x
rlc x1
rra y
jnc xbooth_6
cmp #0FFFFh,y
jne xbooth_3

xbooth_4
mov z1,r12
mov z0,r13

pop r9

ret
end