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

no-image

ST20-C1

Manufacturer Part Number
ST20-C1
Description
Instruction Set Reference Manual
Manufacturer
STMICROELECTRONICS [STMicroelectronics]
Datasheet
4.2 Loading and storing
normally used for local variables on the stack while non-local addressing is normally
used for all other variables.
The primary instructions ldl and stl perform loading and storing of local variables. For
example to load a value x words above the Wptr and write to a location y words above
the Wptr:
The primary instructions ldnl and stnl perform loading and storing of non-local vari-
ables. For example, to load a value x above a base address x_base and store to a
location y words above y_base , where x_base and y_base are held in local variables:
Note that for the purposes of this manual, ld X denotes loading the value from a
variable X , where X may be a local or non-local variable, so either ldl or ldnl may be
used as appropriate. Similarly st X denotes storing a value into a variable X , where X
may be a local or non-local variable, so either stl or stnl may be used.
4.2.3
Instructions are provided for loading and storing byte and half-word variables. In each
case, the address is initially in the Areg and is incremented by the size of the object,
so that repeated loads and stores can be used to copy a block of memory.
The load instructions place the loaded value in the Areg, the incremented address in
the Creg and leave the Breg unaffected. The store instructions write the initial Breg
into memory at the address in the Areg, leaving the incremented address in the Breg,
the initial Creg in the Areg and the initial Breg pushed down to the Creg.
Byte loading and storing
lbinc loads the byte at the address in Areg, into the evaluation stack. lbinc replaces
the address in Areg with the byte stored at that address, treating it as an unsigned
integer by setting the twenty-four most significant bits in Areg to 0. The incremented
address is left in Creg.
sbinc writes the least significant b yte in Breg to the location addressed by Areg. The
address is incremented by 1 and put in the Breg.
Half-word loading and storing
lsinc and lsxinc load the half-word object at the address in Areg, into the evaluation
stack. lsinc replaces the address in Areg with the half word, treating it as an unsigned
integer by setting the sixteen most significant bits in Areg to 0. lsxinc is similar to lsinc ,
but treats the half-word as a signed integer in twos-complement format, and hence
sign extends the representation by setting the sixteen most significant bits in Areg to
the same value as the most significant bit of the half-word object. Sign extension is
discussed in section 4.4.6.
32/205
ldl x;
stl y;
ldl x_base; ldnl x;
ldl y_base; stnl y;
Byte and half-word values

Related parts for ST20-C1