I have a piece of code which uses JNZ. When I assemble and link the binary, I see my JNZ is replaces with a JNE. I understand that both of them fundamentally are the same. But then why does NASM change it?
Also, is there any config option available to stop this change from happening while assembling?
I understand that both of them fundamentally are the same
JNE
and JNZ
have the same opcodes (0x75
for short jumps and 0x0f 0x85
for near jumps), so the assembler will create the same machine code for both of them.
When disassembling, the disassembler does not known anymore which one was used in the source and it has to take one of them.
Also, is there any config option available to stop this change from happening while assembling?
No, because it is not a real "replacement" - JNE
and JNZ
are simply different mnemonics for the same opcodes.
JNZ
and JNE
have exactly the same encoding (refer to Intel® 64 and IA-32 Architectures Software Developer’s Manual Vol. 2A 3-419). So whichever you use in the assembler, the disassembler would pick one and use the same notation throughout in the disassembled code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With