0
votes

I'm coding in assembly for Intel 8086 under TASM in DosBox and the problem I frequently stumble upon is getting the compilation error of "Relative jump out of range by some bytes" where my conditional jumps are.

Now, I know that conditional jumps are short jumps but is there any way to somehow... "stretch" them? :) I know I can place intermediate jumps or try to assemble the code so that the jumps are in reach but as my program grows larger, I think the latter option may prove to be less valid than now.

Can I somehow tell the compiler to make something with it or can I somehow tweak my jumps?

2
*cough* University curriculum *cough*Straightfw
The problem of programmers writing big blobs of code is however time-less. You are not using CALL enough.Hans Passant
Look at your assembler options. Most of them have an option you can flip to automatically generate a relative jump to a far jump as necessary and then (other than the performance impact) you don't have to think about it anymore.Brian Knoblauch

2 Answers

3
votes

It's been a long time since I've done any assembly coding, but as I recall, the usual way to "stretch" a conditional jump is to invert the logic of the test and place an absolute jump representing the branch you want to take just after the conditional jump.

0
votes

Another way was to put a "table" of jumps within reach, then you relative jumped to to the jump you wanted to jump to. :)

You could get clever with that and change the jump in the table. Course debugging such code was 'erm "fun"..