AMOS:Terminology

From Amiga Coding
Jump to: navigation, search

Tokens

AMOS is an interpreted, BASIC-like language. You work in AMOS's built-in source code editor. Your code is stored in memory as tokens; each BASIC keyword is represented by a 2-byte number. You edit each line in your program as text, but once you finish editing any line in your program and move onto the next, the line is (re-)converted to tokens.


Just because your code can be tokenised, it doesn't mean that it works. Whenever you run a program, AMOS "tests" it, checking it for any syntax errors or other errors that can be detected before running the program. If any errors are found, AMOS jumps to this line and shows you the error code, rather than running the program. You can do this at any time, without running the program, by pressing the "Test" button. You can save your source code to disk, regardless of whether your code has passed the test or not. It is saved as a collection of tokens. To allow other programs, particularly the AMOS Compiler, to avoid having to do the same syntax check, AMOS records in the saved file whether the source was tested or not.


Extensions

AMOS not only includes the core language, it has these things called "extensions". These are written by assembly code, not AMOS, and they add more commands to the AMOS language. Each extension is intended to be loaded into a specific "slot": AMOS has 25 "slots" for extensions. Some extensions can work in any slot, but you should stick to the recommended slot, because when you use extension instructions, the slot number gets saved into your source code. If you move the extension to another slot, suddenly your source code doesn't work any more. If you look at the source code in AMOS without the extension, your code just has "Extension M" or "Extension L" or another letter of the alphabet where your extension-specific command once was. When you try and test or run your program, AMOS says "Extension Not Loaded" at you.


Sometimes, two extensions want to use the same slot; they can't do this, you can only have one or the other. Your choice of extensions, along with all other global settings, are stored in AMOS's config file. This is "AMOS1_3_PAL.env", "AMOS1_3_NTSC.env" or "AMOSPro_Interpreter_Config", depending on your AMOS version.


Banks

In order to work with multimedia such as pictures and music, AMOS has this concept of a "memory bank". You can have up to 15 memory banks. For example, you can load several pieces of music into different memory 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".


While you can load anything into any bank, some of the commands 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 you have memory banks in use while saving your source code, the contents of the banks get saved along with them. This makes it easy to bundle your code with the data it works on. The exception to this is banks created with the "Reserve As Work" instruction.