Question about jumps
- From: Markus Pitha <ngNOSPAM@xxxxxxxxxx>
- Date: Sun, 27 Aug 2006 11:43:44 +0200
Hello,
I tried to program a simple if...else, but when the expression is TRUE,
the program executes both the if branch and the else branch, so it jumps
back to the jz call and executes the else branch too? Why is this so and
how can I solve this?
segment .data
successmsg db "eax is set to 1.", 0, 10
errmsg db "eax is not 1.", 0, 10
succlen equ $-successmsg
errlen equ $-errmsg
global _start
_start:
mov eax, 1
cmp eax, 1
jz thenblock ;if ZF is set -> thenblock
mov eax, 4
mov ebx, 1
mov ecx, errmsg
mov edx, errlen
int 0x80
jmp next
thenblock:
mov eax, 4
mov ebx, 1
mov ecx, successmsg
mov edx, succlen
int 0x80
next:
mov eax, 1
int 0x80
.
- Follow-Ups:
- Re: Question about jumps
- From: Evenbit
- Re: Question about jumps
- From: rhyde
- Re: Question about jumps
- From: Herbert Kleebauer
- Re: Question about jumps
- From: Frank Kotler
- Re: Question about jumps
- Prev by Date: Re: beginner, explanation help with output
- Next by Date: Re: Question about jumps
- Previous by thread: a strange error
- Next by thread: Re: Question about jumps
- Index(es):
Relevant Pages
|