Installing Apple II UCSD Pascal

Apple II Pascal is an implementation of a portable Pascal language system developed at University of California San Diego (UCSD) in the late 1970s by Professor Kenneth Bowles and his students. The UCSD Pascal system contained a menu-based operating system and an IDE (Integrated Development Environment) consisting of a Filer, Editor, Compiler, Linker and Assembler. The code generated by the UCSD Pascal compiler ran on a virtual p-code Machine that used an interpreter written in the host computer’s assembly language to translate p-Code to native code. This programming model had the advantage that Pascal code written on one UCSD Pascal system should run on other UCSD Pascal systems.

The porting of UCSD Pascal to the Apple II was heavily influenced by two Apple employees: Jef Raskin, who had taught computer science at UCSD and Bill Atkinson, who was a UCSD computer science graduate. Apple co-founder Steve Wozniak was  involved in the development of the Apple II Pascal BIOS which linked Pascal’s I/O (input/output) routines to the Apple II ROM I/O routines. In 1979, Apple released version 1.0 of Apple II UCSD Pascal (referred to as Apple II Pascal hereafter) at a cost of $495 (approximately $2,100 in today’s dollars). It came with a 16K hardware ‘Language Card’ (to increase the Apple II Plus’ memory from 48K to 64K), 4 reference manuals and four 5.25″ system disks. 

Apple II Pascal Box

Apple II Pascal was updated a number of times, with the final version (1.3) released in 1985. It became an important development environment for Apple II software, including: Apple Business Graphics, Apple Presents the IIe, AppleWorks Tutorials, Dollars & $ense, Incredible Jack, PFS, PSort, QuickFile, Thinktank, Smartcom, Versaform and Wizardry.

Apple II Pascal Customized Start-up Screen

The Apple II Pascal operating system ‘takes over’ the Apple II computer and the programs created in Apple II Pascal will only run under the Pascal operating system. This meant that programs written in Apple II Pascal could not be distributed as standalone applications running under DOS or ProDOS. Instead they were distributed on a disk containing an Apple II Pascal runtime system that, when booted, provided the Pascal environment in which the program would execute.

The Apple II Pascal Filer provided a set of tools for creating and managing disks and files within the Apple II Pascal operating system. Apple II Pascal disks used a block-based format that was different from the disk format used by DOS and ProDOS. Apple II Pascal disks (called Volumes) can store a maximum of 77 files and the disk blocks used by a file must be contiguous. As this could lead to significant disk fragmentation, the Apple II Pascal Filer included a defragmentation utility (‘Krunch’) that optimized file storage. The Apple II Pascal Operating System Reference Manual describes the Pascal Filer in detail.

Apple II Pascal Filer Directory Listing

The Apple II Pascal Editor provided a powerful (for the time) full-screen text editor to create and edit Pascal source code (or 6502 Assembly code) and also served as a simple word processor. While Apple II Pascal will work with either a 40 column or 80 column screen, the latter was highly desirable. The Apple II Pascal Operating System Reference Manual describes the Editor in detail.

Apple II Pascal Text Editor

The Apple II Pascal Compiler converts the source code text of a Pascal program into compressed p-code (bytecode) that will run on the Apple II Pascal p-machine. This single-pass compiler was slow, processing 150-300 lines of source code per minute, depending on the compiler settings. The Apple II Pascal Linker supported the inclusion of separately compiled code (Pascal or 6502 Assembly Language) into an Apple II Pascal program code file.

Setting up an Apple II UCSD Pascal System

Software: The final version (1.3) of Apple II UCSD Pascal was released in 1985, on five 5 1/4 disks (Apple 0,Apple 1,Apple 2, Apple 3, Attach). Version 1.3 has many advantages over earlier versions, including support for 128K of RAM plus bug fixes. If you plan on using Apple II Pascal on either an Apple IIe or Apple IIc with an Extended 80-Column Text Card, you should use the 128K system; if you have anything else, you must use the 64K version of the system.  The 128K system supports larger programs, multiple libraries and a faster compile/link/execute cycle.

Version 1.3 of Apple II UCSD Pascal is available for download (for $20) on the Apple Programmers and Developers Association (APDA) Software Library CD available from Juiced. The download includes the APDA CD in ISO format and a ZIP-compressed archive. The 5 Apple UCSD Pascal 1.3 disks are in the ‘Apple II Pascal 1.3’ folder.

Apple II Pascal Disks

Documentation: The definitive manual for Apple II Pascal version 1.3 is the Apple // Pascal 1.3 Workbench. This 950-page book includes detailed information on the Filer, Editor, Compiler, Linker and Assembler. It also includes a comprehensive reference for the UCSD Pascal language dialect.

There are also two Apple-published Apple II Pascal manuals that periodically pop up on eBay: The Language Reference Manual and The Operating system Manual. However, they are not as comprehensive as the Workbench manual.

Apple II Pascal Manuals

