SUB r

Operation

A <- A - r

Mnemonic

SUB

Operands

r

b7b6b5b4b3b2b1b0
1 0 0 1 0 r

Description

The contents of register r are subtracted from the contents of the Accumulator, and the result is stored in the Accumulator. The r symbol identifies the registers A, B, C, D, E, H, or L, assembled as follows in the object code:

RegisterrHex
A111$97
B000$90
C001$91
D010$92
E011$93
H100$94
L101$95

Condition Bits Affected

Sis set if result is negative, otherwise it is reset.
Zis set if result is 0, otherwise it is reset.
His set if borrow from bit 4, otherwise it is reset.
P/Vis set if overflow, otherwise it is reset
Nis set.
Cis set if borrow, otherwise it is reset.

Example

If the Accumulator contains $44 and Register C contains $11, then upon the execution of

	SUB	C

the Accumulator contains $33.