MSP430 Assembly Language Pythagorean Theorem HELP!

The problem statement given is this:
Write a PUBLIC function in MSP430 assembly that implements the
Pythagorean theorem A^2 + B^2 = C^2.
Make A and B 16bit
integers. What size should you make C? Your function must
use the HW multiplier's multiply and accumulate feature. Also write a brief main
in either C or assembly which first assigns values to A and B and then calls your
function. Your main does not have to display the results but explain where and
how C is stored.

So far I have this:

NAME HW62
PUBLIC pytha
ORG 0200h

A DS16 1
B DS16 1
C DS16 1
AA DS32 1
BB DS32 1
CC DS32 1

ORG 0FFFEh
RSEG CODE
DW pytha
Pytha MOV #0xA00, SP
CLR R4
CLR R5
CLR R6
DINT
MOV A, MPY
MOV A, OP2
NOP
MOV RESLO, AA(R4)
INCD R4
MOV RESHI, AA(R4)
MOV B, MPY
MOV B, OP2
NOP
MOV RESLO, BB(R5)
INCD R5
MOV RESHI, BB(R5)
ADD AA, BB
MOV BB, CC



This uses the hardware multiplier to multiply A by itself and B by itself, adds the two results together and places the result in CC. My problem is I don't know how to extract simply C. There is no function in MSP430 Assembly that does square roots as far as I know. Could someone help please?
 

The Physics Forums Way

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top