VOGONS


Pulling my hair out with EGA programming.

Topic actions

Reply 60 of 61, by BloodyCactus

User metadata
Rank Oldbie
Rank
Oldbie
keenmaster486 wrote on 2025-06-04, 21:33:

In any case what I need is a jmp instruction to a label that is not limited to +/- 127.

then its a normal jmp (3 bytes) the assembler should choose the best one based on the distance of the jump.


;; wasm -ms -o test.asm
;; wlink file test.obj name test.exe

_CODE segment 'CODE'

start:
xor ax,ax
jmp mylabel

mov ax,1

mylabel:
mov ah,0x4C
int 0x21

_CODE ends
end

works for me. no assembly errors.

--/\-[ Stu : Bloody Cactus :: [ https://bloodycactus.com :: http://kråketær.com ]-/\--

Reply 61 of 61, by mkarcher

User metadata
Rank l33t
Rank
l33t
keenmaster486 wrote on 2025-06-04, 21:33:

I tried using "jmp near <label>" (actually I'm using jnz, so "jnz near") but it would not compile - said "operator is expected".

In any case what I need is a jmp instruction to a label that is not limited to +/- 127.

There are no near conditional jumps on the 8086. They were introduced with the 80386. Use "jz next; jmp label; next:" instead. Likely WASM also has the "jumps" directive that allows WASM to automatically generate that sequence if the target is out-of-range.

Be careful with "jumps" though: In single-pass mode, it will cause all forward jumps that are not explicitly marked "short" with this slow and bulky workaround sequence.