Posted: Sat Aug 11, 2007 12:55 am
Hi,
For example (for NASM) you could use "jb near foo" to specifically code a near jump, or use something like "nasm -O999" on the command line to enable optimizations (where NASM will automatically use near jumps when short jumps don't reach).
Of course other assemblers vary, but there's always a way (unless the assembler is broken, and doesn't support the full 80x86 instruction set).
Cheers,
Brendan
The CPU itself supports both short conditional branches and near conditional branches, and most sane assemblers will either use the correct (short or near) conditional branch or provide some way to specify that you want a near jump instead of a short jump.XCHG wrote:I wish I could use conditional jumps for branching like that but since conditional jumps are SHORT jumps and the code size when assembled exceeds the amount of opcodes a SHORT jump can jump over, it is not possible to use SHORT jumps in that code. So I have to short jump to a near label and then LONG jump to the end of the procedure.
For example (for NASM) you could use "jb near foo" to specifically code a near jump, or use something like "nasm -O999" on the command line to enable optimizations (where NASM will automatically use near jumps when short jumps don't reach).
Of course other assemblers vary, but there's always a way (unless the assembler is broken, and doesn't support the full 80x86 instruction set).
Cheers,
Brendan