3 processing register data, User data – Toshiba T2N User Manual
Page 189
3. User Data
176
PROSEC T2N
It has already been explained the a register is “a location which houses
16 bits of data”. In the T2N instruction words, the the following types of
data can be processed using single registers or multiple consecutive
registers.
*
Unsigned integers (integers in the range 0 to 65535)
*
Integers (integers in the range -32768 to 32767)
*
BCD (integers in the range 0 to 9999 expressed by BCD code)
*
Unsigned double-length integers (integers in the range 0 to
4294967295)
*
Double-length integers (integers in the range -2147483648 to
2147483647)
*
Double-length BCD (integers in the range 0 to 99999999
expressed by BCD code)
*
Floating point data (real number in the range -3.40282
✕
10
38
to
3.40282
✕
10
38
)
However, there are no dedicated registers corresponding to the types for
processing these types of data. The processing of the register data
varies according to which instruction word is used.
In other words, as shown in the following example, even when the same
register is used, if the data type of the instruction word differs, the
processing of the register data will also differ.
Example)
When the value of D0005 is HFFFF (hexadecimal FFFF):-
(1)
In a comparison instruction (greater) without sign,
–[
D0005 U > 100
]–
decision output (ON when true)
The value of D0005 is regarded as 65535 (unsigned integer),
therefore it is judged to be greater than the compared value (100)
and the output of the instruction becomes ON.
(2)
In a comparison instruction (greater) with sign,
–[
D0005 > 100
]–
decision output (ON when true)
The value of D0005 is regarded as -1 (integer), therefore it is
judged not to be greater than the compared value (100) and the
output of the instruction becomes OFF.
In this way, since there is no classification of registers by data type, it is
possible to execute complex data operations provided their use is
thoroughly understood. However, in order to make the program easier to
see, it is recommended that registers be used by allocation by data
types (1 register is processed by 1 data type) as far as possible.
3.3
Processing Register Data