.TITLE BCOPY Copy bytes from one array to another .IDENT /1.00/ .PSECT $CODE,LONG,PIC,REL,SHR,EXE,RD,NOWRT ; bcopy(from, to, size) .ENTRY BCOPY,^M MOVL 4(AP),R1 MOVL 8(AP),R3 MOVL 12(AP),R6 CMPL R1,R3 BGTR 2$ ; NORMAL FORWARD CASE BLSS 3$ ; OVERLAPPING, MUST DO BACKWARDS RET ; EQUAL, NOTHING TO DO 1$: SUBL2 R0,R6 MOVC3 R0,(R1),(R3) 2$: MOVZWL #65535,R0 CMPL R6,R0 BGTR 1$ MOVC3 R6,(R1),(R3) RET 3$: ADDL2 R6,R1 ADDL2 R6,R3 MOVZWL #65535,R0 BRW 5$ 4$: SUBL2 R0,R6 SUBL2 R0,R1 SUBL2 R0,R3 MOVC3 R0,(R1),(R3) MOVZWL #65535,R0 SUBL2 R0,R1 SUBL2 R0,R3 5$: CMPL R6,R0 BGTR 4$ SUBL2 R6,R1 SUBL2 R6,R3 MOVC3 R6,(R1),(R3) RET .END