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

AND

From 0x10c Wiki
Revision as of 20:18, 13 July 2012 by Musashiaharon (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

AND is one of the opcodes in the DCPU-16 specification. It represents a bitwise AND operation.

Contents

[edit] Usage

 AND arg1, arg2

AND performs a bitwise AND on arg1 with arg2 and stores the result in arg1. That is, only the bits equal to 1 in both arg1 and arg2 become 1 in the result; all other bits are set to 0.

Truth table for Y(A, B) = A AND B
Input A Input B Output Y
0 0 0
0 1 0
1 0 0
1 1 1

[edit] Example

SET A, 5 ; 0b0101
AND A, 3 ; 0b0011
; A is now 0b0001

[edit] Signing dependence

AND works correctly with both signed and unsigned numbers.

[edit] Processing

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

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

[edit] References

Personal tools
Namespaces
Variants
Actions
Navigation
Community
Toolbox