.TITLE UUENC uuencode data .IDENT /01/ ; ; UUENC UU-encodes R0 bytes at the location pointed to by R1 and stores them ; at the location pointed to by R2, finishing with a zero byte. ; UU-encoding uses 4 ASCII characters to represent 3 bytes, and even if there ; are less than 3 bytes left, 4 ASCII character are output. ; Input: R0 - number of bytes in buffer ; R1 - address of buffer ; R2 - address of output-buffer ; Output: R1 - address of buffer + R0 ; Linkage: PC ; affects R1 ; ; 10-JUL-2004 H.Rosenfeld ; .ENABL REG .CSECT UUENC:: MOV R0,-(SP) MOV R2,-(SP) MOV R3,-(SP) MOV R4,-(SP) MOV R5,-(SP) MOV R0,R3 JSR PC,ENCODE 1$: MOVB (R1)+,R0 MOVB (R1)+,R4 MOVB (R1)+,R5 SWAB R4 ASRB R0 ROLB R4 ASRB R0 ROLB R4 JSR PC,ENCODE MOV R4,R0 RORB R4 ROR R4 ROR R0 ROL R4 ROR R0 ROR R0 ROR R0 SWAB R0 JSR PC,ENCODE MOV R4,R0 SWAB R0 ROLB R5 ROL R0 ROLB R5 ROL R0 JSR PC,ENCODE MOV R5,R0 ASRB R0 ASRB R0 JSR PC,ENCODE SUB #3,R3 BEQ 2$ BPL 1$ ADD R3,R1 2$: CLRB (R2)+ MOV (SP)+,R5 MOV (SP)+,R4 MOV (SP)+,R3 MOV (SP)+,R2 MOV (SP)+,R0 RTS PC ; encode the byte in R0, save at (R2)+ ENCODE: MOV R0,-(SP) BIC #177700,R0 TSTB R0 BNE 1$ MOVB #'`,(R2)+ MOV (SP)+,R0 RTS PC 1$: ADD #40,R0 MOVB R0,(R2)+ MOV (SP)+,R0 RTS PC .END