Header Value Looping 2

Flowchart a procedure to read a value num to indicate the number of employees, then to read in a value h (number of hours worked) and a value r (hourly rate of pay) for each employee. Compute p (gross pay) and print hours, rate, and gross pay for each employee.

Flowchart      RAMM Machine Language Program     RAMM Assembly Language Program
    

Flowchart:



RAMM Machine Language Program:

0001 00 Integer constant 1, I1
0000 01 Storage for NUM
0000 02 Storage for H
0000 03 Storage for R
0000 04 Storage for P
5000 05 STRT  No operation
6501 06       Read NUM
6502 07 LOOP  Read H
6503 08       Read R
1202 09       (A-reg) <- (H)
2403 10       (A-reg) <- (A-reg) * (R)
2004 11       (P) <- (A-reg)
6602 12       Print H
6603 13       Print R
6604 14       Print P
1201 15       (A-reg) <- (NUM)
1500 16       (A-reg) <- (A-reg) - (I1)
2001 17       (NUM) <- (A-reg)
3621 18       If (A-reg) = 0, then jump to EXIT
3721 19       If (A-reg) < 0, then jump to EXIT
7507 20       Unconditionally jump to LOOP
0000 21 EXIT  Halt
9905 22       End; begin execution at STRT


RAMM Assembly Language Program:

I1    DEC 0001
NUM   BSS 0001
H     BSS 0001
R     BSS 0001
P     BSS 0001
STRT  NOP
      RDI NUM
LOOP  RDI H
      RDI R
      LDA H
      IMU R
      STA P
      PRI H
      PRI R
      PRI P
      LDA NUM
      ISB I1
      STA NUM
      AZJ EXIT
      AMJ EXIT
      UNJ LOOP
EXIT  HLT
      END STRT