Hi all,
has anyone recently played around with the FreePascal 8086 cross
compiler to generate DOS executables? I try to convert a near pointer to
a far pointer while working under the small memory model, but that is
not as trivial as it should be, because I have not found a language /
library feature for it. For example, a cast operation does not work. But
the semantics should be well defined (for the small memory model): set
the segment part of the far pointer to DS.
I came up with the following solution, but I am wondering if I have
overlooked something built-in?
function ToFarPointer(nearP: NearPointer) : FarPointer;
var p: packed record ofs: NearPointer; segm: Word; end;
begin
p.ofs := nearP;
asm
mov ax, seg @data
mov [p.segm], ax
end;
ToFarPointer := FarPointer(p);
end;
(the above of course only works with the small / tiny / compact memory
models)
Greetings, Bernd
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel