.TITLE CONCAT .IDENT /X01.00/ ; ; Author: Gilbert J. DeLeeuw ; Date: August 20, 1984 ; Name: CONCAT - Concatenate strings ; Function: Concatenate two strings by appending string 2 to string 1 ; ; ; Parameters: ; ; R0 - Size of string 1 ; R1 - Address of string 1 ; ; R2 - Size of string 2 ; R3 - Address of string 2 ; CONCAT:: TST R2 ;Test length of string 2 BLE DONE ;If null string ; ; Save starting point MOV R1,-(SP) ;Save starting address ; ; Point to first free byte ADD R0,R1 ;Point to end of first string ; ; Copy string 2 10$: MOVB (R3)+,(R1)+ ;Copy character SOB R2,10$ ;Loop over length ; ; Get descriptor for new string MOV R1,R0 ;Copy ending address MOV (SP)+,R1 ;Restore starting address SUB R1,R0 ;Subtract to get length ; ; Done DONE: RTS PC ;Return to caller .END