;;; Authors: MCS-178 gang -- 02/10/2006 ;;; ;;; sq.s -- write the sums of the first i odd numbers ;;; for i = 1, 2, 3, ..., 10 allocate-registers one, two, ten ; constants allocate-registers a, s, n, stop ; temporaries allocate-registers loop ; label li one, 1 li two, 2 li ten, 10 li loop, Lloop li n, 0 li s, 0 li a, -1 Lloop: add n, n, one add a, a, two add s, s, a write s sge stop, n, ten jeqz stop, loop halt