; The routine reflect copies bytes from the source location ; to the destination location. ; ; The first parameter is the source address and the second ; parameter is the destination address. ; ; The third parameter is the number of bytes to copy. ; ; For performance, larger chunks of bytes are handled differently. ; .CODE .EXPORT reflect,ENTRY reflect .PROC .CALLINFO ENTRY_GR=6,SAVE_RP .ENTER COMB,=,N %arg2,%r0,fallout ; done, count is zero COMB,<,N %arg2,%r0,choke ; caller error, neg count OR %arg0,%arg1,%r6 ; source and dest OR %r6,%arg2,%r6 ; count EXTRU,= %r6,31,2,%r0 ; 2 low order bits = 0? B,N onebyte ; yes, skip this branch ADDIBT,<,N -16,%arg2,chekchunk ; no, skip chunkify if count<0 chunkify LDWM 16(%arg0),%r6 ; word 1- > temp1 ; point ahead 4 words in source LDW -12(%arg0),%r5 ; place mark 3 wds back- >temp2 LDW -8(%arg0),%r4 ; place mark 2 wds back- >temp3 LDW -4(%arg0),%r3 ; place mark 1 wds back- >temp4 STW %r5,4(%arg1) ; dest wd 2 <-temp2 STWM %r6,16(%arg1) ; dest wd 1 <-temp1 ; point ahead 4 words in dest STW %r4,-8(%arg1) ; dest wd 3 <-temp3 ADDIBF,< -16,%arg2,chunkify ; loop if count > 0 STW %r3,-4(%arg1) ; dest wd 2 <-temp1 chekchunk ADDIBT,< 12,%arg2,exeunt ; go if count < -12 COPY %r0,%ret0 ; clear rtnval subchunk LDWS,MA 4(%arg0),%r6 ; word- >temp1 ; point ahead 4 bytes in source ADDIBF,< -4,%arg2,subchunk ; go if count<4 STWS,MA %r6,4(%arg1) ; dest< -temp1 ; point ahead 4 bytes in dest B exeunt ; all done COPY %r0,%ret0 ; clear rtnval onebyte LDBS,MA 1(%arg0),%r6 ; temp1 < -byte,bump src pointer onemore STBS,MA %r6,1(%arg1) ; dest<-temp1,bump dest pointer ADDIBF,=,N -1,%arg2,onemore ; decrement count ; compare for 0. LDBS,MA 1(%arg0),%r6 ; delay slot ; temp1 <-byte,bump src pointer fallout B exeunt COPY %r0,%ret0 choke LDI 14,%ret0 exeunt .LEAVE .PROCEND |