Merlin's Cavern
Bill Catambay, Pascal Programmer

Updated: 3-4-03

Source for Mac OS Classic

Below are some complete Pascal projects, including source code, resources, project file and running application. This source code is provided as-is, free of charge. If you have short questions about any of this code, you may e-mail the author, but please do not expect a tutorial on how to program.

This code is provided for you to learn how to perform functions in Pascal. You may not copy this code and use it in any commercial or shareware products without permission from the author.

NOTE: There is now a Belorussian translation available thanks to Bohdan Zograf!

Recent archives are now compressed using the new StuffIt 5.0 format.
You will need
StuffIt Expander 5.0 (or better) to decompress them.

Download Author TidBits
OGL Hovertank
Shows how to use OpenGL camera, and some 3D movement transformations. Also shows some basic vehicle effects such as acceleration, inertia, and friction. Includes project file, executable and source (requires OpenGL libraries).
Christian Franz
- OpenGL calls
- OpenGL camera
- OpenGL 3D movements
- Vehicle effects
Mole Sample
This sample code project demonstrates a lot of different things, from playing Midi and MP3 files, to asynchronous sounds, to connecting to servers and launching web browsers. The project includes all the source code, project file, and executable. Run the executable and take the Pascal challenge!
Bill Catambay
- Plays midi from resource
- Plays MP3 from files
- Asynchronous sounds
- Server connections
- Launch web browser
- Card graphics & shuffling
- Multi-pane windows
- Event driven
- Window Manager
TE Sample
This TextEdit package originated from Apple in 1989, and has been revised for better readability as well as updates to work with UI 3.4. Includes source code, project file, and simple TextEdit application.
Bill Catambay
- Text Edit Manager
- Event driven
- Window Manager
MP3 Demo
This package contains some useful MP3 units, and a demo program that opens an MP3 file and displays properties. Includes source code, project files, and applications.
Johan Vindevogel
- Open file types
- MP3 units
- Display MP3 data
Battle Sea
This page describes the game Battle Sea, a game similar to the board game Battleship, and provides the Pascal source code, a project file and a running application.
Matteo Varisco
- Board Game
- Event driven
- Windows & Dialogs
- Game graphics
- Game AI
Two sample projects to query the keyboard, both for key codes and for ASCII codes. Includes source and project files, as well as useful utility applications.
Bill Catambay
- GetKeys
- ASCII conversion
DeskTop Watch
Sample project to draw a live watch that displays the time, with preferences, min/max, and other features.
Bill Catambay
- Events
- Window resizing
- Window moving
- Preferences
- Asynchronous Sound
Approximate Pi
Program which approximates Pi in effort to demonstrate Extended80 (for 68k) as well as other functions.
Bill Catambay
- Extended80
- GetIntlResourceTable
- BlockMove
- StringToFormatRec
- extendedToString
Program which completely hides the menubar, and animates a bouncing ball in an area overlapping the menubar region.
Bill Catambay
- Hides Menu Bar
- Animation wrapping
- Asynchronous Sound
- Trigonometric paths
- Internet Config
- Live Web and Email links
This is a CodeWarrior Pro 4 project showing how to create a game in Pascal using the Carbon environment (it works with MacOS 9.0.4, 9.1 and 10.0.4). Includes source code, project file, and classic OS 9 executable.
Matteo Varisco
- Board Game
- Event drive
- Windows & Dialogs
- Multiple Undos
- Offscreen drawing
- Game graphics
This CDEF resource allows you to effortlessly add live URLs to the alerts and dialogs in your application. It uses Internet Config (IC) and recognizes all the URLs that IC recognizes (http:, ftp:, mailto:, etc.). Includes source code, IC API, project file and compiled CDEF.
Philippe Casgrain
- Internet Config
- Launch URL
Fading Balls
Yet another SillyBalls sample application, but this one adds new features for offscreen double-buffered animation, vertical retrace synchronization, and pixmap fading. It includes project file, source code and CW Pro 6 and THINK Pascal 4.5 project files.
Jean-Yves Bernier
- Offscreen
- Vertical retrace
- Pixmap fading
Weston Pascal Framework
This is a Pascal version of the C++ framework developed in the book Elements of C++ Macintosh Programming. It shows all the elements of a Mac OOP framework and could be developed a lot further.
Paul Rodman
- Object-oriented
- Framework
- Windows
- Quicktime
- AppleEvents
Arrow Draw Demo
This demo illustrates how to draw arrow heads, including indented arrows and arrows as varying angles. It includes Arrow unit, Pascal project, and running sample program.
Philippe Casgrain
- Arrow drawing
- Dialog action
- AppleEvents
Labels Printing
This program is designed to print labels with text, counters, and bar codes on any type of standard labels.
Robert R. Dell
- Barcode labels
- Label Printing
- AppleEvents
Button Action
This package includes source from DialogPlus and PopUpFinder, and provides projects for 68k and PPC.
Bill Catambay
- Dialog action
- Dialog filters (UPPs)
- Apple Events
- Opening Folders
Generic LDEF Demo
This demo application shows how to create your own LDEF resource and use it within your program. The package includes THINK and CW projects, source code, applications and a great How-To document.
Johan Vindevogel
- LDEF resource
- List Manager
- Dialogs
Demonstrates how to transfer data back and forth between your program and another running application using AppleEvents. Includes source code and sample program, and updated to support CodeWarrior and THINK.
Kevin Killion
- AppleEvents
- InterApplication Communications
- Excel Handshaking
Normal Curve Demo
This program demonstrates how to calculate the area under a normal curve with mean of 0 and sd of 1, for any given sd. It also has a function for calculating the area under a curve using Simpsons Rule.
James Derrick
- Normal curves
- Calculating area
- Simpson's rule
- Sioux functions
PopUp Sampler
An older sample of using the Dialog Manager, with buttons, submenus, popup menus and more. Includes a CW Pro 4 project file that works with Universal Interfaces 3.2.
Bill Catambay
- Dialogs
- Popup Menus
- Hide and disable controls
A set of routines for handling error, including sample applications, CW and THINK project files and source code.
James Phillips
- Error handling
- Dialogs
An application that pushes a string of characters out through the Modem port. This action can be monitored in different ways, and indicates that the machine is operating correctly.
Paul B Jones
- Serial port
- Modem access
- Process manager
A very simple program for retrieving a stock quote via the web, and parsing the results for output. It includes PPC-only project, source code, and running application.
Bill Catambay
- Stock quote parsing
- HTTP Data retrieval
- URL Access
- Sioux I/O
A complete HTML parser, with source code, project file, running application and sample HTML file.
Arnout Symoens
- HTML Parser
- Sioux
- File I/O
FastSocketServer is an example TCP/IP program that includes a FastSocketServer unit, an AifTCP unit, and several TCP interfaces written by Peter Lewis.
Arnout Symoens
- Client/Server
- Event driven
- Sioux
OSA Script
A small sample project demonstrating how to pass arguments into a script, and retrieving the arguments upon script execution (includes source, sample script and running application).
Jan Skarbek
- Script execution
- Script arguments
QT MidiBox Demo
An excellent demo package for using Quicktime libraries to play midi sound tracks. Includes source code, project file, running application and sample Midi's.
Johan Vindevogel
- Quicktime code
- Quicktime windows
- Plays QT movies
- Plays flat midi's
- Folder scans
- Folder tricks
- Event driven
WASTE-P 1.1.4 Demo
This is the complete WASTE package all in Pascal. It has been updated for CW Pro Pascal, includes WASTE library and library project files, and includes a WASTE Demo application with associated source code and project file.
Bill Catambay (CW Pro Port)
(original author: Marco Piovanelli)
- WASTE Text Utilities
- Full Text Editing
- Event driven
- Fonts & Styles
- File I/O
- Drag & Drop
This package provides very simple functions for UUEncoding and UUDecoding files. It includes a sample program, with source code and project, which UUEncodes a file.
Paul Rodman &
Bill Catambay

