Amos Professional Manual  Contents  Index

AMAL


A logical AND operation is performed between this bit-mask and the random number to generate the final result, so setting the bit-mask to a value of 255 would return numbers in the range 0 to 255.

To optimise speed, the number returned is not truly random, and if true random numbers are needed, they may be generated by the Basic instruction RND and then loaded into an external AMAL register using AMREG.

There is a tutorial available on the AMAL functions in the following file:

LD> Load "AMOSPro Tutorial:Tutorials/AMAL/AMAL_3.AMOS"

Calling an AMAL program from AMOS Professional

AMAL
instruction: call an AMAL program
Amal channel number,"instruction string"
Amal channel number,program number
Amal channel number,memory bank address
Amal channel number,"instruction string" To address

The AMAL command is used to assign an AMAL program to an animation channel. This program can be taken from an instruction string, or it may be taken directly from the AMAL memory bank. In either case, the AMAL instruction is followed by the channel number to be assigned, ranging from 0 to 63.

Each channel can be independently assigned to a Sprite, or a Bob, or a screen.

Only the first 16 AMAL programs, assigned to channels 0 to 15, can be performed using interrupts. Channels 16 to 63 must be executed directly from Basic using the SYNCHRO command, which is explained elsewhere in this Chapter.

There is also a version of the AMAL command provided for advanced users. In this version, the contents of registers X,Y and A are copied into a specific area of memory. This information can then be used in AMOS Professional Basic routines, which means that AMAL can be exploited to animate anything from an individual character, to a graphical block. The format used by this technique is as follows:

X> Amal channel number,A$ To address

The address must be even, and point to a safe memory location, preferably in an AMOS Professional string, or memory bank. The AMAL program is executed every 50th of a second, and the following values will be written into the specified memory area:

Location   Effect
Address    Bit 0 This is set to 1 if X register has changed
           Bit 1 This indicates that Y register has changed
           Bit 2 This is set if image (A) has changed since last interrupt
Address+2  This is a word containing the latest value of X
Address+4  Holds the current value of Y
Address+6  Stores the value of A
 
Back    Next
07.06.11