6502 boundary question

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
Posts: 604
Joined: Tue Dec 21, 2004 8:35 pm
Location: Argentina

6502 boundary question

Post by Anes » Tue Jun 21, 2005 11:44 pm

Im little confused about what it means "page boundary crossed" when doing an Instruction that for example reads from memory, like ADC addresing mode ABSOLUTE_X, the reference says (as almost all do) "add 1 cycle if the "page boundary is crossed". Is it the fact that the base address is given by the pc + 1 and pc + 2 and added to x? i mean if we do:

lda $01FF, x

is in that situation that we cross the page boundary to $02XX, assuming that x > 0 of course.

Is that well?

Posts: 96
Joined: Sat Nov 13, 2004 6:25 am

Post by Muchaserres » Wed Jun 22, 2005 3:44 am

Yup, you got it.

User avatar
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA

Post by blargg » Wed Jun 22, 2005 9:46 am

My understanding of the reason for this extra cycle is that the 6502 has a single general-purpose 8-bit adder that it reuses for various tasks, including indexed absolute addressing mode. On the first cycle it adds X to the low byte of the target address. If a carry is generated, it needs to take an extra cycle to add one to the high byte. This also explains why the low byte of addresses is stored first.

Post Reply