- UUEncode
- UUDecode
- File I/O
E-mail Senders
This package includes project, source code and sample application for using Applescript to send e-mail from within your application using either Eudora or Claris E-mailer.
Ranko Bojanic
- Shell program
- Controls
- Applescript
- E-mail sender
FBA Sampler
Demonstrates how Faceless Background Applications (FBAs) work. The sample plays sounds at random intervals until receiving a quit event. Comes with projects for the FBA and for a program to stop the FBA process, including source code and executables.
Bill Catambay
- Asynchronous sound
- Apple Events
Appearance Manager Sample
This project includes some REW Appearance Manager routines, a CW Pro 4 project, and a small sample program (source and executable) illustrating the Mac OS Appearance Manager.
Bill Catambay & Bob Williams
- Appearance Manager
- Simple Alerts
Audio CD
This project demonstrates how to read the track times off of an Audio CD. It includes project file, source code, resource file and running applications.
Johan Vindevogel
- Reads Audio CD
track times
- Event driven
- Menus, Lists and Dialogs
Request Video v1.2
This is a port of Apple sample code for the Display Manager, now updated to work with CW Pro 2 and higher.
Ingemar Ragnemalm
- Display manager
- Video settings control
Program which uses list manager to display a list of subjects, and inserts text into a scrolling text window based upon which subject is clicked on.
Bill Catambay
- Events
- List manager
- Pane resizing
- Animated icons
- Text utilities
TE Sample
This is the Text Sample program provided by Apple Computer, complete with FAT project, code, and executable.
Apple Computer
- Text utilities
- Events
JCW Preferences
Includes a unit and example program in CodeWarrior Pro 4 Pascal that allows users to create and use preferences files with ease.
Jesse C. Wood
- Preferences updating
- File I/O
Killer Apps
Two projects which demonstrate how to shutdown processes (includes source, projects and executables). One project does a shutdown on all processes, and the other is for just restarting the Finder.
Bill Catambay
- Sending AppleEvents
- Process Shutdown
- Finder Restarting
A small library that allows you to execute AppleScript code from directly inside your application (now supports PPC and CodeWarrior).
Sebastiano Pilla & Bill Catambay
- Applescript execution
- Dialogs
Apple Zoomer
This is a sample screen saver using the SAT libraries, animating Apple logos in a "starfield" fashion.
Ingemar Ragnemalm
- SAT Library sample
- Screen saver
- Events
- Graphics
MP HelloWorld
This sample program demonstrates the use of the Multi-Processor API (and includes the Pascal version of the API).
Ingemar Ragnemalm &
Matt Mora

