; sum_asm_func.asm
; assembly function to find n+(n-1)+...+1+0

        .def            _sum_asm_func   ; asm function called from C
_sum_asm_func:  MV      .L1     A4,A1   ; setup N as loop counter in A1

LOOP:           SUB     .S1     A1,1,A1  ; decrement loop counter A1
                ADD     .L1     A4,A1,A4 ; accumulate in A4
        [A1]    B       .S2     LOOP    ; branch to LOOP if A1#0
                NOP     5               ; five NOPs for delay slots
                B       .S2     B3      ; return to calling routine
                NOP     5               ; five NOPs for delay slots
                .end
