Next: The stack
Up: Memory issues
Previous: Memory issues
The Free Pascal Pascal compiler issues 32-bit code. This has several consequences:
- You need a 386 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 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 32-bit code is 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 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.
Standard it returns now simply the offset. If you want to retain the old
functionality, you can recompile the run-time library with the
DoMapping symbol defined. This will restore the Turbo Pascal
behaviour.
- memw and mem
- these arrays gave access to the DOS memory. Free Pascal
supports them, they are mapped into DOS memory space. You need the
GO32 unit for this.
You shouldn't use these functions, since they are very non-portable, they're
specific to DOS and the ix86 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: The stack
Up: Memory issues
Previous: Memory issues
Michael Van Canneyt
Thu Sep 10 14:04:11 CEST 1998