Header Value Looping 3

Flowchart a procedure to read in a header value j to indicate how many sets of data will follow. A set of data will consist of three values -- a, b, and c -- for which you will compute the expression (a - b) / c. Then Print a, b, c, and the value of the expression. Repeat this for j sets of data and stop.

Flowchart      RAMM Machine Language Program     RAMM Assembly Language Program
    

Flowchart:



RAMM Machine Language Program:

0000  00  K
0000  01  J
0000  02  A
0000  03  B
0000  04  C
0000  05  R
0000  06  K0
0001  07  K1
5000  08  STRT  No operation
1206  09        Load (A-Reg) with K0
2000  10        Store (A-Reg) at K
6501  11        Read J
6502  12  LOOP  Read A
6503  13        Read B
6504  14        Read C
1202  15        Load (A-Reg) with (A)
1503  16        Subtract (B) from (A-Reg)
2504  17        Divide (A-Reg) by (C)
2005  18        Store (A-Reg) at R
6602  19        Print A
6603  20        Print B
6604  21        Print C
6605  22        Print R
1200  23        Load (A-Reg) with (K)
1407  24        Add (A-Reg) to (K1)
2000  25        Store (A-Reg) at K
1200  26        Load (A-Reg) with (K)
1501  27        Subtract (J) from (A-Reg)
3712  28        Jump if (A-Reg) is negative to LOOP
0000  29        Halt
9908  30        End and begin program execution at STRT


RAMM Assembly Language Program:

K     BSS 0001      
J     BSS 0001
A     BSS 0001
B     BSS 0001
C     BSS 0001
R     BSS 0001
K0    DEC 0000
K1    DEC 0001
STRT  NOP
      LDA K0
      STA K
      RDI J
LOOP  RDI A
      RDI B
      RDI C
      LDA A
      ISB B
      IDV C
      STA R
      PRI A
      PRI B
      PRI C
      PRI R
      LDA K
      IAD K1
      STA K
      LDA K
      ISB J
      AMJ LOOP
      HLT
      END STRT