Zorgiev
Zorgiev

Reputation: 814

Unable to perform near conditional jump in MASM

Please adbice, I'm beating my head against the wall the whole day: What is wrong with this code? Whu MASM gives errors?

LookupLoop:
        and ecx, edx
        movzx   ecx, word ptr [edi + ecx*2]
        cmp ecx, ebp
        lea ebx, LeaveNowProxy
       js ebx ;;;This is it. Here it fails.
        jmp LeaveNowProxyEnd
 LeaveNowProxy:
        jmp LeaveNow
 LeaveNowProxyEnd:
 LoopEntry:  movzx   eax, word ptr [esi + ecx - 1]
         cmp eax, ebx

It says: >....\masmx86\match686.asm(357): error A2077: instruction does not allow NEAR indirect addressing. I tried to lea to register and then pass the register, then I have done this proxy jump, then i tried js cs:ebx sythax. Everythime i get almost the smae error.

Upvotes: 0

Views: 872

Answers (2)

Seva Alekseyev
Seva Alekseyev

Reputation: 61361

Replace

lea ebx, LeaveNowProxy
js ebx

with

js LeaveNowProxy

Upvotes: 3

I don't believe that register-based conditional jumps are supported.

Instead you can try

  jns skip
  jmp ebx
skip:

Upvotes: 4

Related Questions