.title scopy ; ; call scopy( a, b, [len], [ierr] ) ; reverse assemled RT-11 scopy ; .psect user$i scopy:: mov r1,-(sp) mov r2,-(sp) mov r3,-(sp) mov (r5)+,r3 ; r3 = nargs mov (r5)+,r1 ; r1 = 1st address mov (r5)+,r2 ; r2 = 2nd address cmpb #2,r3 ; 2 args ?? beq 40$ ; br, if yes, copy until null cmp #-1,(r5) ; default argument ?? beq 40$ ; br, if yes mov @(r5)+,r4 ; r4 = len beq 20$ ; br, if 0 10$: movb (r1)+,(r2)+ ; copy byte beq 30$ ; br, if null dec r4 ; otherwise keep on going bgt 10$ 20$: clrb (r2)+ ; null terminate o/p string cmpb #4,r3 ; 4 args ?? bhi 30$ ; if more than 4, exit cmp #-1,(r5) ; default argument ?? beq 30$ ; br, if yes tstb (r1) ; null ?? beq 30$ ; br, if yes movb #-1,@(r5)+ ; return -1, truncated flag 30$: mov (sp)+,r3 mov (sp)+,r2 mov (sp)+,r1 return 40$: movb (r1)+,(r2)+ ; copy, including null bne 40$ br 30$ .end