'Intel document and Google both say JA (jump if above) is for unsigned,
'JG (jump if greater) is for signed.
'
'1 is above, AKA greater, than -1. But I get reverse of expected results.
'(( two positives works as expected, for two negatives JA and JG both
' result in "wrong" (also unexpected)))
'
' I missed, or misread, something somewhere.
'
'
'Thanks for useful comments.
'JG (jump if greater) is for signed.
'
'1 is above, AKA greater, than -1. But I get reverse of expected results.
'(( two positives works as expected, for two negatives JA and JG both
' result in "wrong" (also unexpected)))
'
' I missed, or misread, something somewhere.
'
Code:
#compile exe #dim all #if %pb_cc32 #console off #endif function pbmain () as long local hTWin as dword #register none txt.window ("JA vs JG", 100, 100, 30, 30) to hTWin ! mov ebx, -1& ! mov edi, 1& ! cmp ebx, edi ! ja Test_JA_Correct txt.print "Test JA wrong" ! jmp Test_JG Test_JA_Correct: txt.print "Test JA right" Test_JG: ! mov ebx, -1& ! mov edi, 1& ! cmp ebx, edi ! jg Test_JG_Correct txt.print "Test JG wrong" ! jmp Done Test_JG_Correct: txt.print "Test JG right" Done: txt.print txt.print "Done, any key to exit." txt.waitkey$ txt.end end function '
'Thanks for useful comments.
Comment