<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Wed, 17 Mar 1999 16:30:19 +0000
From   : Stuart William McConnachie <stuart@...>
Subject: Re: 6502 CPU - clock cycles

In message <199903171027.KAA16915@...>, Adam Hamilton
x8712 <Adam_Hamilton@...> writes
>Certain commands take an extra clock cycle if 'a page boundary is crossed'.
>Which of the following examples (or both) would be classed as crossing
>a page boundary?
>
>1) 0AFF:  A9 00    LDA #&00
>
>   The operand is located on a different page to the opcode, therefore
>   a page boundary is crossed, yes?
>
>2) 0AFE:  A9 00    LDA #&00
>
>   Both the opcode and operand are on page 0A but the PC ends up pointing
>   to 0B00 - does this also mean a page boundary has been crossed?
As far as I'm aware, the only instructions which require an extra cycle
are those which involve index addressing or the relative branch
instructions.  An extra cycle is used when there is a carry to/from the
low byte of an address to the high byte.  For example:
        LDA &900,Y
never crosses a page boundary (since the maximum vale of Y is &FF)
        LDA &910,Y
only crosses a page boundary for Y>=&F0 when you access locations in
page &A
        LDA &9FF,Y
always crosses a boundary unless Y=&00

Similar rules apply for indirect indexed addressing.

AFAIAA no extra cycles are added when the actual instruction
opcode/operand spans a page boundary.

During the "extra cycle" the 6502 performs a null read (i.e. the result
is discarded) of the base memory address of the index.  Normal no harm
is done by this read, unless the memory addressed is actually an I/O
port.

Regards,
-- 
Stuart McConnachie (stuart@...              )
43 The Hollows, Long Eaton, Nottingham, NG10 2ES, UK
Mobile: 0966 224307
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>