- Multi Processors API
- Multi Processors example
A unit which demonstrates how to convert a drawing into a PICT file. Includes a sample program, project and running application.
Bill Catambay
- Saving pict files
- Converting to PICT format
- Resource handling

Archives above this point are compressed using the new StuffIt 5.0 format.
You will need
StuffIt Expander 5.0 (or better).

AHProgress is a unit for drawing progress bars, and is unique in that it offers 3 types of bars: color, pattern and picture.
Anthony Hubble
- Standard progress bar
- Patterned progress bar
- Picture progress bar
Setup Assistant
The Assistant is built around a skeleton application taken from Inside Mac (Toolbox Essentials and Advance Toolbox). It includes a launcher to show how to launch an assistant
Johannes Jander
- Creating a Setup Assistant
- Appearance manager
- Launcher
- Preferences
- Handlers
- Program shell
Make QT Movie
This sample program generates and saves QuickTime movies, providing a dialog for selecting formats.
Steve Martin
- QT movie generation
- QuickTime movie formats
- Dialogs
EMR Installer
The complete source code package to the applications for creating the EMR Installer (a patch which upgrades Marathon Infinity to Excalibur).
Charles Lechasseur
- Installer code
- Resource manipulation
- Resource encoding
- Progress bars
- Dialogs
- Spinning cursors
Advanced Graphics
A set of demo applications which use various techniques for graphics drawing, collision, and sprite animation.
Arnout Symoens
- Graphics
- Offscreen worlds
- Sprite animation
- Sprite collision
- Encoded sprite drawing
Ask for URL
This tidbit demonstrates the use of sending an Apple Event to either Netscape or Explorer and retrieving the current URL.
Kevin C. Killion
- Apple Events
- Browser communications
- URL processing
- Dialogs
Chisel Effects
This is an Effects Kit which can be used to create effects in Chisel, the Marathon Infinity map editing tool written by Kirill Levchenko.
Mike Trinder
- Creating plug-ins
- Dialogs
- Events
- File I/O
Replace Resource
The ReplaceResource module with demo. ReplaceResource is a great resource creation and modification routine (this version is in CodeWarrior and Think).
David Blache
- Resource creating
- Resource replacing
- Dialogs
OSAX Shell
Shows how to write a simple scripting addition with multiple osaxen in CodeWarrior. The project is a single-segment, extended code resource.
David Blache
- Scripting Addition
- Code Resource
Source code to an unfinished first-person 3D game. You can use the game engine to make simple 3D mazes. It is even possible to make a shooter like Wolf3D with it.
Ingemar Ragnemalm
- 3D Mazes
- Event handling
- Game engine
- Pixel doubling
- Score keeping
- Scalable sprites
- 3D Wall texturing
Turtle Graf
A graphics demo program which demonstrates turtlegraphics and bit-mapped graphics creation and display. This style of programming is very useful in writing games.
Robert Dell
- Turtle graphics
- Bitmap graphics
- Event handling
This sample program reads through a tabular text file and converts all of the lines into separate STR# resources (starting with ID 128) and all of the columns within a line to parts of the STR# resource.
A. D. Jensen
- Text to STR conversion
- Resource handling
A unit which creates a dialog without using a resource file. Includes a sample program which uses the unit (code, project file and running application).
Ingemar Ragnemalm &
Bill Catambay
- Resourceless dialog
SendFax Demo
An article about the FAXstf library, including sample source code for sending Faxes in Pascal.
Ranko Bojanic
- Fax sending
- Printing
- Event handling
- Custom dialogs
Jordan's Gone!
A game written in THINK Pascal using the THINK Class Library 1.1.2 (TCL) and Ingemar Ragnemalm’s Sprite Animation Toolkit (SAT). This package has the complete THINK Pascal Project for Jordan’s Gone!, along with the classes built to interface TCL to SAT, and to streamline TCL for games. The programmer documentation gives the essentials of construction.
Patrick C Hew
- Game code
- Think Class Library
- Object Oriented
Text Rotation
A demo program that rotates text counterclockwise in one degree increments. Color, size, style, and font can be adjusted. The result has a pixel and a vector presentation and is put into the clipboard and shown on the screen as well.
Peter Hoerster
- Pixmap rotation
- Offscreen pixmap access
- Using PicComments
- Code resource pop-ups
- Offscreen technics
- FKey code
CopyBits Demo
A program which demonstrates just about everything you would ever want to do with CopyBits (converted from a C program by Kenneth Worley).
Bill Catambay
- CopyBits
- CopyMask
- CopyDeepMask
- Picture Fading
- Picture Sliding
- Depixelizing
- Blurring
Scrolling Windows
A collection of two Pascal projects, one which demonstrates how to create working scrollbars and the other demonstrates how to apply this to a scrolling window that contains a picture.
Mark Pazolli
- Window scrolling
- Picture scrolling
Moon Phase
A simple talking program which calculates the moon phase given a date.
Bill Catambay
- Moon phase calculations
- Integer to Hex function
- Speech Manager
Star Field
A simple Pascal implementation of a star field, including a 68K and PPC version.
Bob Williams
- Star field graphics
- FPS calculations
Sliders PLUS
Four units and a demo program for icon handling and gray sliders.
Matthias Wuttke
- Icon caching
- Icon buttons
- Offscreen utils
- Gray sliders
PICTButton Demo
A source code project for a button CDEF, and source code project for sample program using the CDEF.
Jeremy Ferrett
- CDEF project
- Dialog buttons
- Event handling
- Object Pascal
- Speech manager
REWPassword Unit
Unit and sample program for processing password input.
Bob Williams
- Dialog input
- Hidden text
- Text processing
- Object Pascal
Indexed Strings
Unit and sample program for accessing indexed strings in STR# resources.
Louis Bellotto
- Resource I/O
CornerClock v1.8
Utility which displays the time or date in the menu bar to the left of the Apple menu, and plays an hourly chime asynchronously (unlike the system chime, it locks the handle to prevent a corrupted chime).
Bill Catambay
- Writes in Menu Bar
- Saves Preferences
- AppleEvents
- Asynchronous Sound
- Dialog input
- Event handling
DropBin v1.5
Utility which encodes a binhex file. Either drop a file on this application, or open a file from within this app, and it will binhex the file.
Bill Catambay
- AppleEvents
- Progress bar
- CRC Calculating
- Binhex encoding
- File I/O
- Event handling
- Dialogs
Gamma Fade
Program performs a gamma fade on the screen.
Matt Mora
- Gamma fading utilities
Written in Object Pascal, this program illustrates progress bar routines which accompany the package. It includes three sample progress dialogs, one for textual representation of the percent complete, one for growing to the right as the task progresses, and one for an infinite progress bar.
Bill Catambay
- Progress bars
- Object Pascal
- Event handling
- Dialogs
Based upon a C program, this is the Pascal version of a program which produces an animated flame by drawing some simple random colors at the bottom of the image and then simply averaging the colors of every pixel in the image.
Ingemar Ragnemalm
- Palette manipulation
- Color animation
- FPS calculations
Balloon Dissembler
A tool for taking menus and dialogs out of an application into a text file for use with Balloon Help Compiler.
Milton Aupperle
- Dialog handling
- File I/O
- Resource manipulation
A program which demonstrates prompting the user to switch to 256 colors (if not already there), performing some animation, then switching back.
Bill Catambay
- Dialogs
- Color switching
MP Dialogs
The Multipane Dialogs library provides an easy-to-use set of functions for creating pane dialogs. Originally written in C, this package provides a Pascal version of the sample code for utilizing the Multipane Dialogs.
Koryn Grant
- Advanced preferences
- Multiple panes
- Dialogs
- Event handling
My Type 0.3
Utility that will print a catalog of all the installed fonts on your Mac.
Steve Huey
- Preferences
- Scrolling About box
- List handling
- Printing
- Event handling
Pascal Depth
Program which displays a dialog allowing selection of color modes.
Bill Catambay
- Dialogs
- Color mode changing
Program implementing drag and drop of text and pictures from one window to another. Originally written in C, converted to Pascal by Matt Mora. I fixed some bugs and ported it to CodeWarrior.
Bill Catambay
- Drag and Drop
- Event handling
SimpleViewer 3D
A program for viewing a QD3D model with standard functionality for rotating. Converted to Pascal from the QD3D C sample code.
Bill Catambay
- QD3D
- AppleEvents
- Drag and Drop
- Event handling
- Dialogs
Text to Strings
This is a drag-and-drop application that disassembles any text file
dropped on it to Str255's (without using AppleEvents).
Ingemar Ragnemalm
- Text to String

This page authored by Bill Catambay
Comments to: Pascal Central Editor