Page Boundaries

For discussing the 65xx hardware itself or electronics projects.
Post Reply
andrewem
Posts: 17
Joined: 21 May 2004
Location: Burlington, ON

Page Boundaries

Post by andrewem »

Good Day,

I have a question... :?

Assume that an Op Code is being executed under the Absolute X addressing mode. The Op Code itself is on a memory page.

According to the docs I have, the Op Code is followed by two bytes that form a 16-bit address and are added to the X register to form an effective addressing.

When determining if a page boundary is crossed, what is compared?

[a] the Op Code memory page and the effective address memory page (two bytes + X).

OR

the two bytes following the Op Code AND the effective address (two bytes + X)

Some code snipets I found from other developers suggest , but I can't find any documentation on this, so of course, I'm questioning whether it's correct.

Thanks for your help in advance,

Andrew
User avatar
GARTHWILSON
Forum Moderator
Posts: 8775
Joined: 30 Aug 2002
Location: Southern California
Contact:

Post by GARTHWILSON »

It doesn't matter where the actual instruction is. When they say an extra clock is taken when you cross a page boundary, that has to do with the indexing itself-- whether the effective address and the address pointed to by the op code are in different pages.

For example, in the instruction LDA 1234,X, where the value in the X register is added to address 1234 to get the effective address to load the accumulator from, the operand's low byte is fetched before the high byte, so the processor can start adding the X register's value before it has the high byte. If there is no carry operation, the entire indexed operation takes only four clocks, which is one microsecond at 4MHz. (I don't think there are any 65c02's being made today that won't do at least 4MHz.) If there is a carry requiring the high byte to be incremented, it takes one additional clock.
Post Reply