;; This program reads in a sequence of positive ;; integers terminated by a non positive integer. ;; It counts the number of positive input integers <= 21 ;; and prints that number out. ;; ;; Date Written: 2008/02/13 ;; Author: Jordan Barry allocate-registers count, zero, age, legal-age, end, loop-start, sentinel, legal? li count, 0 li zero, 0 li legal-age, 21 li end, Lend li loop-start, Lloop Lloop: read age sgt sentinel, age, zero jeqz sentinel, end slt legal?, age, legal-age add count, count, legal? ; legal? will have 1 if under age, 0 if it isn't j loop-start Lend: write count halt