beautypg.com

Adc (add with carry) – Echelon Neuron User Manual

Page 74

background image

ADC (Add with Carry)

The ADC instruction adds two numbers with the value of the Carry flag. The

ADC instruction uses the implicit addressing mode. The ADC instruction

retrieves both TOS and NEXT from the data stack and adds them together with

the value of the Carry flag. TOS and NEXT are consumed, and the result is

placed in TOS. The operation modifies the Carry flag as result of the unsigned

addition.
The ADC instruction applies to Series 3100, 5000, and 6000 devices.

Syntax:
The ADC instruction requires no operands:

ADC

Table 10 describes the attributes of the ADC instruction.

Table 10. ADC Instruction

Instruction

Hexadecimal

Opcode

Instruction

Size (Bytes)

CPU Cycles

Required

Affect on

Carry Flag

ADC

54

1

4

Used, modified


Example:
The following example performs the operation 2+3. The example assumes that

the Carry flag is set.

pushs #2 ; (2, -, -)

pushs #3 ; (3, 2, -)

adc ; (6, -, -)

The value of TOS after this code executes is 6 because 2+3+Carry = 6. In this

case, the value of the Carry flag is used for the addition, and then modified

(cleared) because the unsigned addition did not require an extra carry bit.

64

Neuron Assembly Language Instruction Statements