.TITLE Average Version 7 ; This program will calculate the average of ; three numbers X, Y, and Z. The result will be ; saved in location Ave X: .WORD 1560 ; Create storage for X(0) .WORD 1432 ; This word is X(1) .WORD 2167 ; This word is X(2) Ave: .BLKW 1 ; Save room for the answer .ENTRY AVERAGE, 0 Begin: MOVAW X, R6 ; Move the address of ; X(0) into R6 ADDW3 (R6)+, (R6)+, R5 ; R5 contains X(0) + X(1) ADDW2 (R6)+, R5 ; R5 contains final sum DIVW3 #3, R5, (R6) ; Ave contains R5/3 Done: $EXIT_S .END AVERAGE