ST20-C1 STMICROELECTRONICS [STMicroelectronics], ST20-C1 Datasheet - Page 48

no-image

ST20-C1

Manufacturer Part Number
ST20-C1
Description
Instruction Set Reference Manual
Manufacturer
STMICROELECTRONICS [STMicroelectronics]
Datasheet
4.9 Shifting and byte swapping
4.8.1
Bits of a word in memory may be tested and set or cleared by the instruction rmw . The
address of the memory word is held in Areg and a bit masks in Breg and Creg. rmw
clears the bits of the memory word that are set in Creg, and then sets the bits of the
memory word that are set in Breg.The initial memory word is loaded into Areg, with
Areg pushed down to Breg and Breg pushed down to Creg.
4.9
The shift and byte swapping operations are provided by the instructions listed in Table
4.11.
The shift operations ( shl , shr and ashr ) shift the operand in Breg by the number of bits
specified b y the unsigned integer in Areg and put the result in Areg. shl and shr fill the
vacated bit positions with zero bits, while ashr fills the vacated bits with copies of bit
31, which is the original sign bit. If Areg is zero, the result is the initial value of Breg.
When the value in Areg is greater than the number of bits in the object being shifted,
the result of the operation is undefined. The data previously held in Creg is popped
into Breg, and the initial Breg is left in the Creg.
swap32 reverses the order of the bytes in Areg by swapping byte 0 with byte 3 and
swapping byte 1 with byte 2.
4.10 Function and procedure calls
The function and procedure call operations are provided by the instructions listed in
Table 4.12.
The primary instruction fcall n calls a function or procedure. It stores the instruction
pointer (which holds the return address) in the word pointed to by the Wptr. The
operand to the call - n - is added to the address of the next instruction to produce the
address of the first instr uction of the procedure or function being called. Since the call
address is relative, the code is relocatable.
48/205
Memory bit test and clear or set
Shifting and byte swapping
Table 4.11 Shifting and byte swapping instructions
Table 4.12 Function and procedure instructions
shl
shr
ashr
swap32
fcall
jab
ajw
gajw
Mnemonic
Mnemonic
shift left
shift right
arithmetic shift right
byte swap 32
function call
jump absolute
adjust work space
general adjust workspace
Name
Name

Related parts for ST20-C1