Re: Question about jumps



Markus Pitha wrote:
Hello,

Frank Kotler wrote:

"suclen" includes both strings. Try it like this:

successmsg db "eax is set to 1.", 0, 10
succlen equ $-successmsg
errmsg db "eax is not 1.", 0, 10
errlen equ $-errmsg


You were right, but now I'm totally confused. What has the definition
order to do with the program execution?

Nothing. Your program is executing fine - it isn't skipping back and printing the "else: section at all. It isn't a question of what order, but how you're defining the length of the string. The "$ - msg" expression needs to immediately follow what it's calculating the length of. The "write" function does *not* terminate on a zero - that's more of a "C thing" - but writes the full length you say - whatever it might be.

If it *did* terminate on the zero, you wouldn't get the linefeed (10). And yeah, you need that "section .text". Herbert doesn't miss much!

Best,
Frank
.



Relevant Pages

  • Re: Question about jumps
    ... Markus Pitha wrote: ... the program executes both the if branch and the else branch, ... succlen equ $-successmsg ... errlen equ $-errmsg ...
    (alt.lang.asm)
  • Re: Question about jumps
    ... Frank Kotler wrote: ... succlen equ $-successmsg ... errlen equ $-errmsg ... order to do with the program execution? ...
    (alt.lang.asm)