Dear friends,
I've just received my task for microprocessor class. The question given is, R = (A-B) / (A+B). The problem is, I don't know how to display the results in decimal point. (Such, 2 divide by 4 equal to 0.5). I need your help to solve the problem.
Thank you.
Here's the source code I did:
Code:
CR EQU $0D
LF EQU $0A
START ORG $1000
*-----------------------------------------------------------
A LEA AVALUE,A1
MOVE.B #14,D0
TRAP #15
MOVE.B #4,D0
TRAP #15
MOVE.L D1,D2
BEQ ZR
B LEA BVALUE,A1
MOVE.B #14,D0
TRAP #15
MOVE.B #4,D0
TRAP #15
MOVE.L D1,D3
MOVE.L D3,D4
SUB.L D3,D2
MOVE.L D2,D5
ADD.L D2,D4
MOVE.L D4,D6
DIVS.W D6,D5
MOVE.L D5,d1
MOVE.L #3,D0
TRAP #15
AVALUE DC.B 'ENTER THE A VALUE =',0
BVALUE DC.B 'ENTER THE B VALUE =',0
END START