[comp.sys.apple] Block moves

STEIN@UCONNVM.BITNET (04/18/88)

Can someone give me an example using a block move (MVP or MVN)
on the 65816?

I know that you put the starting address (lower 16 bits) in X,
destination address (lower 16 bits) in Y, the # of blocks less 1
in the accumulator and then include the instruction

mvp  sourcebank,destbank

but I'm not certain how to put the source and destination banks
in there.  My guess is that if I have statements such as:

source ds 500
dest   ds 500

somewhere in my program and want to move say 25 bytes starting at
source+60 to a location starting at dest+90 I can do something like
the following:

clc
lda #source
adc #60
tax
clc
lda #dest
adc #90
tay
lda #25
mvp source,dest

Will that work?

ARPA:   stein%uconnvm.bitnet@mitvma.mit.edu        Alan H. Stein
BITNET: STEIN@UCONNVM                          University of Connecticut
UUCP:   ...ihnp4!psuvax1!UCONNVM.BITNET!STEIN        at Waterbury
CompuServe: 71545,1500  Genie:  ah.stein       Department of Mathematics

spike@bu-cs.BU.EDU (Spike) (04/19/88)

In article <8804172225.aa09835@SMOKE.BRL.ARPA> STEIN@UCONNVM.BITNET writes:
<Can someone give me an example using a block move (MVP or MVN)
>on the 65816?
<
>I know that you put the starting address (lower 16 bits) in X,
<destination address (lower 16 bits) in Y, the # of blocks less 1
>in the accumulator and then include the instruction
<
>mvp  sourcebank,destbank
<
>but I'm not certain how to put the source and destination banks
<in there.  My guess is that if I have statements such as:
>
<source ds 500
>dest   ds 500

	Well, the operands are the 8bit addresses of banks of 64K.
They can not be bigger than 255.


The example from Eyes & Lichty is along these lines:

lda count		;load C number of bytes to be moved minus 1
ldx source		;load the source address into X
ldy dest		;load the destination address Y

mvn s_bank,d_bank	;move a block 
			;$2000 bytes from $2000 to $4000 on bank 0
rts

count  dc A'$1FFF'	;$2000 - 1
source dc A'$2000'	;Source address
dest   dc A'$4000'	;destination address
s_bank dc I1'0'		;source bank
d_bank dc I1'0'		;destinaton bank


<somewhere in my program and want to move say 25 bytes starting at
>source+60 to a location starting at dest+90 I can do something like
<the following:

	What you want is some thing like:

lda source
clc		
adc #60			;Add 60 to source
tax			;put it in X
lda dest
clc	
adc #90			;Add 90 to dest
tay			;put it in Y
lda count		; load number of bytes to move

mvp s_bank,d_bank	;move block  25 bytes from $500 + 60 to $500 + 90
			;on bank 0

count  dc A'$18'	;25 - 1 = $18
source dc A'$500'	;Source address  
dest   dc A'$500'	;destination address
s_bank dc I1'0'		;source bank 	 ->Change this to what ever
d_bank dc I1'0'		;destinaton bank ->you are working on

       "You'll laugh, you'll cry, you'll kiss 3 bucks goodbye."
 UUCP:	...!harvard!bu-cs!bu-it!spike  INTERNET: spike@bu-it.bu.edu
   CSNET: spike%bu-it@bu-cs   BITNET: engemnc@bostonu "VPS sucks"

-- 
->Spike

scott@geowhiz.UUCP (Scott Kempf) (04/19/88)

In article <8804172225.aa09835@SMOKE.BRL.ARPA> STEIN@UCONNVM.BITNET writes:
>Can someone give me an example using a block move (MVP or MVN)
>on the 65816?

>I know that you put the starting address (lower 16 bits) in X,
>destination address (lower 16 bits) in Y, the # of blocks less 1
>in the accumulator and then include the instruction

>mvp  sourcebank,destbank

>but I'm not certain how to put the source and destination banks in there.

The sourcebank and destbank the upper 8 bits of a 24 bit addresses of the
source and destination blocks.  (In the 65816 a bank is always 64K)

If you want to move HGR page1 onto page2 you would do (in "normal" memory):

LDX 2000
LDY 4000
LDA 1FFF
MVP 0,0

To copy page2 text the way Alternate Display Mode does (might do):

LDX 800
LDY 800
LDA 3FF
MVP 0,E1

					Scott

>ARPA:   stein%uconnvm.bitnet@mitvma.mit.edu        Alan H. Stein
>BITNET: STEIN@UCONNVM                          University of Connecticut
>UUCP:   ...ihnp4!psuvax1!UCONNVM.BITNET!STEIN        at Waterbury
>CompuServe: 71545,1500  Genie:  ah.stein       Department of Mathematics

_______________________________________________________________________________
Scott Kempf                          Blue itself teaches us blue.  -Bill Ranson
MAIL:   1302 Rutledge St., Madison, WI  53703    PHONE:  (608) 255-6205  (home)
UUCP:   {seismo, topaz, harvard, ihnp4}!uwvax!geowhiz!scott
ARPA:   geowhiz!scott@spool.wisc.edu             PHONE:  (608) 262-6154  (work)
BITNET: scott%geowhiz.uucp%spool.wisc.edu@wiscvm.bitnet