hippy
Ex-Staff (retired)
temp = $FFFF - Result + 1
temp = $FFFF - ELine + 1
Why not ... ?
temp = -Result
temp = -Eline
Your problem is that #Macro replaces its named parameters with the arguments passed in. Your 'word1' and 'word2' are parameters not local variables, not the variables you have defined elsewhere. Your macro call ...
MultiplySigned(ELine,KpELine)
expands to ...
You can probably see why your variables are having their signs changed.
Moral is; never give your #Macro parameter names which are used elsewhere in the program. Change them to arg1 and arg2 and that will probably help.
temp = $FFFF - ELine + 1
Why not ... ?
temp = -Result
temp = -Eline
Your problem is that #Macro replaces its named parameters with the arguments passed in. Your 'word1' and 'word2' are parameters not local variables, not the variables you have defined elsewhere. Your macro call ...
MultiplySigned(ELine,KpELine)
expands to ...
Code:
sign = positive
if ELine >= $8000 then
sign = NOT sign
ELine = -ELine
endif
if KpELine >= $8000 then
sign = NOT sign
KpELine = -KpELine
endif
Result = ELine * KpELine
if sign = negative then
Result = -Result
endif
Moral is; never give your #Macro parameter names which are used elsewhere in the program. Change them to arg1 and arg2 and that will probably help.