Mad-Pascal (MP) is a 32-bit Turbo Pascal compiler for Atari XE/XL. By design, it is compatible with the Free Pascal Compilator (FPC) (the -MDelphi switch should be active), which means the possibility of obtaining executable code for XE/XL, PC and every other platform for which FPC exists. MP is not a port of FPC; it has been written based on of SUB-Pascal (2009), XD-Pascal (2010), the author of which is Vasiliy Tereshkov.

A program that works on Atari might have problems on PC if, for example, the pointers have not been initialized with the address of a variable and the program attempts to write to the address $0000 (memory protection fault). The strengths of MP include fast and convenient possibility of inclusion of inline assembly. A program using inline ASM does not work on platforms other than XE/XL. MP uses 64KB of primary memory; TMemoryStream provides usage of extended memory. Variable allocation is static; there is no dynamic memory management. Parameters are passed to functions by value, variable or constant.

The available features are:

  • If Case For While Repeat statements
  • Compound statements
  • Label Goto statements
  • Arithmetic and boolean operators
  • Procedures and functions with up to 8 parameters. Returned value of a function is assigned to a predefined RESULT variable
  • Static local variables
  • Primitive data types, all types except the ShortReal/Real type are compatible. Pointers are dereferenced as pointers to Word:
    • Cardinal Word Byte Boolean
    • Char String PChar
    • Integer SmallInt ShortInt
    • Pointer File
    • ShortReal Real (fixed-point)
    • Single (IEEE-754) [Float]
  • One-dimensional and Two-dimensional arrays (with zero lower bound) of any primitive type. Arrays are treated as pointers to their origins (like in C) and can be passed to subroutines as parameters
  • Predefined type string [N] which is equivalent to array [0..N] of Char
  • Type aliases.
  • Records
  • Objects
  • Separate program modules
  • Recursion


To compile the sources of Mad-Pascal, one may use Delphi, provided they happen to have installed Delphi 7.0 or a later version.

A more cross-platform way is to use the Free Pascal Compiler (FPC), which can be downloaded from

Launch the installer and choose the directory for the installation of FP. It is crucial not to use the exclamation mark ! or other nonstandard characters in the directory name. If it fails to compile any file, most probably, it is the fault of a nonstandard pathname. The command-line launching the compilation may look as follows (letter case in parameter names matters):

fpc -Mdelphi -v -O3 mp.pas
  • -Mdelphi allows for Delphi format file compilation
  • -v shows all error and warning diagnostics
  • -O3 performs code optimization


  1. Free Pascal Reference Guide
  2. MadPascal AtariAge forum
  3. MadPascal examples
  4. Atari XE/XL Pascal Compilers