If you would like to learn more about programming in Apple II UCSD Pascal, I recommend The UCSD Pascal Handbook – A Reference and Guidebook for Programmers by Clarke & Koehler (link is to the table of contents only) and Apple Pascal: A Hands-On Approach by Luehrmann & Peckham. An excellent source for information about Apple II UCSD Pascal is here.

Hardware: While you can run Apple II UCSD Pascal on any member of the Apple II family of computers, I recommend using an Apple II simulator to take advantage of virtual hard disks and CPU acceleration. I use Virtual ][ ,the amazing Apple II, II+,IIe and IIc emulator for the Macintosh written by Gerard Putter. My Apple II UCSD 128K Pascal development machine under Virtual ][ is configured as follows:

  • Under Machine -> Configure -> Components -> CPU select ’65C02′.
  • Under Machine -> Configure -> Components -> CPU Speed select ‘1 MHz’.
  • Under Machine -> Configure -> Components -> Keyboard select ‘Backspace acts as left-arrow key’.
  • Aux Slot: A 1024K RAMWorks card, configured as a 960K RAM disk. This also provides an 80-column display. Note that Apple II Pascal does not support RAMWorks virtual disks greater than 4096K.
  • Slot #1: A Serial Printer Card connected to an ImageWriter II printer (Apple II Pascal expects to find a printer in Slot #1).
  • Slot #5: Two 5 1/4 inch disk drives.
  • Slot#6: Two Apple II Pascal-compatible 10 MB Profile-like hard disks (called ‘Omnidisks’ in Virtual ][).
  • Slot #7: A Thunderclock card, so that the UCSD Pascal operating system will automatically time stamp the creation and modification dates of files (this requires a patch to Apple UCSD Pascal version 1.3 that I cover in a seperate post).
Apple II UCSD Pascal (customized startup screen) running in the Virtual ][ Simulator

Once this hardware simulator configuration has been created, do the following:

  • Insert Apple II Pascal version 1.3 disk ‘Apple 1’ into 5 1/4″ disk drive #1.
  • Type ‘PR#5’ and press the RETURN key to boot into Apple II Pascal.
  • The Apple II Pascal operating system should appear.
  • Click on OmniDisk Drive 1 and select ‘Create Blank OmniDisk…’.
  • Create and save a 10 MB hard disk named ‘PASBOOT’.
  • Click on OmniDisk Drive 2 and select ‘Create Blank OmniDisk…’.
  • Create and save a 10 MB hard disk named ‘PASDATA’.
  • In Apple II Pascal type ‘X’ (eXecute) and then type ‘formatter’
  • In response to ‘Format which volume # ?’ type ‘11‘ and then ‘Y’.
  • When prompted for a volume name, enter ‘PASBOOT’
  • Now format volume # 12, creating a hard disk named ‘PASDATA’
  • Press the ESC key to exit the formatter utility.
  • Next, type ‘F’ and ‘V’ to confirm that the two new hard disks were created.
  • We now copy the contents of the ‘Apple 1’, ‘Apple 2’ and ‘Apple 3’ disks to the ‘PASBOOT’ hard drive. To do so, insert (in turn) the ‘Apple 1’, ‘Apple 2’ and ‘Apple 3’ disks into the first 5 1/4 disk drive and from the Filer type ‘T’ (Transfer). When prompted for ‘Transfer what file ?’ enter ‘#4:=’ (copy all files on device #4) and when prompted with ‘To where ?’ enter ‘PASBOOT:$’ (copy the selected files to device ‘PASBOOT’ using the same file names. When asked to overwrite any existing file, answer ‘N’.
  • Finally, as the simulated Apple IIe is a 128K computer we need to install the 128K version of the files ‘System.Apple’ and ‘System.Pascal’. To do so type ‘F’ to enter the Filer and then type ‘T’ (Transfer) to replace the default versions of ‘System.Apple’ and ‘System.Pascal’ on the hard disk ‘PASBOOT’ as follows: In response to ‘Transfer what file ?’ type ‘PASBOOT:128K.Apple’ and when prompted with ‘To where ?’ type ‘PASBOOT:System.Apple’. This replaces the file ‘System.Apple’ with the contents of the file ‘128k.Apple’, while keeping the ‘System. Apple’ file name. When asked ‘Remove old PASBOOT:System.Apple’, answer ‘Y’. Follow the same procedure to replace ‘System.Pascal’ with the contents of the file ‘128k.Pascal’.
  • Quit the Filer, eject any floppy disks from the 5 1/4″ inch floppy drives and select ‘Restart Virtual Machine’ from the Virtual ][ ‘Machine’ menu. This will reboot the Apple II Pascal system using the ‘PASBOOT’ hard disk as the startup device.
  • After rebooting, enter the Filer and type ‘V’. You will see that the device number assignments have changed and the hard disk ‘PASBOOT’ is now device #4 (the Apple Pascal boot disk is always device #4).
  • Type ‘F’ and ‘D’ to enter today’s date. Type ‘Q’ to quit the Filer.
  • Finally we need to apply an Apple II Pascal 1.3 patch to the Apple II boot disk to fix two Apple II Pascal 1.3 bugs. Insert the Apple II Pascal ‘Attach’ disk (found in the Apple Pascal 1.3 folder on the APDA Software Library disk) into the first 5 1/4″ disk drive. Type ‘X’ (Execute) in the Apple II Pascal operating system. When prompted, type ‘#11:Patch’. When prompted with ‘Please enter the number of the unit containing the diskette with the System.Apple file to be updated’, type ‘4’ and press RETURN. After the patches are applied reboot Apple II Pascal.
  • It is necessary to defragment the ‘PASBOOT’ hard disk after installing the files. To do so type ‘F’ to enter the Filer and type ‘K’ to launch the Krunch utility. When prompted with ‘Crunch what volume ?’ type ‘PASBOOT:’ and answer ‘Y’ when asked ‘From end of volume, block 20480 ?’. You may be prompted to reboot Apple II Pascal after the Crunch utility has finished.

Testing: To test the Apple II Pascal system that you have installed, type ‘E’ to launch the Editor. When prompted with ‘Edit what file’, type ‘hilbert’. When the source code for the Hilbert program has been loaded into the editor, type ‘U’ (to update the current project) and ‘E’ to exit. Now type ‘R’ to compile and run the Hilbert program. When prompted for a ‘Listing file’, press RETURN. The Apple II Pascal compiler will now compile the Hilbert source code and run the program. The Hilbert program will ask ‘ORDER:’, type 6 and RETURN to see some Apple II Pascal graphics in action. Press the Space bar to try another ORDER (1-6 or 0 to exit), but this time select ‘maximum Speed’ from the Virtual ][ ‘Machine’ menu.

Simulator CPU Speed: One advantage of using an Apple II hardware simulator is the ability to use CPU acceleration. This is important when using Apple II Pascal, which is quite slow when run at standard CPU speed. I choose either ‘High Speed’ or ‘Maximum Speed’ from the Virtual ][ ‘Machine’ menu when editing, compiling or linking, and switch back to ‘regular Speed’ when running a Pascal program.

5 thoughts on “Installing Apple II UCSD Pascal”

  1. HI! I’ve been following this guide in Virtual ][ and I can very happily get into Pascal 1.3 and use it, but it doesn’t see either the Thunderclock or the RAMworks card. You did mention the Thunderclock requiring patching that you would document later; Did that ever happen? And for the RAMworks card, you mention configuring it with 1024K set up as a 960K RAM disk. I can configure the 1024K in Virtual ][, but I’m assuming there’s something about setting up the 960K RAM disk that I have to do and am missing. Any clues for me there? Any help would be appreciated, and thank you for this excellent guide!

    Like

    1. The RAMWorks card requires Pascal RAMDisk software, that was sold by Applied Engineering (the maker of the RAMWorks card). I plan on adding an article about implementing this software in Apple Pascal 1.3. A much simpler solution for adding a RAM disk to Apple Pascal 1.3 in Virtual ][ is to configure a virtual Apple IIe with a RAMFactor card in slot #4. Pascal 1.3 will recognize the card and automatically create a RAM disk Pascal volume called RAM4:. Go into the Filer and select the (V)olumes command to see the RAM disk volume. You can read and write to the RAM disk volume just like a regular disk.

      I have written code to patch Apple Pascal 1.3 so that it recognizes the ThunderClock card and use the card to automatically date stamp Pascal files (creation and modification dates). More on that in another post.

      Like

      1. Thanks! That does sound simpler. I did wind up finding an image of the card after quite some time and I followed their installation instructions. It kindasorta seemed to be working, up to a point, but then it caused Pascal to crash.

        I know the big plus of the RAMDisk is in allowing Pascal to copy its system files to it on startup and set it as the boot disk (that seemed to be the point at which it was crashing last night), but I do wonder if it makes that huge of a difference if you’re emulating the system rather than using physical disks.

        I’ll eagerly await the Thunderclock post. I found a project on github for adding support, but wasn’t really able to follow it at the time.

        Of course, everything works in the meantime, so that’s not terrible. Manually setting the date isn’t the end of the world. 🙂

        Like

      2. Yes, on an actual Apple II the Applied Engineering RAMWorks Pascal disk does support loading Pascal system files into the RAM disk and setting the RAM disk as the startup volume (important on a real device if the Pascal environment crashes and needs to be restarted). However, it offers no advantage in the Virtual ][ Pascal environment that I use, as the OmniDisk containing the contents of all the Apple Pascal disk (0-3) is always available and the system will boot from the OmniDisk. On a real Apple II computer there is the faster read/write advantage when using a RAM disk but that is not so in Virtual ][.

        Like

Leave a comment