Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

indirect far jmp (Developers)

posted by ecm Homepage E-mail, Düsseldorf, Germany, 10.05.2012, 13:26

this isn't NASM-specific. you have to load a segment register to access data there. you can use the stack to preserve it though; in that case, use a far return instead of the far jump instruction. example:

__seg equ 1234h
__ofs equ 5678h

        push ds
        push ax
        mov ax, __seg
        mov ds, ax
        push bp
        mov bp, sp
        mov ax, [__ofs+2]
        xchg ax, [bp+4]
        push ax
        mov ax, [__ofs]
        xchg ax, [bp+2]
        pop ds
        pop bp
        retf


freeing up one of the segment registers (usually es or ds) for direct access is usually simpler of course

---
l

 

Complete thread:

Back to the forum
Board view  Mix view
22760 Postings in 2121 Threads, 402 registered users (1 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum