ReadInt PROC
Reads a 32-bit signed decimal integer from
standard input, stopping when the Enter key is pressed.
All valid digits occurring before a non-numeric
character are converted to the integer value.
Leading spaces are ignored, and an optional
leading + or - sign is permitted.
ReadInt will display an error message, set the
Overflow flag, and reset EAX to zero if the value entered cannot be
represented as a 32-bit signed integer.
Call args: None
Return args: If OF=0, EAX = valid binary value, and SF=sign.
If OF=1, EAX = 0 (invalid input)
Example:
.data
intNum DWORD ?
promptBad BYTE "Invalid input, please enter again",0
.code
read: call ReadInt
jno goodInput
mov edx,OFFSET promptBad
call WriteString
jmp read ;go input again
goodInput:
mov intNum,eax ;store good value
Notes: To read an unsigned integer, use the ReadDec procedure.| Converted from CHM to HTML with chm2web Pro 2.85 (unicode) |