Difference between revisions of "Operand"

From NES Hacker Wiki
Jump to: navigation, search
(Examples)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
An '''''operand''''' is the data portion of a 6502 assembly [[instruction]]. This is to be distinguished from the [[opcode]], which specifies the operation to perform.
 
An '''''operand''''' is the data portion of a 6502 assembly [[instruction]]. This is to be distinguished from the [[opcode]], which specifies the operation to perform.
  
In the example below, [[JMP]] is the opcode and $1000 is the operand, and the entire line is the instruction.
 
  
  0001:4C 00 10  JMP $1000      ; Moves the execution pointer to $1000.
+
==Examples==
 +
 
 +
In the example below, [[JMP]] is the opcode, $1000 is the operand, and the two combined is the instruction.
 +
 
 +
  0001:4C 00 10  JMP $1000      ; Moves the program counter to $1000.
 +
 
 +
In this example, [[DEX]] is the opcode, but there is no operand since it is implied from the opcode.
 +
 
 +
0001:CA        DEX            ; Decrements the X index register.
 +
 
 +
 
 +
[[Category: Guides]]
 +
[[Category: Assembly]]

Latest revision as of 19:16, 24 March 2016

An operand is the data portion of a 6502 assembly instruction. This is to be distinguished from the opcode, which specifies the operation to perform.


Examples

In the example below, JMP is the opcode, $1000 is the operand, and the two combined is the instruction.

0001:4C 00 10  JMP $1000      ; Moves the program counter to $1000.

In this example, DEX is the opcode, but there is no operand since it is implied from the opcode.

0001:CA        DEX            ; Decrements the X index register.