[next] [prev] [prev-tail] [tail] [up]

### 8.6 When porting Turbo Pascal code

The fact that 16-bit code is no longer used, means that some of the older Turbo Pascal constructs and functions are obsolete. The following is a list of functions which shouldn’t be used anymore:

Seg()
  : Returned the segment of a memory address. Since segments have no more meaning, zero is returned in the Free Pascal run-time library implementation of Seg.
Ofs()
  : Returned the offset of a memory address. Since segments have no more meaning, the complete address is returned in the Free Pascal implementation of this function. This has as a consequence that the return type is longint or int64 instead of Word.
Cseg(), Dseg()
  : Returned, respectively, the code and data segments of your program. This returns zero in the Free Pascal implementation of the system unit, since both code and data are in the same memory space.
Ptr
  : Accepted a segment and offset from an address, and would return a pointer to this address. This has been changed in the run-time library, it now simply returns the offset.
memw and mem
  : These arrays gave access to the dos memory. Free Pascal supports them on the go32v2 platform, they are mapped into dos memory space. You need the go32 unit for this. On other platforms, they are not supported

You shouldn’t use these functions, since they are very non-portable, they’re specific to dos and the 80x86 processor. The Free Pascal compiler is designed to be portable to other platforms, so you should keep your code as portable as possible, and not system specific. That is, unless you’re writing some driver units, of course.

[next] [prev] [prev-tail] [front] [up]