Question on cmp and jumping 
Author Message
 Question on cmp and jumping

Hi,

    I am learning on my own and I have a question on jumping
If I take a letter say Y and N, without using sub functions with a cmp
statement followed by a jump, if flag is 1 or zero, will it go to the
next interrrupt and disreguard the code or will it execute the code no
matter what the flag state is.

Thank you,

Tom



Sun, 10 Nov 2002 03:00:00 GMT  
 Question on cmp and jumping

Thomas Takacs a crit :

Quote:
> Hi,

>     I am learning on my own and I have a question on jumping
> If I take a letter say Y and N, without using sub functions with a cmp
> statement followed by a jump, if flag is 1 or zero, will it go to the
> next interrrupt and disreguard the code or will it execute the code no
> matter what the flag state is.

> Thank you,

> Tom

mov al, TheChar
cmp al, 'Y'
jne IsItN              ; 'jne' stands for Jump if Not Equal
    ; code that is run if it is Y
    jmp ItIsDone
IsItN:
cmp al 'N'
jne ItIsDone         ; or jmp BadAnswer if you wish to...
   ; code that is run if it is Y
ItIsDone:

"codes that are run if..." are nor run if not...

May be it would be more an evidence for you if i write it with a good "If"
macro:

Mov al, TheChar
If al e 'Y'
       ; code that is run if it is Y
ElseiIf al e 'N'
       ; code that is run if it is Y
End_If

Clear? Bye. betov.



Sun, 10 Nov 2002 03:00:00 GMT  
 Question on cmp and jumping
Thank you, very much for the response, I think I should learn step by step,
before I try short cuts. This language does not seem intuitive, but learned by
messing up.

I will try your suggestions.

Tom



Sun, 10 Nov 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Questions about CMP & SBB instructions

2. Cmp and EAX questions

3. Few questions concerning __cmp__ and __nonzero__

4. Jump...Jump

5. question re: conditional jumps

6. QUESTION: 486 instruction prefetch and branch/jump

7. question re conditional jumps

8. QUESTION: 486 instruction prefetch and branch/jump

9. awkfile like cmp utility in unix

10. cmp.lang.clarion

11. LOGO-L> Logo in CMP

12. ***ANNOUNCEMENT***CMP introducing .18u CMOS***

 

 
Powered by phpBB® Forum Software