News:

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

Help Newbie

Started by shak, September 26, 2005, 05:16:05 AM

Previous topic - Next topic

shak

I am working on my first project in assembler and need some basic help. I have to check the input and insure the characters typed are
digits (i.e., 0,1,2,3,4,5,6,7,8,9). Is there are some command in assembler to check for numeric value? The textbook I have is no help and I tried google w/o results.

Any ideas ?

Help please.

jorgon

Hi Shak

How about this, where the character is contained in the 8-byte register AL:-

CMP AL,'0'            ;see if character is below the character zero
JB >L1                ;yes it is
CMP AL,'9'            ;see if character is above the character nine
JA >L1                ;yes it is
;************************ comes to here if a digit

L1:                   ;comes to here if not a digit
Author of the "Go" tools (GoAsm, GoLink, GoRC, GoBug)

shak

#2
Thanks. Will give it a shot. I was thinking of comparing the ASCII input and checking if the range of digits in the ASCII(digits), but yours is way simpler.


Thank you.