Sub (Subtract Binary) (Byte) - Renesas H8/300 Series Programming Manual

Table of Contents

Advertisement

SUB (SUBtract binary) (byte)

<Operation>
Rd – Rs → Rd
<Assembly-Language Format>
SUB.B Rs, Rd
<Examples>
SUB.B R0L, R2L
<Operand Size>
Byte
<Description>
This instruction subtracts an 8-bit source register from an 8-bit destination register and places
the result in the destination register.
Only register direct addressing is supported. To subtract immediate data it is necessary to use
the SUBX.B instruction, first setting the zero flag to "1" and clearing the carry flag to "0".
The following codings can also be used to subtract nonzero immediate data.
(1)
ORC
#H'05, CCR
SUBX #(Imm – 1), Rd
<Condition Code>
I
H
— —
I: Previous value remains unchanged.
H: Set to "1" when there is a borrow from
bit 3; otherwise cleared to "0."
N: Set to "1" when the result is negative;
otherwise cleared to "0."
Z: Set to "1" when the result is zero;
otherwise cleared to "0."
V: Set to "1" if an overflow occurs;
otherwise cleared to "0."
C: Set to "1" if there is a borrow from bit 7;
otherwise cleared to "0."
(2)
#(0 – Imm), Rd
ADD
XORC #H'01, CCR
110
SUB
N
Z
V
C

Advertisement

Table of Contents
loading

Table of Contents