[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Orca/M bug MVN & MVP?



In article <1v9uvc$rff@altitude.HIP.CAM.ORG> vandry@CAM.ORG (Phillip Vandry) writes:
> 
> I never use them because I don't know how they work :-)
> 
> So I will take this oportunity to ask. What I can't seem to find out is:
> will these commands cross bank boundaries? If not, they are not too useful,
> since there's usually a chance that the memory will (unless you tell NewHandle
> not to cross)

No, they don't cross bank boundaries.

There are a few things you have to watch out for when using MVN and
MVP:

- The assembler syntax is MVP (or MVN) source,destination, but the
assembled instruction has the destination bank as the first operand.
(This is only a problem if you're using the mini-assembler.)
- It is difficult to use these instructions if your source or
destination is not defined at assembly time (e.g. allocated handle),
since you have to modify the operand of the instruction to change the
banks.
- They don't cross bank boundaries.
- Make sure you get your registers set up correctly: full sixteen bit
mode, with X = source address, Y = destination address.
- If using MVP, then X and Y must point to the highest memory location
to be copied; for MVN, they point to the lowest location.
- The accumulator is the number of bytes to copy MINUS 1 (e.g. $0000
will copy 1 byte, and $FFFF will copy 65536 bytes).
- After the MVN or MVP, the data bank register is set to the
destination bank for the copy.  Because of this, you should always do
a PHB before using these instructions, then PLB after you finish.

You can save a lot of work (at the expense of processor time) by
calling the memory manager routines BlockMove, HandToPtr, etc., which
use the MVP/MVN instructions and handle bank crossing, etc.  (They
generate temporary code on the stack to perform each step of the move.)

> I suppose this should go on comp.sys.apple2.programmer. But the group
> doesn't seem to exist here.

Complain to your system administrator.  Once we stop cross-posting
messages to c.s.a2, you won't be able to see the programming
discussions if you aren't subscribed to c.s.a2.programmer.
-- 
David Empson                                                               
dempson@swell.actrix.gen.nz                                                
Snail mail: P.O. Box 27-103, Wellington, New Zealand