We're looking for your comments on how to best organize the wiki's content.

ADX

From 0x10c Wiki
Jump to: navigation, search

ADX (Add EX) is one of the opcodes in the DCPU-16 specification. It represents an addition of two numbers and the EX register.

Contents

[edit] Usage

 ADX arg1, arg2

ADX takes the sum of arg1, arg2 and EX and stores it in arg1.

[edit] Overflow handling

As a mathematical operation it needs to handle the possibility of overflow, in this case when the sum of arg1, arg2 and EX is larger than what can be represented in arg1.

When the sum is too big, the overflow register EX will be set to 0x0001. (There has been no word yet of whether an overflow of 0x0002 is possible.)

When the sum is manageable, EX will be set to 0x0000

[edit] Signing dependence

ADX handles both signed and unsigned numbers correctly. However, when operating on signed numbers, the overflow register EX no longer indicates that carrying has occurred.

[edit] Processing

In binary machine code, this Basic opcode's five-bit representation is: 0b1 1010 (0x1a)

The instruction has a takes three cycles to execute, plus any additional cycles necessary to evaluate the arguments.

[edit] References

Personal tools
Namespaces
Variants
Actions
Navigation
Community
Toolbox