2015 Retrochallenge Winter Warmup, Retrochallenge

Retrochallenge 2015/01 – Post 01

(This is part one of the chronicle of my Retrochallenge 2015/01 submission, which is to port the modern-day Apple II game, Structris, to the Atari 8-bit home computer using an obscure language called PL65. The mediocrity starts here.)

Hello, PL65

To get things going, I wanted to talk a bit about Noahsoft’s PL65. It was published towards the end of the 8-bit era and, as far as I know, distributed but for a few months solely via mail order. Quarter-page ads for PL65 can be found in Atari User (UK) between late 1987 and early 1988. Given it’s timing and duration on the market, it’s often regarded as the rarest of programming software titles for the Atari home computer.

If you are reading this in early 2015, you can still examine a current eBay auction for a copy of Noahsoft’s PL65. The asking price is 295.95 GBP or $461.46 USD. Yikes.

Just so there is no confusion, another programming language called PL/65 pre-dated Noahsoft’s. As early as 1978, Rockwell International offered a language called PL/65 to support their second-sourced R6500 microprocessors, and later, their single-board computer, the AIM-65. However, after looking through a copy Rockwell’s user manual, I saw nothing to suggest Noahsoft’s PL65 was a derivative of the earlier work. The only commonality is the use of ALGOL-like code blocks.

Here’s my demonstration of editing, compiling, and running a minimal program using Noahsoft’s PL65 for the Atari 8-bit home computers.

PL65 Disk Image and User Manual

In case you want to play along, below are links to a PDF of the PL65 User Manual and my version of the PL65 disk image. The disk image is in the ATR file format used by Atari 800 emulators and SIO2PC programs.

PL65 Programming Manual Title
PL65_Manual.pdf
PL65 Diskette image
PL65_BW.atr

I modified the 2nd cracked image originally created by the heroic hackers on the AtariAge forums from being a SpartaDOS X-formatted disk to the more 48K-friendly BeweDOS version 1.30 (pronounced Bay-Vay or Bay-Way Dos).

I also re-created the “WELCOME TO PL65” program using screenshots included in the recent eBay auction mentioned earlier. It was missing in the original AtariAge-cracked disk images. The greeting program is found in the file AUTOEXEC.SYS.

Originally PL65 was distributed on an Atari DOS II version 2.5 diskette. Copy protection was enforced by having the compiler stomp over your object code using XOR if it discovered it was not running on the original diskette. For what it’s worth, my version of the “WELCOME TO PL65” program uses the BeweDOS CIO command 40 with AUX1 = 128 to perform the binary load/run needed to launch the compiler and editor. This CIO command is undefined in Atari DOS II, so my program won’t run properly there.

If you are new to BeweDOS, like I am, note that, unlike the menu-driven Atari DOS II operating systems, it uses a command-line interface. To save space on the diskette, I didn’t include all the BeweDOS utilities in the DOS directory. Here are some essential BeweDOS 1.30 commands:

DIR - List contents of the current working directory
CWD - Change current working directory. Path separator is ">".
      For example, to visit the DOS directory, type "CWD >DOS" 
      To return to the root directory, type "CWD >"
ERASE - Delete a file. 
        For example "ERASE MYFILE.PRG"
Dn:  - To switch to another device. For example to switch to
       drive 2, type "D2:". To return to drive 1, type "D1:".

To execute a binary file, usually named with the .COM extension,
simply type the name of the file. If named properly, you may skip the extension.
For example, to run the KED editor, type "KED.COM" or just "KED"

Hello World in Noahsoft’s PL65 for the Atari 400/800

As a brief diversion before diving into coding Structris in PL65, I wanted to share some of the flavor of PL65. First by sharing a minimal “Hello World” example. And later, by adding a few more lines of code that showcase some of the features of the language.

Example Program 1

INCLUDE D:TERMINAL.LIB
MAIN()
BEGIN
  WRTLN("HELLO, WORLD!")
END

To spare you the trouble of reading through the PL65 manual, here are some notes about the example program:

  • No line numbers. Oy! Up, Scumbag!
  • PL65 uses the ALGOL concept of organizing code blocks which are defined by the bounding keywords “BEGIN” and “END”.
  • Every program must have a “MAIN” procedure. It is the code block that will be executed first.
  • The “WRTLN” procedure prints text to the terminal display. It appends a carriage return.
  •  The WRTLN procedure is defined in an external library file, TERMINAL.LIB, that must be included at compile-time. PL65 is a single-pass compiler, therefore all procedures and functions must be defined before they can be called.

Example Program 2

INCLUDE D:GRAPHICS.LIB

PROC HOME()
BEGIN
  WRTSTR(CHR$(125))
END

MAIN()
INT I
BEGIN
  HOME()           ! CLEAR SCREEN
  SETCOLOR(2,4,0)  ! CHANGE BACKGROUND
  I=0
  WHILE I<$0A DO   ! WHY NOT USE HEX
    WRTSTR(STR$(I)) WRTSTR(":")
    WRTLN("RETROCHALLENGE 2015/01")
    I=I+1
  ENDWHILE
  REPEAT FOREVER
END
  •  HOME() is an example of a user-defined procedure. In this case, the magic ATASCII character #125 is used to clear the screen and move the cursor to the home position.
  • The GRAPHICS library is included so we can use the SETCOLOR procedure to change the playfield background color (register 2) to dark lavender (color 4, intensity 0). The GRAPHICS library itself includes TERMINAL and STRING libraries that would otherwise be needed for WRTSTR, WRTLN, and STR$.
  • The WHILE/ENDWHILE loop uses a 2-byte integer variable, “I”, which is defined just before the start of the code block. A pitfall looms in that someone may be tempted to declare and initialize the variable using “INT I = 0”. While this is legal, it actually tell the compiler to use addresses $00/$01 (LO/HI) to store integer “I”.
  • The REPEAT/FOREVER is an empty loop construct. It could have other statements between the keywords similar to the WHILE/ENDWHILE example.
  • The language allows numeric values to be represented in decimal, hexadecimal, and binary.

Next Up…

Mimicking (well, as close as possible) Apple’s Lo-Res graphics mode using the Atari display list.