News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

jnz to offset problem

Started by ragdog, July 31, 2008, 01:11:47 PM

Previous topic - Next topic

ragdog

Hi

I have a small problem!


with the call works perfect,why noz with this jnz jump?


. Data
Proc1 dd 0049E103h
Lable1 dd 005438DDh
Call dword ptr [Proc1]; Works
..
..
jnz dword ptr [Lable1]; Works not

I get this error message, error A2077: instruction does not allow NEAR indirect addressing

have your an idea?

greets,
ragdog

FORTRANS

Hi,

   Basically, what the error message says.  A CALL can have
different forms.

It can CALL with an offset (direct)
It can CALL using a value in a register or memory (indirect)
It can CALL using an absolute value.

   But a conditional jump can only be done using an offset.
So the JNZ instruction does not allow indirect addressing.

Greets,

Steve N.

PBrennick

This is an untested idea -- you might be able to put that pointer into a variable and to something like

jnz eax

The reason this might work is because the address is resolved by putting it into a variable and then becomes a direct branch.

Let me know if it works.

-- Paul
The GeneSys Project is available from:
The Repository or My crappy website

ragdog

hi

I have with this way solved!

       jnz    @F
       ...
       ..
       .
@@:
       jmp dword ptr [Lable1]

greets

Tedd

The conditional jumps only allow an 8-bit displacement, so if you want anything different (larger displacement, direct address, indirect address, etc) the best you can do is jcc to another jmp that goes where you really want.

(Which is what you did :wink)
No snowflake in an avalanche feels responsible.

FORTRANS

   Actually, since the 386 the displacement can be 16 or 32 bits for Jcc (Jump
condition code).  LOOP and JCXZ seem to remain 8 bit.

Regards,

Steve N.