7540 Group User’s Manual
3-89
APPENDIX
(2) Decimal calculations
Execution of decimal calculations
The
ADC
and
SBC
are the only instructions which will yield proper decimal notation, set the
decimal mode flag (D) to “1” with the
SED
instruction. After executing the
ADC
or
SBC
instruction,
execute another instruction before executing the
SEC
,
CLC
, or
CLD
instruction.
Notes on status flag in decimal mode
When decimal mode is selected, the values of three of the flags in the status register (the N, V,
and Z flags) are invalid after a
ADC
or
SBC
instruction is executed.
The carry flag (C) is set to “1” if a carry is generated as a result of the calculation, or is cleared
to “0” if a borrow is generated. To determine whether a calculation has generated a carry, the C
flag must be initialized to “0” before each calculation. To check for a borrow, the C flag must be
initialized to “1” before each calculation.
(3) JMP instruction
When using the
JMP
instruction in indirect addressing mode, do not specify the last address on a
page as an indirect address.
(4) Interrupts
The contents of the interrupt request bit do not change even if the BBC or BBS instruction is
executed immediately after they are changed by program because this instruction is executed for the
previous contents. For executing the instruction for the changed contents, execute one instruction
before executing the BBC or BBS instruction.
(5) Ports
The values of the port direction registers cannot be read.
That is, it is impossible to use the LDA instruction, memory operation instruction when the T flag is
“1”, addressing mode using direction register values as qualifiers, and bit test instructions such as
BBC and BBS.
It is also impossible to use bit operation instructions such as CLB and SEB and read/modify/write
instructions of direction registers for calculations such as ROR.
For setting direction registers, use the LDM instruction, STA instruction, etc.
(6) A-D Conversion
Do not execute the STP instruction during A-D conversion.
Set D flag to “1”
↓
ADC
or
SBC
instruction
↓
NOP
instruction
↓
SEC
,
CLC
, or
CLD
instruction
Fig. 3.3.11 Status flag at decimal calculations
3.3 Notes on use