LMC – Little Man Computer Program [ list largest

Here is  a program that reads three values as input and output these numbers in order from largest to smallest.

      INP
      STA 91 
      INP 
      STA 92 
      INP 
      STA 93 
      LDA 92 
      SUB 91 
      BRP 
STEP2 LDA 92 
      STA 99 
      LDA 91
      STA 92 
      LDA 99
      STA 91 
STEP2 LDA 93 
      SUB 92
      BRP
STEP3 LDA 93 
      STA 99 
      LDA 92
      STA 93 
      LDA 99
      STA 92 
STEP3 LDA 92 
      SUB 91
      BRP 
STEP4 LDA 92 
      STA 99 
      LDA 91
      STA 92 
      LDA 99
      STO 91 
STEP4 LDA 93 
      OUT
      LDA 92
      OUT
      LDA 91
      OUT
      HLT

 

Adnan Shahid / UI UX Designer, Graphics, Mobile, Print,Css3, Html5, bootstrap, Responsive Design
a2dstudio
adnanshahid.com

Twitter  Facebook  Google +  LinkedIn 

Leave a Reply