Trailer Value Looping 5

Read a value. If that value is not equal to zero, read and print the sum of the next two values. If the first value is equal to zero, however, stop. Continue this process for additional sets of three values until zero is encountered for the first value in a set.

Flowchart      RAMM Machine Language Program     RAMM Assembly Language Program
    

Flowchart:



RAMM Machine Language Program:

0000  00  A
0000  01  B
0000  02  C
0000  03  SUM
5000  04  STRT  No operation
6500  05        Read A
1200  06        Load (A-Reg) with (A)
3615  07        Jump if (A-Reg) is zero to EXIT
6501  08        Read B
6502  09        Read C
1201  10        Load (A-Reg) with (B)
1402  11        Add (C) to (A-Reg)
2003  12        Store (A-Reg) at SUM
6603  13        Print SUM
7504  14        Unconditional Jump to STRT
0000  15  EXIT  Halt
9904  16        End and begin program execution at STRT


RAMM Assembly Language Program:

A     BSS 0001
B     BSS 0001
C     BSS 0001
SUM   BSS 0001
STRT  NOP
      RDI A
      LDA A
      AZJ EXIT
      RDI B
      RDI C
      LDA B
      IAD C
      STA SUM
      PRI SUM
      UNJ STRT
EXIT  HLT
      END STRT