ADD

Instruction: Add two unsigned values.
ADD Value1, < # > Value2


Result: Sum of unsigned Value1 and unsigned Value2 is stored in Value1.

  • Value1 (d-field) is the register containing the value to add to Value2 and is the destination in which to write the result.
  • Value2 (s-field) is a register or a 9-bit literal whose value is added into Value1.

Opcode Table:

–INSTR–  ZCRI– CON–     –DEST–        –SRC–

Z Result

C Result

Result

Clocks

 100000    001i    1111    ddddddddd    sssssssss

D + S = 0

Unsigned Carry

Written

4

Concise Truth Table:

In

Out

Destination1

Source1

Z

C

Effects

Destination

Z

C

$FFFF_FFFE; 4,294,967,294

$0000_0001; 1

-

-

wz wc

$FFFF_FFFF; 4,294,967,295

0

0

$FFFF_FFFE; 4,294,967,294

$0000_0002; 2

-

-

wz wc

$0000_0000; 0

1

1

$FFFF_FFFE; 4,294,967,294

$0000_0003; 3

-

-

wz wc

$0000_0001; 1

0

1

1 Both Source and Destination are treated as unsigned values.

Explanation

ADD sums the two unsigned values of Value1 and Value2 together and stores the result into the Value1 register.

If the WZ effect is specified, the Z flag is set (1) if Value1 + Value2 equals zero. If the WC effect is specified, the C flag is set (1) if the summation resulted in an unsigned carry (32-bit overflow). The result is written to Value1 unless the NR effect is specified.

To add unsigned, multi-long values, use ADD followed by ADDX. See ADDX for more information.

Unless otherwise noted, content on this site is licensed under the
Creative Commons Attribution-ShareAlike 4.0 International License.