The game was originally written in Borland Turbo Pascal 6.0, which
supports inline assembly. Because some people don't have TP 6.0,
I have also made a version of the source code for TP 5.5, which is
available for free at
(requires free registration).
To compile, type:
TPC /M /L MARIO
(make all units, use link buffer on disk).
There is no level editor, all the levels are coded in WORLDS.PAS.
Each character indicates a block (as can be found in FIGURES.PAS).
All sprites were made with the sprite editor GRED, which
is inlcuded in the archive. Sprites have the extensions
.000, .001, etc. To edit, for example, type:
and save it with F4. GRED creates text files with extensions
.$00, .$01, etc. that are included into the Pascal source code.
Most data (sprites, levels, etc.) is stored in procedures
(see SWMAR.$00 for example).
This allows the sprites to be located in the code segment,
not the data segment (which is limited to 64 Kb).
Mario works with a 320x200 screen mode (chained), with page
flipping (see VGA.PAS). The virual screen width is two
blocks wider (360 pixels),
so whenever the game scrolls one pixel to the left or right,
I draw one complete new block instead of a vertical
line from several different blocks (see PLAY.PAS).
Because copying video memory to video memory can be done very
fast (compared to copying system memory to the video
card on an old 486), I use the remaining video memory to
save and restore backgrounds of moving sprites (see VGA.PAS).
Parallax scrolling is done in two different ways. In the first
level I move the background by only drawing the pixels that
change when the arches move. This can be done very fast.
The bricks and pillars are done by simply changing the
palette's RGB values (see BACKGR.PAS).