Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Short jump out of range

Tags:

nasm

I m having a problem with my loop, the code contained in it is long and it gives me error "short jump out of range", so i want to know if there is a way to make the loop work by not reducing the amount of code in it ?

example1:

label:
my code
    LOOP label

; It work fine but when I add more code in it

example2:

label:
my code
    more code added
    LOOP label

; It does not work and error appears "short jump out of range"

like image 569
ibimed Avatar asked Aug 27 '12 05:08

ibimed


1 Answers

The LOOP instruction can't jump to a distance of more than 127 bytes. You'll need to change your code to use DEC ECX with JNZ instructions.

For example:

    MOV ECX, 10
label:
    ;some codes
    LOOP label

Become:

    MOV ECX, 10
label:
    ;some codes
    DEC ECX
    JNZ label
like image 132
Jay Avatar answered Sep 28 '22 04:09

Jay