Giter Club home page Giter Club logo

mad-pascal's Introduction

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:

  • If Case For To For In While Repeat statements
  • Compound statements
  • Label Goto statements
  • Arithmetic and boolean operators
  • Procedures and functions with up to 8 parameters. The returned value of a function is assigned to a predefined RESULT variable
  • Static local variables
  • Primitive data types, all types except the ShortReal and Real types are compatible. Pointers are dereferenced as pointers to Word:
    • Cardinal Word Byte Boolean
    • Integer SmallInt ShortInt
    • Char String PChar
    • Pointer File Text
    • ShortReal Real fixed-point
    • Float16
    • Single / 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

Compile

fpc -MDelphi -vh -O3 mp.pas

Usage

WUDSN and Mad Pascal

Mad Pascal i Geany

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"
    )
mp.exe -t c64 filename.pas -ipath:<MadPascalPath>\lib
mads.exe filename.a65 -x -i:<MadPascalPath>\base
mp.exe -t c4p filename.pas -ipath:<MadPascalPath>\lib
mads.exe filename.a65 -x -i:<MadPascalPath>\base
mp.exe -t neo filename.pas -ipath:<MadPascalPath>\lib
mads.exe filename.a65 -x -i:<MadPascalPath>\base
mp.exe -t raw filename.pas -ipath:<MadPascalPath>\lib
mads.exe filename.a65 -x -i:<MadPascalPath>\base

Tools

Simple Atari Mad-Pascal standard project bootstrap.

Source code at GitLab

Set of custom libraries for MadPascal.

The latest documentation is always on GitLab

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.

Simple game tutorial by using Mad Pascal

Display List program editor for 8-bit Atari ANTIC chipset

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

CutAs, FiDL, SprED, Sprite XL

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

CC65 Mad Pascal Millfork
Sieve (less is better) 602 577 579
YoshPlus (higher is better) 41933 41933 41933
Chessboard (higher is better) 76 88 82

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

Floating Point

iteration x 256 Atari OS FastChip MP Single MP Real
add, sub, mul, div 232 118 64 99
add, sub, mul, div, sin, cos 5820 2915 3728 1231
  • MP Single: IEEE754-32bit
  • MP Real: Q24.8 Fixed Point

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

mad-pascal's People

Contributors

tebe6502 avatar zbyti avatar bocianu avatar t-w avatar peterdell avatar gsoftwaredevelopment avatar michalgw avatar

mad-pascal's Issues

file management

File handling does not work as by default it tries to use Atari specific functions

Unit Graph

Rewrite graph unit to work on x16
path: lib/graph_x16.inc

Unit needs to be able to initialize different graphical modes'.
Text modes are handled by CRT.

Review and rewrite code for base lib

Base lib is asm code used in other units
path base/x16/

Only clrscr.asm is ok
Following should be reviewed and rewrote:

  1. x16.hea
  2. charset.asm
  3. putchar.asm
  4. putpixel.asm
  5. resource.asm

x16.hea contains macros that were taken from C64 implementation.
all macros needs to be reviewed and adjusted for x16

  1. basic_start
  2. SwitchVICBank
  3. SetHiresBitmapMode
  4. SetMulticolorBitmapMode
  5. SetScreenMemory
  6. SetBitmapAddress

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.