To create a new or edited an existing Atari Pascal program, an editor is required. Unlike Atari BASIC, which includes the editor and interpreter in one cartridge, the Atari Pascal Language System doesn’t include an editor. To start, we will use the recommended/required Atari Program-Text Editor to edit our Pascal source code.
What is the Atari Program-Text Editor? The Atari Program-Text Editor, also known as MEDIT, is a versatile text editing tool that can be used to create and modify Atari Pascal source code files. Like Atari Pascal Language System, this product was available through the Atari Program Exchange. It could be purchased individually or as part of the Atari Macro Assembler package.
For our purposes, you can find a disk image of the Atari Program-Text Editor on the Atarimania website: http://www.atarimania.com/utility-atari-400-800-xl-xe-atari-program-text-editor_18535.html
Download and unzip the Atari Program-Text Editor. You should end up with a disk image, "Program-Text Editor.atr". Load it in to disk drive D1 in Altirra and reboot the emulator. You should see the Atari DOS menu.
Use the DOS Disk Directory option to see the contents of the "Program-Text Editor.atr" disk image in disk drive D1.
You should see the two Atari DOS files DOS.SYS and DUP.SYS as well as three other files. The MEDIT (no filename extension) is the one that we are interested in.
Use the DOS Binary Load option L to load the MEDIT file.
Once we have a working copy of the Atari Program-Text Editor, let's integrate it with the Atari Pascal Language System.
The Atari Pascal monitor menu provides an option, (E)dit, to call the Atari Program-Text Editor. The default value of this option is disk drive D2. Out of the box, if you attempted to use the Edit command from the Atari Pascal monitor menu, you will get a MEDIT not found message. Why? The Atari Pascal Language System expects MEDIT to be available on disk drive D2. In addition, MEDIT needs a minor modification for it to work with the Atari Pascal Language System. You will need to repeat this minor modification each time you copy MEDIT over to a new project disk. Or better yet, create a "prepared" blank MASTER SOURCE disk image with MEDIT already copied over. Than make copies of this MASTER SOURCE disk image for each new Atari Pascal project.
With the "PROGRAM-TEXT EDITOR.ATR" disk image in disk drive D1, reboot the Altirra emulator. The DOS menu should be displayed. Create a new blank disk image named "MASTER-SOURCE.ATR" in disk drive D2. Use the Atari DOS FORMAT DISK option I to format the "MASTER-SOURCE.ATR" disk image in disk drive D2. Use the Atari DOS WRITE DOS FILES option H to write Atari DOS files to the "MASTER-SOURCE.ATR" disk image in disk drive D2. Use the Atari DOS DISK DIRECTORY option A on disk drive D2 to verify the DOS files have been written.
Copy the MEDIT executable from the "PROGRAM-TEXT EDITOR.ATR" disk image in disk drive D1 to the "MASTER-SOURCE.ATR" disk image in disk drive D2. You should be familiar with using the DOS menu to copy a file from disk drive D1 to disk drive D2. Once the file is copied over to disk drive D2, use the Atari DOS DISK DIRECTORY option A on disk drive D2 to verify that the file, MEDIT, is indeed on the disk image in disk drive D2.
Once the MEDIT file is on the disk image in disk drive D2, in Altirra, detach the two disks by clicking File → Detach Disk → All. Then attach the "MASTER-SOURCE.ATR" disk image to disk drive D1 by clicking File → Attach Disk → Drive 1 and select the "MASTER-SOURCE.ATR" disk image. Reboot the Altirra emulator.
Use the DOS menu CREATE MEM.SAV option N to create a MEM.SAV file on the "MASTER-SOURCE.ATR" disk image in disk drive D1. At the DOS menu enter N and press the RETURN/ENTER key. At the “TYPE “Y” TO CREATE MEM.SAV” prompt, enter Y and press the RETURN/ENTER key. Verify that the MEM.SAV file now resides on the "MASTER-SOURCE.ATR" disk image in disk drive D1.
Using the DOS menu option L, BINARY LOAD MEDIT using the /N (MEDIT/N) option to prevent it from running. This will update the MEM.SAV file on the "MASTER-SOURCE.ATR" disk image in disk drive D1
Using the DOS menu option K, BINARY SAVE, save (append) it back as follows: MEDIT/A, 2600, 2601.
This append operation tells the Atari Pascal Language System Monitor (E)dit command to begin execution at the MEDIT entry point. For more information, see page 24 of the Atari Pascal Language System Reference And Operations Manual.
In Altirra, load the APXPAS1.ATR disk image in disk drive D1, File → Disk Drives… and select the APXPAS1.ATR disk image. Set the disk drive D1 option to R/W. Load the "MASTER-SOURCE.ATR" disk image in disk drive D2. Reboot the Altirra emulator. Use the DOS menu to load the PASCAL menu from disk drive D1.
From the Atari Pascal menu, you should now be able to use the EDIT command. Alternatively, you can load the Atari Program-Text Editor from the DOS menu using the BINARY LOAD command the entering D2:MEDIT. After a few moments, the Atari Program-Text Editor should load.
You can use the Atari DOS DELETE FILES(S) option D to delete the D2:MEM.SAV files from the "MASTER-SOURCE.ATR" disk image in disk drive D2. It is no longer needed.
Keep this "MASTER-SOURCE.ATR" disk image as a MASTER since it is now prepared to allow using the Atari Program-File Editor/MEDIT from the Atari Pascal Language System Monitor Menu (E)dit option. Makes a copy of the "MASTER-SOURCE.ATR" disk image for each new Atari Pascal program or project.
Now we will create a simple Hello, World! Atari Pascal program.
In Windows, make a copy of the "MASTER-SOURCE.ATR" disk image and rename it to "HELLOW.PAS". Load the APXPAS1.ATR disk image in disk drive D1 and load the new "HELLOW.PAS" disk image in disk drive D2. Reboot the Altirra emulator and load the Pascal software from the DOS menu.
From the Atari Pascal menu, you should now be able to use the EDIT command.
At the "FILENAME IS" prompt, enter "D2:HELLOW.PAS", then ENTER. Make sure that you use D2: before the filename otherwise the file will end up on the the D1 disk image.
Enter the following program:
Once the program is entered, press the Atari OPTION key (F4 in Altirra) to change from EDIT mode to COMMAND mode.
In COMMAND mode, type EXIT, then press the Atari START key (F2 in Altirra) to SAVE the file and exit the editor. This should return the Altirra emulator to the Atari DOS menu.
Use the DOS L command to load Atari Pascal.
From the Pascal Monitor menu, use the (C)ompile command to compile the program:
D2:HELLOW.PAS
From the Pascal Monitor menu, use the (L)ink command to link the program:
LINKER V1.0
*D2:HELLOW,PASLIB/S
From the Pascal Monitor menu, use the (R)un command to run the program:
D2:HELLOW.COM
When you run the program, it should look like:
Press the RETURN/ENTER key to exit the program.
As you can see, we can modify the Atari Program-Text Editor/MEDIT program to make is available from the Atari Pascal Language System Monitor Menu (E)dit command. MEDIT is a powerful program with lots of commands. Unfortunately, it only works in 40 columns which makes editing Pascal programs cumbersome.
Next up, we will look at using a virtual Atari XEP80 interface and the AtariWriter 80 word processing program with the Altirra emulator, which will allow us to edit our source files in a full 80 columns.
For more information on using the Atari Program-Text Editor, see:
No comments:
Post a Comment