Amos Professional Manual  Contents  Index


If expression Jump label
If expression Direct label
If expression eXit

This is a specially extended version of the standard If statement used in AMAL, and it is used to simplify the testing process inside an Autotest routine. It depends on the result of a logical expression, and triggers one ,of three actions. The three alternatives are a Jump to another part of the Autotest, or a Direct change of the resumption point of a program, or an eXit from the Autotest.

Here is the example at the start of this section, re-written with the Autotest system in place:

E> Load "AMOSPro Tutorial:Objects/Sprites.abk" : Get Sprite Palette
   Sprite 8,130,50,1
   A$="AUtotest (If R1<>XM Jump Update"
   A$=A$+"If R1<>YM Jump Update else eXit"
   A$=A$+"Update: Let R0=XM; Let R1=YM; Direct M)" : Rem End of Autotest
   A$=A$+"M: Move R0-X,R1-Y,20; Wait;" : Rem Try Changing 20 to other values
   Amal 8,A$ : Amal On : Direct

If all is well, the Sprite should now be following your mouse, no matter how fast it is moved. To analyse the last example, identify how the mouse coordinates are tested every 50th of a second, using the XM and YM functions. If they remain unchanged since the last test, the Autotest is short-circuited by the eXit command, and the main program resumes exactly where it left off. But if the mouse has been moved, the Autotest re-starts the main program from label M, at the beginning, using the new coordinates in XM and YM.

For a tutorial session involving the Autotest feature, as well as a fully playable arcade game, please load the following program and remember to watch the birdie!

LD> Load "AMOSPro_Tutorial:Tutorials/AMAL/AMAL_7.AMOS"

AMAL program control from AMOS Professional Once an AMAL program has been defined, you will need to be able to execute and control it from inside an ordinary AMOS Professional program. Here are the commands provided for this purpose.

instructions: start and stop AMAL programs
Amal On
Amal On number
Amal Off
Amal Off number

AMAL ON is used to activate all AMAL programs.

Back    Next