	.TITLE	MB	Move buffer routine
	.IDENT	/VER 0.1/
;
;	MB IS A FORTRAN CALLABLE MACRO ROUTINE FOR MOVING A BLOCK OF DATA
;	FROM ONE BUFFER TO ANOTHER, OR FROM ONE LOCATION IN A BUFFER TO
;	ANOTHER LOCATION IN THE SAME BUFFER, WITH OR WITHOUT ADDRESS
;	OVERLAP PROVIDING THE DESTINATION ADDRESS IS SMALLER THAN THE
;	SOURCE ADDRESS (SEE EXAMPLE 2)
;
;	THIS ROUTINE PROVIDES APPROXIMATELY A SEVEN TO ONE INCREASE IN
;	THROUGHPUT OVER A FORTRAN ROUTINE, i.e. THIS ROUTINE IS SEVEN
;	TIMES FASTER THAN AN EQUIVALENT FORTRAN ROUTINE.
;
;	FORTRAN SYNTAX -- CALL MB(SOURCE,DESTINATION,WORD COUNT)
;
;	DEFINE BUFFERS AND POINTERS AS INTEGER*2 VALUES
;
;	INTEGER*2 BUF1(100),BUF2(100),WCNT
;
;	EXAMPLE 1 MOVE DATA BETWEEN DIFFERENT BUFFERS
;
;	WCNT = 100
;	CALL MB(BUF1,BUF2,WCNT)
;
;	EXAMPLE 2 MOVE DATA WITHIN THE SAME BUFFER
;
;	WCNT = 50
;	CALL MB(BUF1(51),BUF1(1),WCNT)
;
;	!!!!!!!!!!!!!!!!!!!!!!!!  CAUTION  !!!!!!!!!!!!!!!!!!!!!!!!
;
;	NO TESTS ARE MADE FOR VALID ADDRES OR LENGTH ON EITHER
;	BUFFER.
;	IF THE LENGTH OF THE DESTINATION BUFFER IS LESS THAN WORD
;	COUNT, MEMORY LOCATIONS OUTSIDE OF THE BUFFER WILL BE
;	OVERWRITTEN, OR ACCESS VIOLATIONS WILL OCCUR WHICH WILL
;	ABORT THE PROGRAM.
;
	.PSECT	$CODE,EXE,SHR,NOWRT,PIC,LONG
	.ENTRY	MB,^M<R2,R3,R4,R5>	; SAVE CLOBBERED REGISTERS
	MOVAL	@12(AP),R0		; FETCH WORD COUNT ADDR
	ASHL	#1,(R0),R0		; CONVERT TO BYTE COUNT
	MOVAB	@8(AP),R3		; FETCH DEST ADDR
	MOVAB	@4(AP),R1		; FETCH SOURCE ADDR
	MOVC3	R0,(R1),(R3)		; MOVE THE BLOCK
	RET				; RETURN TO CALLER
	.END
