home *** CD-ROM | disk | FTP | other *** search
- 11-May-88 21:20:33-MDT,4172;000000000000
- Return-Path: <u-lchoqu%sunset@cs.utah.edu>
- Received: from cs.utah.edu by SIMTEL20.ARPA with TCP; Wed, 11 May 88 21:20:25 MDT
- Received: by cs.utah.edu (5.54/utah-2.0-cs)
- id AA03049; Wed, 11 May 88 21:20:57 MDT
- Received: by sunset.utah.edu (5.54/utah-2.0-leaf)
- id AA29197; Wed, 11 May 88 21:20:54 MDT
- Date: Wed, 11 May 88 21:20:54 MDT
- From: u-lchoqu%sunset@cs.utah.edu (Lee Choquette)
- Message-Id: <8805120320.AA29197@sunset.utah.edu>
- To: rthum@simtel20.arpa
- Subject: ByteXfer.asm
-
- ;-----------------------------------------------------------------------------------
- ;
- ; Procedure ByteTfr(SrcPtr,SrcStart,DstPtr,DstStart,NumBytes);
- ; Ptr Int Ptr Int Int
- ;
- ; This takes any set of bytes from one memory location and copies it to another.
- ; It also takes into consideration transfers of data within the same block so as
- ; to not replicate the same item through the block.
- ;
- ; Written July 10, 1985 by Joseph F. Buchanan - University of Utah Computer Center
- ;-----------------------------------------------------------------------------------
- ;
- XDEF ByteTfr
- ByteTfr
- LINK a6,#0 ; set frame pointer
- Move.W 8(a6),d2 ; get number of bytes to move
- Move.W 10(a6),d1 ;Get offset
- Move.L 12(a6),a1 ;get the Destination Pointer
- Move.W 16(a6),d0 ;Get offset
- Move.L 18(a6),a0 ;get the Source Pointer
- add.w d0,a0 ; get real address of source+offset
- add.w d1,a1 ; get real address of dest+offset
- subq.w #1,d2 ; make relative o
- move.l a0,d0
- sub.l a1,d0 ; see if before source block
- BGE.s @3 ; dest begins before src
- move.l a0,d0
- add.l d2,d0 ; get real address of end of src block
- sub.l a1,d0 ; see if after source block
- BLT.s @3 ; dest begins after src
- add.l d2,a0 ; set start pt of src to past end of block
- addq.l #1,a0
- add.l d2,a1 ; set start pt of dst to past end of block
- addq.l #1,a1
- @1
- move.b -(a0),d0 ; take a byte
- move.b d0,-(a1) ; give a byte
- dbra d2,@1
- BRA.s @4
- @3
- move.b (a0)+,d0 ; take a byte
- move.b d0,(a1)+ ; give a byte
- dbra d2,@3
- @4
- unlk a6 ; restore frame pointer
- move.l (SP)+,a1 ; get return address
- add.w #14,SP ; pop parameters off stack
- JMP (a1) ; return
-
- ;-----------------------------------------------------------------------------------
- ;
- ; Procedure BlkStore(Ptr,Start,NumBytes,value);
- ; Ptr Int Int Int
- ;
- ; This takes the value in the lower half of the value integer and fills the
- ; memory area pointed to with that value from the start through NumBytes.
- ;
- ; Written July 15, 1985 by Joseph F. Buchanan - University of Utah Computer Center
- ;-----------------------------------------------------------------------------------
- ;
- XDEF BlkStore
- BlkStore
- LINK a6,#0 ; set frame pointer
- Move.W 8(a6),d2 ; get value
- Move.W 10(a6),d1 ; get number of bytes to clobber
- Move.W 12(a6),d0 ; Get offset
- Move.L 14(a6),a0 ; get the Pointer
- add.w d0,a0 ; get real address of buffer+offset
- subq.w #1,d1 ; make relative 0
- @5
- move.b d2,(a0)+ ; give a byte
- dbra d1,@5
- unlk a6 ; restore frame pointer
- move.l (SP)+,a1 ; get return address
- add.w #10,SP ; pop parameters off stack
- JMP (a1) ; return
-
- END
-