News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

How do you use AND OR NOT for masm

Started by setonai, April 15, 2011, 10:08:19 AM

Previous topic - Next topic

setonai

I'm trying to make a conditional statement for my input to only accept the values between 0-9,
Is it possible to use the OR  or AND, if so how would i apply it ?

i had a idea of using a bunch of compare but that would be too messy to go about

dedndave

if the ASCII input character is in AL...
        sub     al,30h
        cmp     al,9
        ja      not_numeric


or you can use XOR, instead
        xor     al,30h
        cmp     al,9
        ja      not_numeric

BogdanOntanu

or you could use high level constructs in order to make code more readable


.if al >= '0' && al <= '9'
  ; this is an numerical digit
.else
  ; this is not an numerical digit
.endif


logical AND is &&
logical OR is ||
logical NOT is !

This is similar to C programming language.
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro