beautypg.com

Sub subtract (word) – Zilog Z80380 User Manual

Page 207

background image

5-173

Z380

U

SER

'

S

M

ANUAL

Z

ILOG

DC-8297-03

SUB

SUBTRACT (WORD)

SUB HL,src

src = DA

Operation:

if (XM) then begin

HL(31-0)

HL(31-0) - src(31-0)

end

else begin

HL(15-0)

HL(15-0) - src(15-0)

end

The source operand is subtracted from the HL register and the difference is stored in the
HL register. The contents of the source are unaffected. Two's complement subtraction is
performed. Note that the length of the operand is controlled by the Extended/Native mode
selection, which is consistent with the manipulation of an address by the instruction.

Flags:

S:

Unaffected

Z:

Unaffected

H:

Set if there is a borrow from bit 12 of the result; cleared otherwise

V:

Unaffected

N:

Set

C:

Set if there is a borrow from the most significant bit of the result; cleared otherwise

Addressing

Execute

Mode

Syntax

Instruction Format

Time

Note

DA:

SUB HL,(nn)

11101101 11010110 -n(low)- -n(high)

2+r

I, X