Example 4. Assembly Program for Example 3

; Tell the assembler we're referencing variable "_svar", which is defined in ; another file (cvars.c). ;------------------------------------------------------------------------------ .ref _svar ;------------------------------------------------------------------------------ ; addfive() - Add five to the second data member of _svar ;------------------------------------------------------------------------------ .text .global addfive addfive: .asmfunc LDW .D2T2 *+B14(_svar+4),B4 ; load svar.m2 into B4 RET .S2 B3 ; return from function NOP 3 ; delay slots 1-3 ADD .D2 5,B4,B4 ; add 5 to B4 (delay slot 4) STW .D2T2 B4,*+B14(_svar+4) ; store B4 back into svar.m2 ; (delay slot 5) .endasmfunc