The APCmp Utility

What is APCmp?

Well, the AMOS Pro Compiler is really two separate programs:

  1. The Compiler Shell provides a fancy control panel which can be accessed from either the AMOS Editor or the Workbench. Amazingly, it was written entirely in AMOS Pro! All those attractive icons and powerful menu options were generated using the built-in AMOS Interface commands! So if you've yet to upgrade to AMOS Professional, it's another compelling reason to take the plunge.

  2. The actual Compiler's core code is held in a small module called APCmp (Amos Professional Compiler). It's a 68000 program which converts your AMOS or ASCII files into ultra-fast machine code. APCmp is normally loaded invisibly by the Shell, but it can also be called directly from the CLI.

APCmp is an extremely clever program which automatically configures itself to your available memory. It doesn't matter a jot if you've got a simple A500 or the latest A4000 dream machine, you'll still get terrific results from this package!

Tokenising

This is a technical term for the process of converting a list of Basic instructions into a form which can be executed directly by an AMOS Editor.

Generally the AMOS Editor tokenises your programs as you are typing them. You can see the effect whenever you move to a new line. As AMOS reads through your text, any variables and instructions are picked out and displayed in their own distinctive style.

So:

print "This is a test":a=b+5:gosub code

becomes:

Print "This is a test" : A=B+5 : Gosub CODE

The AMOS Pro Compiler can handle either tokenised AMOS programs or raw ASCII text. It works by checking the first few characters of your intended source programs and seeing if they make sense. If it recognises an AMOS program it can compile it immediately. But if it encounters an ASCII program it will load up a tokeniser from "Compiler.Lib" and automatically generate an appropriate ".AMOS" file for use with the Compiler.

The tokenisation is usually performed directly onto the disk. So the resulting ".AMOS" program file will be saved in the same folder as the original ASCII source file. If you want to speed things up though, you can store all temporary files into a ram disk. This can be selected using either the TEMP directive from the command line or by changing the default Compiler options from the Shell. The line you'll need is:

APCmp File.Asc TEMP="Ram:"

The destination file is generated directly from the source name. The Compiler removes any characters after the dot and just adds ".AMOS" to the result. So "File.Asc" would be saved as "File.AMOS"

Once the file has been successfully tokenised the new ".AMOS" file is tested and entered into the Compiler. The temporary ".AMOS" file is then deleted from disk automatically.

If an error occurs during the tokenisation you'll get an appropriate message on the screen:

Line too long at line XXX

Tokenising files only

The AMOS Pro Compiler can also be used as a simple tokeniser.

APCmp Myprog.Asc TOKEN

The TOKEN option generates a new ".AMOS" file called "Myprog.AMOS" which can be subsequently loaded directly into your AMOS Editor. The Compiler then stops in its tracks. This type of tokenisation is much faster than the MERGE ASCII command from the Editor. It's therefore ideal for converting large numbers of source files into ".AMOS" format.

Testing

The AMOS Pro Compiler only works with tested programs. So if it encounters a file which hasn't been checked, it will need to test it first. This applies to both native ".AMOS" programs and ASCII files which have been tokenised by the Compiler.

If it does require testing then APcmp will load a series of routines from "Compiler.Lib" and check the program automatically. The program will then be entered straight into memory and tested just as if you'd tested it from the Editor.

If an error occurs it will be reported as normal using the error messages from the "S:AMOSPro_Interpreter_Config" file. The Compiler will then abort the compilation.

The AMOS.Library

AMOS Pro users must have a copy of this library installed in the "LIBS:" folder of their current start up disk. It contains all those vital screen display routines which make AMOS programs so special.

The original AMOS Compiler saved a separate copy of these routines with each compiled program, This resulted in a 45K increase in the final program size of compiled programs.

APCmp avoids this overhead by sharing a single library file between all your compiled programs. The only snag is that you'll need to keep a permanent copy of the "AMOS.Library" on your boot disk.

However, if you want to create truly independent programs, you can force the Compiler to revert to the original scheme. Just add the INCLIB directive to the end of your command line like so:

APCmp MyProg.AMOS INCLIB

If you're using the Compiler Shell, you can achieve the same effect by selecting the "Include AMOS.library in compiled program?" option from the "Compiled Program Setup" menu. Each program will now include its own individual copy of the AMOS,library.

The Compiler Configuration

The Compiler stores its various configuration settings in the "S:" folder of your current boot disk. Unlike the old AMOS system, these files are not in text format and can't be modified with a standard text editor. They should only be changed using the dedicated "Setup" option from the Compiler Shell.

Internal buffers

In the original AMOS Compile, it was occasionally necessary to increase the Compiler buffers in order to compile very large AMOS programs. This process is now completely automatic.