| |
Starfox
Registered: Jul 2014 Posts: 42 |
Question about indirect ZP
I was watching the memory reads in ICU for VICE and saw that on reads from (ZP),y if it crosses the page boundary - it reads from 2 adresses (see the screenshot: https://dl.dropboxusercontent.com/u/4130839/zeropage.png)
I had ($f0) pointing at $13fe, and the Y register was 3 which gives the address $1401. It reads from both $1301 and $1401. The byte returned is from $1401. Is this a quirk of ICU, or does it just do that internally because of wraparound?
Cheers,
Peter |
|
| |
Ejner
Registered: Oct 2012 Posts: 43 |
Hi,
Maybe I'm missing something, I don't see what indicates any read from $1301 ?
Anyway, as far as I remember there should be no wraparound in the code you're using. Wraparounds occur when using f.i. lda ($f0,x), if x is so high that the final read address exceeds the zeropage. Then the readaddress wrapsaround and stays in the zeropage.
But as I said, maybe I'm missing something..? |
| |
Starfox
Registered: Jul 2014 Posts: 42 |
hello :-)
The adress turns green on read in the ICU debugger when stepping though. They ($1301 and $1401) become green at seemingly the same time. But ICU is very prone to crashing, so who knows if it isn't a bug.
I was just curious about it.
Edit: in the screenshot if you look closely you can see that they are dark green while the surrounding bytes are Black. I guess it doesn't matter as it isn't a bug in the code, as you explained. |
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
The 6502 does a dummy read when indexed addressing causes an extra cycle, as it needs that cycle to adjust the MSB of the target address. |
| |
Starfox
Registered: Jul 2014 Posts: 42 |
Ohh, that explains it then, thanks :) |
| |
Mace
Registered: May 2002 Posts: 1799 |
I learn every time I come to this forum.
Thanks. |