# AMOS programming language

This article by Dan Polansky briefly looks at AMOS programming language for the Amiga line of computers (Motorola 68k-based computers strong on graphics and sound for games at their heyday), which is a structured and procedural dialect of BASIC with certain batteries included, especially those suitable for programming of simple games. The article intends to go beyond the Wikipedia article in providing a better idea about the language and supporting anyone curious enough to want to run AMOS in an Amiga emulator for Windows and play around with it.
AMOS was originally interpreted, but later, a compiler was made for it.
The source code files are stored in a binary form rather than as plain text file.
The source code editor features folding of procedures.
AMOS facilities:
* Structured and procedural programming: procedure, if, while loop, repeat until loop, etc.
* Call to assembly loaded from a binary file into a memory bank.
* Direct memory access via poke and peek.
* Create screens.
* Plot on screens.
* Load images from files and place them on screens.
* Play animations.
* Control hardware sprites.
* Play sound samples loaded from files.
* Play music modules loaded from files in the background.
* Read keyboard and joystick.
* Etc.

## Example code

Variables, data types and literals:
Control structures:
Procedures:
Plotting graphics:
Music and samples:
Low-level access:
See Game Duenix for Amiga computers for more plentiful examples of various AMOS facilities.
Complete guides to the language from the original language publishers are in the further reading at the end.

## Limitations

Limitations include the following:
* No support for pointers.
* No support for data structures (struct in C language).
* No support of control of Amiga Workbench (windowing for AmigaOS) windows, unlike Amiga Basic by Microsoft. Instead, AMOS operated on its own fully controlled screens, taking over the complete display.

## Software developed in AMOS

Based on Wikipedia:
* Flight of the Amazon Queen, a point-and-click adventure game
* Scorched Tanks, a game
* Valhalla game trilogy
* Ultimate Domain, also called Genesia, a game
* Jetstrike, a game
* Black Dawn, a game
Further reading:
* Games made in AMOS, mobygames.com
* Amiga Longplay Flight Of The Amazon Queen, youtube.com
* Flight of the Amazon Queen — A 20th Anniversary Retrospective by John Passfield, 2015, medium.com -- mentions AMOS

## Alternatives and competition

Alternative BASIC implementations for the Amiga, competing with AMOS during its heyday:
* Amiga Basic from Microsoft. Allows control of and painting on Amiga Workbench windows.
* Blitz Basic, in which e.g. an early version of the Worms game by Team17 was written.
* GFA BASIC

## Performance

Given the kind of facilities AMOS has, there seems to be no obvious reason why compiled AMOS could not be as fast as the C language. An empirical performance comparison is missing. It seems unlikely that compiled AMOS was as fast as C, but it is unclear what the case actually is and why that is. AMOS compiler itself was not written in C but in assembly.
One area where AMOS is expected to get slow is strings and their operations such as concatenation. I (Dan Polansky) remember writing a text format conversion tool in AMOS; I started using the built-in string facilities, but it was very slow and I could only make it perform well by switching to low-level facilities directly working with bytes and their sequences.
Compared to Blitz Basic, user Predseda tells us Blitz Basic is faster than AMOS (merely a hint since hearsay, but plausible enough).