Trailer Value Looping 4

Read two values. If the first value is not zero, print the second value and its square. If the first value is zero, stop. Repeat this for an unknown, but odd, number of cards.

Flowchart      RAMM Machine Language Program     RAMM Assembly Language Program
    

Flowchart:



RAMM Machine Language Program:

0000 00 Storage for A
0000 01 Storage for B
0000 02 Storage for BB
5000 03 STRT  No operation
6500 04       Read A
1200 05       (A-reg) <- (A)
3614 06       If (A-reg) = 0, then jump to EXIT
6501 07       Read B
1201 08       (A-reg) <- (B)
2401 09       (A-reg) <- (A-reg) * (B)
2002 10       (BB) <- (A-reg)
6601 11       Print B
6602 12       Print BB
7503 13       Unconditionally jump to STRT
0000 14 EXIT  Halt
9903 15       End; begin execution at STRT


RAMM Assembly Language Program:

A     BSS 0001
B     BSS 0001
BB    BSS 0001
STRT  NOP
      RDI A
      LDA A
      AZJ EXIT
      RDI B
      LDA B
      IMU B
      STA BB
      PRI B
      PRI BB
      UNJ STRT
EXIT  HLT
      END STRT