; ; Computes sum from i = 1 to N, placing result in sum. ; The algorithm used is the straightforward one, not that used by Gauss. ; .org 0x0100 gauss: subge sum,sum,next subge i,i,next loop: subge i,$-1,next subge tmp,tmp,next subge tmp,N,next subge k,k,next subge k,tmp,next subge k,i,cont ret: subge 0,0,0 ; placeholder cont: subge k,k,next subge k,i,next subge sum,k,loop i: .word 0 tmp: .word 0 k: .word 0 N: .word 0 sum: .word 0