Is it posible to do signed comparisons with masm's high level control structures?
Posted on 2006-03-21 16:15:26 by Odyssey
Odyssey,
Is it posible to do signed comparisons with masm's high level control structures?

?  ?  ? Yes, indeed it is.?  From the MASM Programmer's Guide, Chapt 7.?  Ratch

http://webster.cs.ucr.edu/Page_TechDocs/MASMDoc/


Signed and Unsigned Operands

Expression operators generate unsigned jumps by default. However, if either side of the operation is signed, the assembler considers the entire operation signed.




You can use the PTR operator to tell the assembler that a particular operand in a register or constant is a signed number, as in these examples:

?  ?  ?  ?  .WHILE?  SWORD PTR <= 0
?  ?  ?  ?  .IF?  ?  ? SWORD PTR mem1 >?  0




Without the PTR operator, the assembler would treat the contents of BX as an unsigned value.


You can also specify the size attributes of operands in memory locations with SBYTE, SWORD, and SDWORD, for use with .IF, .WHILE, and .REPEAT.

?  ?  ?  ?  .DATA
mem1?  ?  SBYTE?  ? ?
mem2?  ?  WORD?  ?  ?
?  ?  ?  ?  .IF?  ?  ? mem1 > 0
?  ?  ?  ?  .WHILE?  mem2 < bx
?  ?  ?  ?  .WHILE?  SWORD PTR ax < count

Posted on 2006-03-21 20:09:56 by Ratch
Thanks, seems i didn't search in the right place in the documentation.
Posted on 2006-03-22 06:49:37 by Odyssey