Trailer Value Looping 2

Flowchart a procedure to read a value for a. If a is equal to 999, stop processing. Otherwise read a value for b. Calculate c as the sum of a and b and then print c. Continue processing an unknown number of values for a and b until a = 999.

Flowchart      RAMM Machine Language Program     RAMM Assembly Language Program
    

Flowchart:



RAMM Machine Language Program:

0999 00 Integer constant of 999, I999
0000 01 Storage for A
0000 02 Storage for B
0000 03 Storage for C
5000 04 STRT  No operation
6501 05       Read A
1201 06       (A-reg) <- (A)
1500 07       (A-reg) <- (A-reg) - (I999)
3615 08       If (A-reg) = 0, then jump to EXIT
6502 09       Read B
1201 10       (A-reg) <- (A)
1402 11       (A-reg) <- (A-reg) + (B)
2003 12       (C) <- (A-reg)
6603 13       Print C
7504 14       Unconditionally jump to STRT
0000 15 EXIT  Halt
9904 16       End; begin execution at STRT


RAMM Assembly Language Program:

I999  DEC 0999
A     BSS 0001
B     BSS 0001
C     BSS 0001
STRT  NOP
      RDI A
      LDA A
      ISB I999
      AZJ EXIT
      RDI B
      LDA A
      IAD B
      STA C
      PRI C
      UNJ STRT
EXIT  HLT
      END STRT