High level macro not recognized - Beginner MASM
Question
main proc
finit
.while ang < 91
invoke func, ang
fstp res
print real8$(ang), 13, 10
print real8$(res), 13, 10
fld ang
fld1
fadd
fstp ang
.endw
ret
main endp
What's wrong with this piece of MASM code?
I get an error on .endw
. I have ran some tests to ensure myself of that. Assembler tells me invalid instruction operands
.
Thank you for your time!
Solution
Remember that masm is a "typed" assembly language. And it looks like ang is defined as a real.
Problem is, ".while" generate a cmp instruction followed by a conditional jump. And a cmp instruction takes some integer value from either a reg or memory, but certainly not a real. Thus the "invalid instruction operand" error.
The reason this happens in the .endw is most likely because the .while / .endw construct generates its test at the bottom of the loop rather than at the beginning.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow