ReadDec PROC
Reads a 32-bit unsigned 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.
Call args: None Return args: If CF=0, EAX = valid binary value, and SF=sign. If CF=1, EAX = 0 input is invalid (blank or larger than 2^32-1). Example: .data decNum DWORD ? promptBad BYTE "Invalid input, please enter again",0 .code read: call ReadDec jnc goodInput mov edx,OFFSET promptBad call WriteString jmp read ;go input again goodInput: mov decNum,eax ;store good valueNotes: To read a signed integer, use the ReadInt procedure.
Converted from CHM to HTML with chm2web Pro 2.85 (unicode) |