Simple Flowcharts 3

Flowchart a procedure that will assign to x the value of 502 and to y the value of 6. Compute the expressions x+3y and 2x-y and print both results.

Flowchart      RAMM Machine Language Program     RAMM Assembly Language Program
    

Flowchart:



RAMM Machine Language Program:

0000 00 Storage for X
0000 01 Storage for Y
0000 02 Storage for Z1
0000 03 Storage for Z2
0002 04 Decimal constant 2
0003 05 Decimal constant 3
0006 06 Decimal constant 6
0502 07 Decimal constant 502
5000 08 STRT  no operation
1207 09       Load (A-reg) with constant 502
2000 10       Store (A-reg) at location X
1206 11       Load (A-reg) with constant 6
2001 12       Store (A-reg) at location Y
1205 13       Load (A-reg) with constant 3
2401 14       Multiply (A-reg) by Y
1400 15       Add X to (A-reg)
2002 16       Store (A-reg) at location Z1
1204 17       Load (A-reg) with constant 2
2400 18       Multiply (A-reg) by X
1501 19       Subtract Y from (A-reg)
2003 20       Store (A-reg) at Z2
6602 21       Print Z1
6603 22       Print Z2
0000 23       Halt
9908 24       End; begin program execution at STRT


RAMM Assembly Language Program:

X     BSS 0001
Y     BSS 0001
Z1    BSS 0001
Z2    BSS 0001
I2    DEC 0002
I3    DEC 0003
I6    DEC 0006
I502  DEC 0502
STRT  NOP
      LDA I502
      STA X
      LDA I6
      STA Y
      LDA I3
      IMU Y
      IAD X
      STA Z1
      LDA I2
      IMU X
      ISB Y
      STA Z2
      PRI Z1
      PRI Z2
      HLT
      END STRT