Friday, November 4, 2022

Apple IIe - Apple Pascal 1.3 - Getting to "Hello, World!"

Now that we have an Apple Pascal 1.3 setup going, see Apple IIe - Apple Pascal 1.3 - Setup & Configuration for getting started, let's create the classic "Hello, World!" program.

So, you go through some interesting steps to create a program file to compile and run. Instead of the more familiar UNIX or DOS command line command structure I'm used to using, the Pascal OS has a menu system to execute commands.

I won't go into great detail here. The reference, https://archive.org/details/apple-ii-pascal-1.3, explains file management. I will go through the commands for a basic hello world program.

You may recall the startup screen is as follows:

Command: F(ile, E(dit, R(un, C(omp, L(ink, X(ecute, A(ssem, ? [1.3]


Welcome APPLE1, to Apple II Pascal 1.3

Based on UCSD Pascal II.1

Current date is 10-Apr-90

Pascal system size is 68K


Copyright Apple Computer 1970,1980,1983,1984,1985

Copyright U.C. Regents 1979

The top line is the command menu. 

1. Type "E" to edit a file. This opens the work file for editing. 
2. Type "I" to change to insert mode.
2. Type in your program:

PROGRAM HELLO;
BEGIN
    WRITELN('HELLO, WORLD!')
END.

3. When you have completed typing, press CTRL+C to exit insert mode.
4. Type "Q" to quite the editor.
5. Type "U" to update the work file.
6. Type "E" to leave the editor to the command line. 

To compile, type "C". You will be prompted to list the file. Press Return for none.
Compiling will start.

Here is where I ran into problems. I received a stack overflow error for a simple one line program. I tried adding a switching compiler directive by adding "{$S+}" as the first line of the source. The stack overflow went away, but I received a "Error in factor (bad expression)" error on the "END." statement. Nothing I tried would get it to compile. I typed in a small example program from the reference above, same issue.

So, I tried other sets of disks hoping that the issue was a corrupted disk set. I tried leaving the OS set for 64K instead of 128K. I tried it on my Apple IIe and on AppleWin with the same results.

Finally, I downloaded Apple Pascal 1.1 and tried it. The same program that would not compile, compiled just fine under version 1.1.

I don't know what the problem is. I'll continue using Apple Pascal 1.1 until I can sort it out.

No comments:

Post a Comment