Page Crossing on Compare Absolute X

Let's talk about anything related to the 6502 microprocessor.
Post Reply
Toyman
Posts: 2
Joined: 13 Jul 2006

Page Crossing on Compare Absolute X

Post by Toyman »

Hi

How does the Compare Absolute (DD) determine Page Crossing ?

Code: Select all

FD07  CMP $8003,X
Where
Accumulator = $30
X Register = $05
Thus the Compared address will point to $8008 which = 0.

I've got a 6502 Simulator that adds an extra cycle because of a Page Crossing. Is this correct ? And if so why ?

Thanks
User avatar
8BIT
Posts: 1787
Joined: 30 Aug 2002
Location: Sacramento, CA
Contact:

Re: Page Crossing on Compare Absolute X

Post by 8BIT »

Toyman wrote:
Hi

How does the Compare Absolute (DD) determine Page Crossing ?

Code: Select all

FD07  CMP $8003,X
Where
Accumulator = $30
X Register = $05
Thus the Compared address will point to $8008 which = 0.

I've got a 6502 Simulator that adds an extra cycle because of a Page Crossing. Is this correct ? And if so why ?

Thanks
As written above, your instruction should use 4 clock cycles because no page boundry was crossed. However, if it is coded like this:

Code: Select all

FD07  CMP $80FD,X
where X=$05, then a page bountry is crossed (compare address is $8102).
In this case, an additional cycle is used (5 total). The extra cycle is needed to increment the upper word of the target address (from $80 to $81).

Hope that helps!
Daryl
Post Reply