program Sum
// Input:    Sequence of non-zero integers, followed by 0000
// Output:   The sum of all the integers.
// -----------------------------------------------------------------------------

// Initialize
10: 7C00   RC <- 0000                    sum = 0
                                         while (true) {
11: 8AFF   read RA                          read a
12: CA15   if (RA == 0) pc <- 15            if (a == 0) break 
13: 1CCA   RC <- RC + RA                    sum = sum + a
14: C011   pc <- 11                      }
15: 9CFF   write RC                      write sum
16: 0000   halt
