Home

Awesome

Mad-Pascal

English Documentation / Polska Dokumentacja

Introduction

[source]: # Section is copied from original https://mads.atari8.info/doc/en/introduction/

Mad-Pascal (MP) is a 32-bit Turbo Pascal compiler for Atari 8-Bit and other MOS 6502 CPU-based computers. By design, it is compatible with the Free Pascal Compiler (FPC) (the -MDelphi switch should be active). This means the possibility of obtaining executable code for Atari 8-bit, Windows, and every other platform for which FPC exists. Mad-Pascal is not a port of FPC. It has been written based on SUB-Pascal (2009) and XD-Pascal (2010), the author of which is Vasiliy Tereshkov.

MP uses 64KB of primary memory. The class TMemoryStream provides access to extended memory. A program that works on Atari 8-Bit might have problems on Windows and other platforms if, for example, the pointers have not been initialized with the address of a variable. Writing via an uninitialized pointer results in an attempt to write to the address 0x0 and causes a memory protection fault.

The strengths of MP include the fast and convenient possibility of including inline assembly. A program using inline ASM only works on platforms with MOS 6502 CPU.

Variable allocation is static. There is no dynamic memory management. Parameters are passed to functions by value, variable, or constant.

The available features are:

Compile

fpc -MDelphi -vh -O3 mp.pas

Usage

WUDSN and Mad Pascal

Mad Pascal i Geany

Atari 8-Bit

mp.exe filename.pas -ipath:<MadPascalPath>\lib
mads.exe filename.a65 -x -i:<MadPascalPath>\base

BAT

    <MadPascalPath>\MP.exe %1 -ipath:<MadPascalPath>\lib -ipath:<MadPascalPath>\blibs

    if exist %~dp1%~n1.a65 (
	    mads.exe "%~dp1%~n1.a65" -x -i:<MadPascalPath>\base
	    if exist "%~dp1%~n1.obx" altirra "%~dp1%~n1.obx"
    )

Commodore 64

mp.exe -t c64 filename.pas -ipath:<MadPascalPath>\lib
mads.exe filename.a65 -x -i:<MadPascalPath>\base

Commodore Plus/4

mp.exe -t c4p filename.pas -ipath:<MadPascalPath>\lib
mads.exe filename.a65 -x -i:<MadPascalPath>\base

Neo6502

mp.exe -t neo filename.pas -ipath:<MadPascalPath>\lib
mads.exe filename.a65 -x -i:<MadPascalPath>\base

Mad-Pascal for Neo6502

RAW

mp.exe -t raw filename.pas -ipath:<MadPascalPath>\lib
mads.exe filename.a65 -x -i:<MadPascalPath>\base

Tools

MadStrap

Simple Atari Mad-Pascal standard project bootstrap.

Source code at GitLab

BLIBS

Set of custom libraries for MadPascal.

The latest documentation is always on GitLab

pasdoc

Custom tool for generating documentation from Pascal comments in units.

Source code at GitLab

Effectus - Action! compiler

The new version generates the source code using the Mad Pascal cross-compiler, which is further compiled into binary code with Mad Assembler.

Game tutorial

Simple game tutorial by using Mad Pascal

FiDL

Display List program editor for 8-bit Atari ANTIC chipset

CutAs

Simple binary data manipulation tool written in JavaScript (export to Action!, Assembler, C, Pascal)

Bocianu's Atari Toolkit HUB

CutAs, FiDL, SprED, Sprite XL

A8 Mad-Pascal Window Library

This text-mode windowing library has window controls and modern gadgets (widgets). The gadgets allow you to build input forms that use buttons, radio buttons, input strings (with scrolled lengths and type restrictions), check boxes, progress bars, etc. This allows you to build applications with "modern" interfaces.

Projects in Mad-Pascal

Benchmarks

CC65Mad PascalMillfork
Sieve (less is better)602577579
YoshPlus (higher is better)419334193341933
Chessboard (higher is better)768882

https://github.com/tebe6502/Mad-Pascal/blob/master/samples/benchmark.7z

Floating Point

iteration x 256Atari OSFastChipMP SingleMP Real
add, sub, mul, div2321186499
add, sub, mul, div, sin, cos5820291537281231

https://github.com/tebe6502/Mad-Pascal/blob/master/samples/fp_benchmark.7z

Suite

suite-animation

sources

Links

YouTube

Pascal compilers for the Atari XE/XL computer