.TITLE AddVersion1 ; Program to calculate the expression S = A + B A: .LONG 3 ; Initialize A B: .LONG 7 ; Initialize B S: .BLKL 1 ; Save room for S ; Subroutine Add(X, Y, Sum) for calculating Sum = X + Y ; Input: X in R0, Y in R1 ; Output: Sum in R2 Add: ADDL3 R0, R1, R2 ; Sum <-- X + Y RSB ; Return from subroutine ; The main program: .Entry ByValueInRegisters, 0 ; Call Add (A, B, S) MOVL A, R0 ; R0 <-- A MOVL B, R1 ; R1 <-- B BSBB Add ; Call the subroutine MOVL R2, S ; Save S $EXIT_S .END ByValueInRegisters