; Exercise 7a Blank = ^A" " ; Parameter list String = 4 ; Passed by descriptor Count = 8 ; Passed by reference ; R2 holds the current address in unpacked string ; R3 holds the current address in packed string .ENTRY PackLine ^M MOVL String(AP), R0 ; Move address of string ; descriptor to R0 MOVZWL (R0), R1 ; Move string length to R1 MOVL 4(R0), R2 ; Move string address to R2 MOVL R2, R3 ; Copy string address to R3 CLRL R6 ; Clear "Count" Loop: CMPB (r2), #Blank ; Is character in unpacked ; string a blank? BEQL Test ; Skip if so MOVB (R2), (R3)+ ; Move char to unpacked ; string INCL R6 ; Increment packed count Test: INCL R2 ; Increment address in ; unpacked string SOBGTR R1, Loop ; Repeat if not finished SUBL2 R3, R2 ; Find number of blanks MOVC5 #0, (R3), #Blank, R2, (R3) ; Blank fill remainder of ; packed string MOVL R6, @Count(AP) ; Return Count RET $EXIT_S .END