title: Confused about wrapping in 6502 indirect x and y
body: <p>I'm not sure exactly how wrapping works with the indexed x and y address modes. The documentation that I've found is clear that the indexing part is wrapped around within the zero page, but what about the actual dereferenced 16bit address, is that constrained to the zero page as well?</p>
  <p>Let's say I have this code:</p>
  <pre><code>LDX #$00
  LDA #$05
  STA $ff
  LDA #$07
  STA $0100
  LDA #$08
  STA $00
  LDY #$0a
  STY $0705
  LDY #$0b
  STY $0805
  LDA ($ff,X)
  </code></pre>
  <p>Will <code>A</code> be loaded with <code>$0a</code>, or <code>$0b</code>?</p>
  <p>It is obvious that if <code>X</code> were loaded with <code>$01</code>, then the address would be looked up from <code>$00</code> (<code>$ff + $01 == $00</code>). But in this case, we're going to read the 16bit address lo byte from <code>$ff</code> - is the hi byte read from <code>$0100</code>, or from <code>$00</code>?</p>
  <p>Similarly for indirect y, let's say I have this code:</p>
  <pre><code>LDY #$00
  LDA #$30
  STA $ff
  LDA #$04
  STA $00
  LDA #$05
  STA $0100
  LDX #$0a
  STX $0430
  LDX #$0b
  STX $0530
  LDA ($ff),Y
  </code></pre>
  <p>We read a 16bit address from <code>$ff</code>, is the hi byte read from <code>$0100</code> or from <code>$00</code>?</p>
  <p>And lastly, also with indirect y:</p>
  <pre><code>LDY #$01
  LDA #$ff
  STA $01
  STA $02
  LDX #$0a
  STX $00
  LDA ($01),Y
  </code></pre>
  <p>We dereference <code>$01</code> and get <code>$ffff</code>, then add <code>$01</code>, does this mean we load from <code>$00</code> and get <code>$0a</code> in <code>A</code>?</p>