Amos Professional Manual  Contents  Index

Machine Code


ROR
instruction: rotate right
Ror.B number,bin value
Ror.W number,bin value
Ror.L number,bin value

The ROR commands are similar to ROL, except they rotate numbers from left to right. As before, the number of places to be moved must be set, followed by a variable or an expression. If an expression is used, it will be treated as the address of your value. ROR can be used as a fast way of dividing any positive number by a power of two, like this:

E> A=8
   Ror.l 1,A
   Print A

BTST
function: test a bit
bit=Btst(number,value)

The BTST function tests a single binary bit in a given value. Specify the number of the bit to be tested, from 0 to 31, then give the chosen variable or expression. If the given value is an expression, it will be used as an address, so the bit will then be checked at LEEK(value) instead. Note that only bits 0 to 7 can be tested by this system, and that AMOS Professional will take your bit number and perform an automatic AND operation with 7, to ensure that it lies in the correct range.

If the test is successful, a value of -1 (True) is returned, otherwise a zero (False) is given. For example:

E> B=%1010
   Print Btst(3,B)
   Print Btst(2,B)

BSET
instruction: set a bit to 1
Bset position,value

The BSET command sets a bit to 1. Specify the bit by giving its position in a variable or an expression. If an expression is used, it will be treated as an address of a value in the Amiga's memory. If the bit number and the variable are given in the wrong order, your computer will crash!

BCHG
instruction: toggle a bit
Bchg position,value

This instruction flips a binary bit from 0 to 1, or from 1 to 0, as appropriate.

Back    Next
14.A.10