Mitsubishi Electronics FXCPU Video Game Controller User Manual


 
9 Applied Instructions (Arithmetic and Logical Operation)
9.1 ADDP / Addition
169
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
1
Outline
2
Instruction List
3
Configuration of
Instruction
4
How to Read
Explanation of
Instructions
5
Basic Instruction
6
Step Ladder
Instructions
7
Applied Instructions
(Program Flow)
8
Applied Instructions
(Move and
Compare)
9
Applied Instructions
(Arithmetic and
Logical Operation)
10
Applied Instructions
(Rotation and
Shift Operation)
Function and operation explanation
1. 16-bit operation(ADDP)
The data specified by and are added in the binary format, and the addition result is transferred to
the device specified by .
The most significant bit of each data indicates the sign (positive: 0 or negative: 1), and data is added
algebraically.
5+(-8)=-3
When a constant (K) is specified in or , it is automatically converted into the binary format.
2. 32-bit operation(DADD, DADDP)
The data specified by and are added in the binary format, and the addition result is transferred to
the device specified by .
The most significant bit of each data indicates the sign (positive: 0 or negative: 1), and data is added
algebraically.
5,500+(-8,540)=-3,040
When a constant (K) is specified in or , it is automatically converted into the binary format.
Related device
1. Relationship between the flag operation and the sign
For the flag operations, refer to Section 1.3.4.
Device Name Description
M8020 Zero
ON : When the operation result is 0
OFF : When the operation result is not 0
M8021 Borrow
ON : When the operation result is less than -32,768 (in 16-bit operation) or -2,147,483,648 (in
32-bit operation), the borrow flag operates.
OFF : When the operation result is not less than -32,768 (in 16-bit operation) or
-2,147,483,648 (in 32-bit operation)
M8022 Carry
ON : When the operation result is more than 32,767 (in 16-bit operation) or 2,147,483,647 (in
32-bit operation), the carry flag operates.
OFF : When the operation result is not more than 32,767 (in 16-bit operation) or
2,147,483,647(in 32-bit operation)
Command input
Addition data 1
Device storing
the addition result
ADDP
EN
s1
s2
ENO
d
Addition data 2
+
ds1 s2
Addition data 1
Addition data 2
Command input
DADD
EN
s1
s2
ENO
d
Device storing
the addition result
s1 s2 s2
[ +1, ] + [ +1, ] [ +1, ]
s1 d d
Zero flag
Borrow flag
Zero flag
Borrow flag
The most significant
bit of data
becomes "1".
Zero flag
Carry flag
Zero flag
Carry flag
Zero flag
Zero flag
The most significant
bit of data
becomes "0".
–1, 0, 1
–2, –1, 0, –32,768
32,767, 0, 1, 2
2, –1, 0, –2,147,483,648
–1, 0, 1
2,147,483,647, 0, 1, 2