NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: nobody on December 01, 2008, 05:14:35 PM

Title: 2.04rc1 and 2.04rc2 - conditional jumps probl
Post by: nobody on December 01, 2008, 05:14:35 PM
Hi,

The opcodes of conditional jump and call instructions have changed between those version. My question is: why? I couldn't find any answer for that question. The problem is that my bootsector code (16bit Real Mode), which runs perfectly when compiled with <=2.04rc1, crashes when compiled with >2.04rc1. I've found out with ndisasm that opcodes differ.

Below I present sample output showing differences (on the left column: 2.04; on the right column: 2.04rc1):

0F82F8FF    jc word 0x15    |    72FA    jc 0x15
0F85E9FF    jnz word 0x4b    |    75ED    jnz 0x49

Why those opcodes differ? Why those from 2.04 lead to crash?


Regards,
aidecoe
Title: Re: 2.04rc1 and 2.04rc2 - conditional jumps probl
Post by: Frank Kotler on December 01, 2008, 07:23:31 PM
Short answer: "bug". Actually, just a change in the default behavior - it "shouldn't" crash. (but if it does, it does).

Adding the "-O" switch "should" fix it, but your best bet is to dump that and get the latest version. 2.06rc1 has just been released - available at:

http://www.nasm.us (http://www.nasm.us)

I'll have it up here... later today... or tomorrow... (remind me if I don't!).

Sorry you had a problem, and thanks for the feedback!

Best,
Frank
Title: Re: 2.04rc1 and 2.04rc2 - conditional jumps probl
Post by: nobody on December 01, 2008, 08:36:56 PM
"The opcodes of conditional jump and call instructions have changed between those version."

Correction: just conditional jumps -- not calls.

Thanks for solution. -O2 workaround makes code correct and my boot program runs fine.

I don't fully understand your answer. In 2.06rc1 the bug was fixed or not? I've just tested it and 2.06rc1 still has this problem.


Regards,
aidecoe
Title: Re: 2.04rc1 and 2.04rc2 - conditional jumps probl
Post by: H. Peter Anvin on December 10, 2008, 06:34:48 PM
Looks like the change to make the short forms the default again (0.98-style) didn't actually work when one hard-codes offsets.  aidecoe: could you post a bug report with your code?