Overview

AMOS is an interpreted BASIC dialect where code is edited and run in an integrated development environment. Every time the programmer finishes editing a line of code, it is immediately parsed into tokens. For example, typing procedure foobar and pressing the return key will change the line into Procedure FOOBAR.

Before a program can run, it will be tested to ensure it is free of syntax errors. Source code can be saved even if it is untested or fails testing, but AMOS includes a tested flag in the saved file. This is used by external software, for example the AMOS Compiler will refuse to compile an untested source code file.

Extensions

AMOS tokens are split between instructions in the core language and instructions in extensions.

Extensions are external files, written in 68000 assembler, which begin with a token table listing all the instructions they add to the language.

Each extension is intended to be loaded into a specific slot. AMOS has 25 slots for extensions. The configuration of extensions and their slots are saved in AMOS's global config file.

To load other people's source code, AMOS needs to be configured with the same versions of the same extensions that they used, in the same slots.

Banks

In order to work with multimedia such as pictures and music, AMOS has the concept of a bank or memory bank (see AMOS Memory Bank#Disambiguation for a note about terminology). An AMOS program can have up to 15 banks. For example, you can load several pieces of music into different banks, and then identify which one you want to play by a number: Track Play 5 will play music in bank 5. Or you could load a packed picture into bank 4 and say Unpack 4 to 0, which will unpack the picture onto screen 0.

While you can load anything into any bank, some instructions can only take their data from specific bank numbers. Bank 1 is used for Sprites, which are controlled with instructions beginning Sprite or Bob. Bank 2 is for Icons, which are controlled with instructions beginning Icon. Bank 3 is used for music in AMOS's native music format.

If banks are in use while saving source code, the contents of the banks are included in the saved source code. This makes it easy to bundle code with the data it works on. The exception to this rule is banks created using the Reserve As Work instruction.

Tokenised BASIC code

Tokenised BASIC code is a sequence of tokenised lines. Each tokenised line has the following format:

Field

Length

Length of this line in words (2 bytes), including this byte. To get the length of the line in bytes, double this value

1 byte

Indent level of this line. Prefix indent level + 1 spaces at the beginning of the line, or no spaces if the value is less than 2

1 byte

Sequence of tokens. Each token is at least two bytes, and all tokens are rounded to to a multiple of two bytes. Each token is individually sized. The tokens always end with a compulsory null token

varies

Some tokens have special size rules, but most are exactly 2 bytes in size.

Each token starts with a signed 16-bit number. Token values between 0x0000 and 0x004E have special printing and size rules, all other tokens are a signed offset into AMOS's internal token table. The instruction name in the internal token table is what should be printed.

AMOS Banks

AMOS banks can be found either included with AMOS source code, saved individually on disk, where they typically have the file extension .ABK.

AMOS allows for 15 banks in an program. Each bank can be located in "chip" memory, which is accessible to the Amiga's custom graphics and sound processors, or it can be located in "fast" memory, which is only accessible to the CPU.

Banks are identified by their first four bytes. They are either Sprite/Icon banks (using the ASCII identifier AmSp or AmIc), or they are "normal" memory banks, which covers all other possible bank formats (using the identifier AmBk).