[comp.sys.apple] MVP MVN cycle counts

johnmac@fawlty.towers.oz (John MacLean) (12/27/89)

In order to MVP or MVN you need to set up A, Y, and X
which takes 9 cycles (with mx=%00).
I do not have a ref here, but I believe there is some instruction
setup and then something like 7 cycles per byte moved.

If you are looking for maximum speed in memory moves DO NOT use
these instructions - you can do better.

A series of LDA/STA instructions in absolute memory is faster because
each instruction handles 1 word rather than 1 byte. Thus you get 14
cycles before this gets slower than a MVN or MVP.

If you are doing things like moving from or to bank 0 or bank 1
you can do nifty things like move the direct page or stack around
and use direct page LDA/STAs and PLA/PHA with 16 bits to get maximum
speed.

If you are going to bank $E0 or $E1 you can always shadow in all memory
(1 bit in $C000 area - DO NOT SET THIS BIT!) and thus keep the data bank
register the same for both LDA and STA removing overhead.
This will require interrupts OFF, as you can imagine (-:

These sorts of techniques should be used when you are writing fast 
graphics/animation code for games/scrolling etc. Make sure you own
all the memory you are using and restore things when you are finished.

John MacLean.
-- 
This net: johnmac@fawlty.towers.oz.au			  Phone: +61 2 427 2999
That net: uunet!fawlty.towers.oz.au!johnmac		  Fax:   +61 2 427 7072
Snail:    Tower Technology
	  Unit D 31-33 Sirius Rd, Lane Cove, NSW 2066, Australia.