Function Ptr2Long(p: Pointer): LongInt; Assembler; Asm mov ax,word ptr [p+2] mov dx,ax shr dx,12 shl ax,4 add ax,word ptr [p] adc ax,0 End; Function Long2Ptr(l: LongInt): Pointer; Assembler; Asm mov ax,word ptr [l] mov dx,word ptr [l+2] mov bx,ax and ax,0Fh shr bx,4 shl dx,12 add dx,bx End; Function SubPtr(p: Pointer; d: LongInt): Pointer; Begin SubPtr := Long2Ptr(Ptr2Long(p)-d); End; Function AddPtr(p: Pointer; d: LongInt): Pointer; Begin AddPtr := Long2Ptr(Ptr2Long(p)+d); End;