MMC1 question - sequential writes & loops
Posted: Wed Jul 29, 2015 2:25 am
These questions might have been answered before on this forum, but I could not find anything.
Ok, so lets say you want to make a regular upper bank switch (or whatever you want to accomplish)
I'm all fine with that you need to write 5 times, the 5th time is what matters and all that stuff.
Looking into commercial games - all have the same procedure as above, so I am not questioning the wiki nor the setup itself.
But.. to me it seems like
would do the same thing, but waste fewer cycles and memory? Is there a timing issue with doing this? I have tested this loop method and it worked just fine (at least in an emulator, not tested with hardware).
Seeing all the compression, cycle critical code and what not that went into making some of the commercial games, it makes you wonder why this is so "inefficient".
ps: for anyone stumbling upon this thread; in a nutshell, yes you can loop writes like this, but it will only save memory, not execution time. In fact it will increase cycles (a lot..)
Ok, so lets say you want to make a regular upper bank switch (or whatever you want to accomplish)
Code: Select all
switch:
sta $ffff
lsr
sta $ffff
lsr
sta $ffff
lsr
sta $ffff
lsr
sta $ffff
rtsLooking into commercial games - all have the same procedure as above, so I am not questioning the wiki nor the setup itself.
But.. to me it seems like
Code: Select all
switch:
ldx #$05
write:
sta $ffff
lsr
dex
bne write
rtsSeeing all the compression, cycle critical code and what not that went into making some of the commercial games, it makes you wonder why this is so "inefficient".
ps: for anyone stumbling upon this thread; in a nutshell, yes you can loop writes like this, but it will only save memory, not execution time. In fact it will increase cycles (a lot..)