Texas Instruments MSC1210 User Manual
Page 52
Description
4-2
4.1
Description
A number of MSC1210 registers can be considered basic. Very little can be
done without them and a detailed explanation of each one is warranted to
make sure the reader understands these registers before getting into more
complicated areas of development.
4.2
Accumulator
The accumulator is a familiar concept when working with any assembly lan-
guage.
The accumulator, as its name suggests, is used as a general register to accu-
mulate the results of a large number of instructions. It can hold an 8-bit (1-byte)
value and is the most versatile register of the MSC1210, due to the shear num-
ber of instructions that make use of the accumulator. More than half of the 255
opcodes of the MSC1210 manipulate or use the accumulator in some way.
For example, if adding the numbers 10 and 20, the resulting 30 will be stored
in the accumulator. Once a value is in the accumulator, it may continue to be
processed, or may be stored in another register or in memory.
4.3
R Registers
The R registers are sets of eight registers that are named R0 through R7.
These registers are used as auxiliary registers in many operations. To contin-
ue with the previous example of adding 10 and 20, the original number 10 may
be stored in the accumulator, whereas the value 20 may be stored in, say, reg-
ister R4. To process the addition, the following command would be executed:
ADD A,R4
After executing this instruction, the accumulator will contain the value 30.
The R registers are considered as very important auxiliary, or helper, registers.
The accumulator alone would not be very useful if it were not for these R regis-
ters.
The R registers are also used to store values temporarily. For example, add
the values in R1 and R2 together and then subtract the values of R3 and R4.
One way to do this would be:
MOV A,R3
;Move the value of R3 into the accumulator
ADD A,R4
;Add the value of R4
MOV R5,A
;Store the resulting value temporarily in R5
MOV A,R1
;Move the value of R1 into the accumulator
ADD A,R2
;Add the value of R2
SUBB A,R5
;Subtract the value of R5 (which now contains R3 + R4)
As shown, R5 was used to temporarily hold the sum of R3 and R4. Of course,
this is not the most efficient way to calculate (R1 + R2) − (R3 + R4), but it does
illustrate the use of the R registers as a way to store values temporarily.