IF statement generates weird code with SNZ instruction
eMAN
Posts: 1
Hello,
Ran into a question that has me puzzled...
·
I have a program developed for the SX52 (will be a 48 in production) which compares two 8 bit numbers.· One number is declared a byte the other is·a word.·
·[noparse][[/noparse]see attached "vars"]
·When I code the IF statement I use the _LSB of the word to compare with the byte variable.· Needless to say, the code does not work correctly.· The compare fails when the debugger shows me that the subtract yields a 0 and the zero flag is set.
·[noparse][[/noparse]see attached "Debugger screen"]
The generated code (I'm not an expert in SX .. .yet) seems to be weird.· The SNZ instruction is followed by a page instruction then a jump.· It would appear that the code will not operate correctly.
Can you help me understand this?
Using: IDE 3.2.3, SASM 1.51.07, SXB 1.51.03, SXSim 2.08.05
·
Thanks for your help,
_______________________________
Don Gille
·
Post Edited By Moderator (Chris Savage (Parallax)) : 5/2/2007 9:35:02 PM GMT
Ran into a question that has me puzzled...
·
I have a program developed for the SX52 (will be a 48 in production) which compares two 8 bit numbers.· One number is declared a byte the other is·a word.·
·[noparse][[/noparse]see attached "vars"]
·When I code the IF statement I use the _LSB of the word to compare with the byte variable.· Needless to say, the code does not work correctly.· The compare fails when the debugger shows me that the subtract yields a 0 and the zero flag is set.
·[noparse][[/noparse]see attached "Debugger screen"]
The generated code (I'm not an expert in SX .. .yet) seems to be weird.· The SNZ instruction is followed by a page instruction then a jump.· It would appear that the code will not operate correctly.
Can you help me understand this?
Using: IDE 3.2.3, SASM 1.51.07, SXB 1.51.03, SXSim 2.08.05
·
Thanks for your help,
_______________________________
Don Gille
·
Post Edited By Moderator (Chris Savage (Parallax)) : 5/2/2007 9:35:02 PM GMT
Comments
Post Edited (JonnyMac) : 5/2/2007 9:32:37 PM GMT
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Educate your children to self-control, to the habit of holding passion and prejudice and evil tendencies subject to an upright and reasoning will, and you have done much to abolish misery from their future and crimes from society"
Benjamin Franklin
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·