CHAPTER 11 INSTRUCTION SET
268
User’s Manual U10676EJ3V0UM
SUBS XA, rp’
Function:
XA
←
XA – rp’; Skip if borrow.
Subtracts the contents of register pair rp’ (XA, HL, DE, BC, XA’, HL’, DE’, or BC’) from the contents of register
pair XA, and sets the result to register pair XA. If a borrow occurs as a result, the next instruction is skipped.
The carry flag is not affected.
Application example
To compare specified data memory contents with the contents of a register pair
MOV
XA, mem
SUBS
XA, rp’
; (mem)
≥
rp’
; (mem) < rp’
SUBS rp’1, XA
Function:
rp’
←
rp’1 – XA; Skip if borrow.
Subtracts the contents of register pair XA from register pair rp’1 (HL, DE, BC, XA’, HL’, DE’, or BC’), and sets the
result to specified register pair rp’1. If a borrow occurs as a result, the next instruction is skipped.
The carry flag is not affected.
SUBC A, @HL
Function:
A, CY
←
A – (HL) – CY
Subtracts the contents of the data memory addressed by register pair HL to the contents from the A register,
including the carry flag, and sets the result to the A register. If a borrow occurs as a result, the carry flag is set; if
not, the carry flag is reset.
If the ADDS A, #n4 instruction is placed next to this instruction, and if a borrow does not occur as a result of executing
this instruction, the ADDS A, #n4 instruction is skipped. If a borrow occurs, the ADDS A, #n4 instruction is executed,
and a function that disables the skip function of the ADDS A, #n4 instruction is effected. Therefore, these instructions
can be used in combination for base number adjustment (refer to
11.1.4 Base number adjustment instruction
).
SUBC XA, rp’
Function:
XA, CY
←
XA – rp’ – CY
Subtracts the contents of register pair rp’ (XA, HL, DE, BC, XA’, HL’, DE’, or BC’) from the contents of register
pair XA, including the carry, and sets the result to register pair XA. If a borrow occurs as a result, the carry flag is
set; if not, the carry flag is reset.