Omron C60K Video Game Controller User Manual


 
120
5-16 BCD Calculations
The BCD calculation instructions perform mathematic operations on BCD
data.
These instructions change only the content of the words in which results are
placed, i.e., the contents of source words are the same before and after exe-
cution of any of the BCD calculation instructions.
STC(40) and CLC(41), which set and clear the carry flag, are included in this
group because most of the BCD operations make use of the carry flag (CY)
in their results. Binary arithmetic and shift operations also use CY.
The addition and subtraction instructions use CY in the calculation as well as
in the result. Be sure to clear CY if its previous status is not required in the
calculation, and to use the result placed in CY, if required, before it is
changed by execution of any other instruction.
5-16-1 BCD ADD – ADD(30)
Au : Augend word (BCD)
IR, SR, DM, HR, TC, #
Ad : Addend word (BCD)
IR, SR, DM, HR, TC, #
Ladder Symbol
Operand Data Areas
R : Result word
IR, DM, HR
ADD(30)
Au
Ad
R
When the execution condition is OFF, ADD(30) is not executed and the next
instruction is moved to. When the execution condition is ON, ADD(30) adds
the contents of Au, Ad, and CY, and places the result in R. CY will be set if
the result is greater than 9999. Au and Ad should not be designated as con-
stants. This instruction will be executed every cycle as long as the execution
condition remains ON. If the instruction is to be executed only once for a giv-
en ON execution condition then it must be used in conjunction with DIFU(13)
or DIFD(14).
Au + Ad + CY CY R
ER: Au and/or Ad is not BCD.
CY: ON when there is a carry in the result.
EQ: ON when the result is 0.
Description
Flags
BCD Calculations Section 5-16