http://nasm.sourceforge.net/doc/html/nasmdoc6.html
6.2 obj: Microsoft OMF Object Files
When you define a segment in an obj file, NASM defines the segment name as a symbol as well, so that you can access the segment address of the segment. So, for example:
Why would someone have to do something like this i'm curious,
any idea?
6.2 obj: Microsoft OMF Object Files
When you define a segment in an obj file, NASM defines the segment name as a symbol as well, so that you can access the segment address of the segment. So, for example:
segment data
dvar: dw 1234
segment code
function:
mov ax,data ; get segment address of data
mov ds,ax ; and move it into DS
inc word ; now this reference will work
ret
Why would someone have to do something like this i'm curious,
any idea?
imagine you are creatig DOS MZ executable, with code and data segment. you need to set DS to point to data segment. so you need
mov ax, dseg
mov ds,ax
Nice answer thanks vid.
I was trying to do it in 32bit flat memory mode but it fails ,I later read that it is not allowed :(
Thanks anyway.
I was trying to do it in 32bit flat memory mode but it fails ,I later read that it is not allowed :(
Thanks anyway.