Chapter
3.
IJntructioo
Sct
INX
JC
3-26
Example:
If
register C contains 99H, the instruction INR C increments the
contents
of
the register to 9AH.
INCREMENT REGISTER PAIR
INX
adds one to the
contents
of
the specified register pair.
INX
affects none
of
the condition flags. Because
INX
preserves
all
the condition flags,
it
can
be
used for address modification within multi-byte arithmetic
rou
ti
nes.
Opcode
Operand
INX
INX may increment only the B&C, D&E,
H&
L,
or the
SP
(Stack Pointer) register pairs. Notice
that
the
letter H
must
be
used to specify the
Hand
L register pair.
Exercise
care when incrementing the stack pointer. Assume, for example,
that
INX
SP
is
executed after a number
of
item'>
have been pushed
onto
,he stack. A subsequent
POP
in'>truction accesses the high-order byte
of
the m,)st
recent stdck
entry
and the low-order
byte
of
the next older entl·Y. Similarly, a PUSH instruction
add,>
the two
new bytes to the
'>tack,
but
overlays the low-order byte
of
the most recent entry.
Cycles:
States:
Ad
dressi ng:
Flags:
Example:
P 0 0
1
S
(6
on
SOSS)
regis ter
none
Assume
that
the D and E registers contain the value
01
FFH. The instruction
INX
D increments
the
value to
0200H.
By
contrast,
the
IN
R E instruction ignores the carry
out
of
the low-order byte and produces a result
of
01
OOH.
(This condition can
be
detected
by
testing the Zero condition flag.)
If the stack pointer regi'>ter contain'> the value OFFFFH, the instruction
INX
SP
increments the
contents
of
SP
to
OOOOH.
The INX in'>truction
'>ets
no flags to indicate this condition.
JUMP
IF CARRY
The
lC
instruction tests the setting
of
the carry flag.
If
the flag
is
set to one, program execution resumes
at
thl!
address specified
in
the
JC
instruction. If the flag
is
reset to zero, execution continues with the next sequential
instruction.