The LazyBoy Library Manual - FlattenPtr

Part of the System group.

%imacro FlattenPtr 1
Prefers: ES:DI

Reduce the offset of a real mode pointer by moving portions of the offset value to the segment.

This is safer way to re-segment and re-offset a pointer instead of just using PtrToInt and IntToPtr. This macro uses those routines for the conversion. If the process was not successful, the original pointer is returned and the carry flag will be set.

Since a program should never have a good reason to be re-segment pointers in memory above f000:0000 in real mode, the additional code required to fully support conversion in those areas does not seem worthwhile.

Example:

    FlattenPtr ES:DI    ; reduce offset of pointer

See also PtrToInt and IntToPtr.