flat assembler
Message board for the users of flat assembler.

Index > Main > Difference between je and jz.

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1766
Roman 15 Jul 2022, 02:04
Why exist je and jz?
I always using jz or Jnz.
Post 15 Jul 2022, 02:04
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 15 Jul 2022, 02:12
Same encoding. No difference whatsoever.
Post 15 Jul 2022, 02:12
View user's profile Send private message Visit poster's website Reply with quote
I



Joined: 19 May 2022
Posts: 58
I 15 Jul 2022, 02:37
One has an 'e' the other a 'z' :p

Comparing 2 registers if they are equal by subtraction results in zero flag being set if so.

With AND operator 2 AND 2 while equal is not zero, it's 2. So je will fail because it's really zero flag check. e can sound illogical sometimes, IMO!

Edit: Replaced 'numbers' with 'registers' because if for example eax represents a signed number such as -2 and ebx an unsigned number 4,294,967,294 cmp eax,ebx will set the zero flag and je will jump


Last edited by I on 15 Jul 2022, 05:26; edited 1 time in total
Post 15 Jul 2022, 02:37
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4020
Location: vpcmpistri
bitRAKE 15 Jul 2022, 03:17
I tend to use Z because the flag is the Z-flag; and the letter E is already too common. It's just personal preference though.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 15 Jul 2022, 03:17
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 15 Jul 2022, 04:10
Code:
cmp eax,ebx
je foo ; are eax & ebx equal?

dec ecx
jz foo ; is ecx zero?    
Post 15 Jul 2022, 04:10
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1766
Roman 15 Jul 2022, 04:38
I reading je op code = jz
And je the same as jz
Post 15 Jul 2022, 04:38
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 926
Location: Russia
macomics 15 Jul 2022, 04:47
I would have asked something more interesting. For example: the difference between jp (parity, efl.pf = 1) and jpe (parity even, efl.pf = 1) or jnp (not parity, efl.pf = 0) and jpo (parity odd, efl.pf = 0) or jnb (not below, efl.cf = 0) and jnc (not carry, efl.cf = 0) and jae (above and equal, efl.cf = 0). It is exactly the same as between je (equal, efl.zf = 1) and jz (zero, efl.zf = 1).

ADD: Better study the difference between jae (above and equal, efl.cf = 0) and jge (greater and equal, efl.sf xor efl.of = 0)
Post 15 Jul 2022, 04:47
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1619
Location: Toronto, Canada
AsmGuru62 16 Jul 2022, 23:34
revolution is right: JE/JZ used for readability of the source, but it is a same instruction.
Post 16 Jul 2022, 23:34
View user's profile Send private message Send e-mail Reply with quote
I



Joined: 19 May 2022
Posts: 58
I 18 Jul 2022, 01:22
Same
Code:
ja      jnbe
jb      jnae
jna     jbe
jnb     jae

jz      je
jnz     jne

jg      jnle
jl      jnge
jng     jle
jnl     jge    
Post 18 Jul 2022, 01:22
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.