The Free Pascal compiler issues 32-bit or 64-bit code. This has several consequences:
- You need a 32-bit or 64-bit processor to run the generated code. The compiler functions
on a 286 when you compile it using Turbo Pascal, but the generated programs cannot
be assembled or executed.
- You don’t need to bother with segment selectors. Memory can be addressed using
a single 32-bit (on 32-bit processors) or 64-bit (on 64-bit processors with 64-bit
addressing) pointer. The amount of memory is limited only by the available amount of
(virtual) memory on your machine.
- The structures you define are unlimited in size. Arrays can be as long as you want.
You can request memory blocks from any size.
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.