Skip to content
🎉 Free Pascal v3.2.4 is out! See Release Notes
FAQ
DOS Related

DOS Related

1 - Releasing software generated by the DOS compiler
  • If your program uses floating point code (which is very probable), make sure to read “6 - Applications created with Free Pascal crash on 80386 systems” regarding special issues which might occur. Math coprocessor emulation software is then required (wmemu387.dxe should be redistributed with your software)
  • The target system must have a DPMI server. To avoid problems, the file cwsdpmi.exe should always be redistributed with your application.
  • The target system must have DOS 3.3 or later.
  • The default stack size is 256 Kbytes. See also “10 - Changing the default stack size**
  • The stack checking option is available on this platform.
2 - Debugging

The GNU debugger v4.16 and later have been tested, and generally work as they should. Because the GNU debugger is C oriented, some pascal types might not be represented as they should. It is suggested to use the text mode IDE instead of GDB, which is available for the DOS target.

3 - Dynamic libraries

Creation or use of shared libraries (also called dynamic link libraries) is not supported under this platform.

4 - Profiling

Profiling with gprof is supported for this platform.

5 - Running Free Pascal without a math coprocessor

On the Intel version the emulator is automatically loaded by the compiler if you add the following commands to your autoexec.bat:

  SET 387=N
  SET EMU387=C:\PP\BIN\GO32V2\WEMU387.DXE
Do not forget to replace the C:\PP with the directory where you installed FPC.

6 - Applications created with Free Pascal crash on 80386 systems
  • Trying to run an application which performs floating point operations on a 386 system without a math co-processor will crash unless the emu387 unit is used, as this unit loads the math co-processor emulator (called wmemu387.dxe). You can add the unit as follows:

      program myprog;
      uses emu387, ...

    When the application is released, the software package should also include the wmemu387.dxe redistributable file to avoid problems.

  • Some 80386 systems have a hardware bug which corrupt the accumulator register EAX if it is used in a MOV instruction just after a POPAL instruction. Prior to version 1.0.5, the compiler and runtime library could generate such code sequences. This is now fixed and should no longer cause problems.

7 - The mouse cursor is not visible in graphics screens

Many DOS mouse drivers do not properly support mouse cursors in VESA modes. Logitech is said to have a decent mouse driver, which can be found here

8 - Accessing I/O ports

The Port array is supported like in TP, as long as you use the ports unit in your program (not available under Win32).

I/O port access is possible under Linux, but that requires root privileges. Check the manuals for the IOPerm, ReadPort and WritePort procedures. (Unit Linux)

9 - Accessing DOS memory / Doing graphics programming

You can do like in Turbo Pascal, via absolute or mem[]. For larger memory blocks use the dosmemput/dosmemget routines in the Go32 unit.

10 - Changing the default stack size

Under the DOS (GO32V2) target, the default stack size to 256 bKbytes. This can be modified with a special DJGPP utility called stubedit. It is to note that the stack may also be changed with some compiler switches, this stack size, if greater then the default stack size will be used instead, otherwise the default stack size is used.