News:

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

how can I write if there is no input?

Started by shawn, April 09, 2010, 07:48:33 PM

Previous topic - Next topic

shawn

hello it's kind of cmp problem

if eax = 0
we can write
cmp eax,0
ze somewhere

then
there is no input and just hit enter button,
how can I write it?

thank you

oex

inkey "Press a key to continue..."

and I think you mean....

cmp eax, 0
je

not ze :)
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

shawn

I mean how can i write the code for non input

how my code regognize there is no input and jump to exit.

Thank you   :bg

oex

I'm not sure that I understand the question.... I think you need to list more code.... if there is no/null input and either a pointer to the input/null is in eax or the length of input is in eax then

cmp eax, 0
je exit

; There is input so execute code on input here

exit:
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

hutch--

Shawn,

We are not capable of guessing what you are doing wth your code but from the little you have told us its something like this.


  cmp eax, 0
  je exitlabel
  ; other code
.....................
  exitlabel:
    invoke ExitProcess etc ....
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

clive

I think the question is one about no parsable input. With a routine to convert ASCII numbers to a binary value in EAX, perhaps it sets the carry flag if the input is null/void or contains characters other than numbers.

For example sscanf(input, "%d", &number) returns 0 if there is no usable input, 1 if it does, and the value is in 'number'.

  call  getnumber
  jc    failed

  cmp eax,0
  jz  zeroentered

-Clive
It could be a random act of randomness. Those happen a lot as well.