help!A question

Programming the 6502 microprocessor and its relatives in assembly and other languages.
Post Reply
amin2312
Posts: 4
Joined: 30 Jul 2009

help!A question

Post by amin2312 »

i dont understand,like "AND Absolute,X" instruction that spend cycles is write "4 (+1 if page crossed)",what's mean "+1 if page crossed"?

who man can tell me,thank you very much
User avatar
GARTHWILSON
Forum Moderator
Posts: 8775
Joined: 30 Aug 2002
Location: Southern California
Contact:

Post by GARTHWILSON »

Welcome.

Perhaps an example would be best: Let's say X contains $56. AND $1000,X will AND the value in the accumulator with what is contained at address $1056. It is still in page $10, so the indexing does not cause a crossing of page boundaries. But if you do AND $10E0,X, now $10E0+$56=$1136, so you are no longer getting a value from page $10, but rather page $11. The page boundary was crossed by the indexing, and an extra cycle was required.
amin2312
Posts: 4
Joined: 30 Jul 2009

Post by amin2312 »

thank u.i have understand.

but if "INC Absolute,X" is "INC $10E0,$56",then the page was crossed,so it will be spend an extra cycle.why the "INC Absolute,X" instruction dont take "(+1 if page crossed)"?

INC instruction reference:http://www.obelisk.demon.co.uk/6502/reference.html#INC
User avatar
GARTHWILSON
Forum Moderator
Posts: 8775
Joined: 30 Aug 2002
Location: Southern California
Contact:

Post by GARTHWILSON »

Quote:
why the "INC Absolute,X" instruction dont take "(+1 if page crossed)"?

INC instruction reference:http://www.obelisk.demon.co.uk/6502/reference.html#INC
The 65c02 does do it, according to the programming manual put out by the manufacturer, WDC, available at http://www.westerndesigncenter.com/wdc/ ... manual.pdf . It takes 6 clocks without crossing, 7 if it does cross. According to my old Synertek book, the NMOS always took 7.

The page you linked only has the NMOS 6502 instructions. Unless you are trying to use vintage equipment like the Commodore 64, I recommend going to the CMOS 6502 (65c02) as it has more instructions and addressing modes, all the bugs fixed, onboard clock oscillator, lower power (obviously), and other enhancements.
amin2312
Posts: 4
Joined: 30 Jul 2009

Post by amin2312 »

thank you very much!!thank u solve my question,thank u again!
Post Reply