Click to See Complete Forum and Search --> : Label issue


Bluefox815
September 11th, 2008, 12:48 AM
I am having an issue in programs using the jmp, je, etc. instructions. In very large programs, a jmp instruction placed far from the label I wish to jump to causes a compile-time error stating that the local address is out of range (or something similar). I'm using TASM 5.0, is there any way that I can fix this without using a midpoint label to reach all the way to the label I want?

example of midpoint label (what I don't want to do)

start:
...
start_m: ; Here, the label is in range
jmp start
...
jmp start_m ; Here, the label is out of range

Hobson
September 11th, 2008, 07:41 AM
Are you using 16-bit or 32-bit ersion of TASM? On 16-bit platforms, jumps (especially conditional ones) have quite a limited length. I can't remember well, but AFAIR most of conditional jumps support only 8-bit and 16-bit displacement, which means that you can jump only approx 127 or 32k bytes in any dorection.
To overcome this probelm you have to use auxiliary labels, reorganize your code layout, or use subroutines.

Cheers

S_M_A
September 11th, 2008, 08:23 AM
Your probably correct Hobson. As far as I remember :), TurboC automatically replaced conditional jumps that were outside the range with the inverted condition and an unconditional jump.

Why such a long jump instead of a call?