Nintendo NES-001 User Guide - Page 39

Appendix E, Addressing Modes

Page 39 highlights

Appendix E 6502 Addressing Modes E.1 Zero Page Zero page addressing uses a single operand which serves as a pointer to an address in zero page ($0000-$00FF) where the data to be operated on can be found. By using zero page addressing, only one byte is needed for the operand, so the instruction is shorter and, therefore, faster to execute than with addressing modes which take two operands. An example of a zero page instruction is AND $12. Figure E-1. Zero page addressing. E.2 Indexed Zero Page Indexed zero page addressing takes a single operand and adds the value of a register to it to give an address in zero page ($0000-$00FF) where the data can be found. There are two forms of indexed zero page addressing: • Zero Page, X - Add contents of X register to operand. This is the most common form of indexed zero page. An example of this addressing mode is AND $12,X. • Zero Page, Y - Add contents of Y register to operand. This mode can only be used with LDX (Load X Register) and STX (Store X Register). An example of this addressing mode is LDX $12,Y. Wraparound is used when performing the addition so the address of the data will always be in zero page. For example, if the operand is $FF and the X register contains $01 the address of the data will be $0000, not $0100. 39

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47

39
Appendix E
6502 Addressing Modes
E.1 Zero Page
Zero page addressing uses a single operand which serves as a pointer to an address in zero
page ($0000-$00FF) where the data to be operated on can be found. By using zero page
addressing, only one byte is needed for the operand, so the instruction is shorter and,
therefore, faster to execute than with addressing modes which take two operands. An
example of a zero page instruction is AND $12.
Figure E-1. Zero page addressing.
E.2 Indexed Zero Page
Indexed zero page addressing takes a single operand and adds the value of a register to it to
give an address in zero page ($0000-$00FF) where the data can be found. There are two
forms of indexed zero page addressing:
Zero Page, X - Add contents of X register to operand. This is the most common form of
indexed zero page. An example of this addressing mode is AND $12,X.
Zero Page, Y - Add contents of Y register to operand. This mode can only be used with
LDX (Load X Register) and STX (Store X Register). An example of this addressing mode
is LDX $12,Y.
Wraparound is used when performing the addition so the address of the data will always be
in zero page. For example, if the operand is $FF and the X register contains $01 the address
of the data will be $0000, not $0100.