4

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"

0

Have you tried with near instruction?

|improve this answer|||||
7

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 loop
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.