beautypg.com

Sub subtract from stack pointer (word) – Zilog Z80380 User Manual

Page 208

background image

5-174

Z380

U

SER

'

S

M

ANUAL

DC-8297-03

Z

ILOG

SUB
SUBTRACT FROM STACK POINTER (WORD)

SUB SP,src

src = IM

Operation:

if (XM) then begin

SP(31-0)

SP(31-0) – src(31-0)

end

else begin

SP(15-0)

SP(15-0) – src(15-0)

end

The source operand is subtracted from the SP register and the difference is stored in the SP
register. This has the effect of allocating or deallocating space on the stack. Two's
complement subtraction is performed.

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

IM:

SUB SP,nn

11101101 10010010 -n(low)- -n(high)

2

I, X