Author Topic: Jump Instructions  (Read 3734 times)

nobody

  • Guest
Jump Instructions
« on: June 21, 2007, 07:51:48 PM »
I entered the following code in nasm version 0.98.39:

BITS 32
        jz h
        add eax,byte +0x4
h       add eax,byte +0x4

Running through 'ndisasm -u' produced this:

00000000  7403              jz 0x5
00000002  83C004            add eax,byte +0x4
00000005  83C004            add eax,byte +0x4

Is that right that a jump three bytes forward should be 'jz 0x5'?

I then ran that output through nasm and disassembled the output:

00000000  0F84FFFFFFFF      jz dword 0xffffffff
00000006  83C004            add eax,byte +0x4
00000009  83C004            add eax,byte +0x4

It doesn't seem to be correct.

My question is, how do I write a 'jz' instruction that jumps three bytes forward using a one byte immediate.

Thanks,
Edwin

nobody

  • Guest
Re: Jump Instructions
« Reply #1 on: June 21, 2007, 07:59:59 PM »
Some additional information.

I expected this to work:

jz short 3

but I get:

c.asm:2: error: short relative jump outside segment

nobody

  • Guest
Re: Jump Instructions
« Reply #2 on: June 21, 2007, 11:26:17 PM »
jz $ + 3

Best,
Frank