Trailer Value Looping 1

Read a value. Echo print it. Multiply it by 5 Print this result. Repeat the process until the value read in is zero. (Note: Echo print means to print immediately after reading, before using the value in any processing. The check for trailer value or out of data must be done first, however, to determine whether the value read in is to be treated as a data value to be processed or a special value signaling the end of the loop process.)

Flowchart      RAMM Machine Language Program     RAMM Assembly Language Program
    

Flowchart:



RAMM Machine Language Program:

0000  00  VAL
0000  01  P
0005  02  K5
5000  03  STRT  No operation
6500  04        Read VAL
1200  05        Load (A-Reg) with (VAL)
3613  06        Jump if (A-Reg) is zero to EXIT
6600  07        Print VAL
1200  08        Load (A-Reg) with (VAL)
2402  09        Multiply (A-Reg) by (K5)
2001  10        Store (A-Reg) at P
6601  11        Print P
7503  12        Unconditional Jump to STRT
0000  13  EXIT  Halt
9903  14        End and begin program execution at STRT


RAMM Assembly Language Program:

VAL   BSS 0001     
P     BSS 0001     
K5    DEC 0005     
STRT  NOP          
      RDI VAL      
      LDA VAL
      AZJ EXIT
      PRI VAL
      LDA VAL
      IMU K5
      STA P
      PRI P
      UNJ STRT
EXIT  HLT
      END STRT