beautypg.com

Inc (increment) – Echelon Neuron User Manual

Page 98

background image

INC (Increment)

The INC instruction can increment the TOS value or the value of a specified

pointer register. The INC instruction uses the pointer direct addressing mode.

When incrementing TOS, if the TOS value is zero after the increment, this

instruction sets the Carry flag. When incrementing a pointer register, the

pointer-register expression must be in the range 0 to 3.
The INC instruction applies to Series 3100, 5000, and 6000 devices.

Syntax:
The INC instruction for the TOS requires no operands:

INC

The INC instruction for a pointer register requires a single operand to specify the

pointer register:

INC [0]

INC [1]

INC [2]

INC [3]

Table 32 describes the attributes of the INC instruction.

Table 32. INC Instruction

Instruction

Hexadecimal

Opcode

Instruction

Size (Bytes)

CPU Cycles

Required

Affect on

Carry Flag

INC

3E

1

2

Modified

INC [0]

34

1

6

None

INC [1]

35

1

6

None

INC [2]

36

1

6

None

INC [3]

37

1

6

None


Example:
The following example calls assumes that TOS contains a loop-control variable

with a negative value. The INC instruction increments TOS. When TOS

becomes zero and Carry flag is set, the BRC instruction branches to the Done

label. As long as the Carry flag is not set, the BR instruction branches to the

Loop label. Thus, this example implements a for loop construct.

Loop ... ; loop body

inc ; ( n )

brc Done

br Loop

88

Neuron Assembly Language Instruction Statements