Little Man Computer (LMC)

Discussion in 'Software' started by CJR19751, Apr 24, 2013.

  1. CJR19751

    CJR19751 Private E-2

    Could Somebody please help me with the Little Man Computer please.
    I have to create a program that will:- Pseudo code

    Loop;

    input a number;
    if number = 0, end program;
    if number > 0, add to first number (or sum);
    show total;

    loopup;

    This is driving me crazy. Thank you in advance for your help.
     
  2. pwillener

    pwillener MajorGeek

  3. CJR19751

    CJR19751 Private E-2

    Hell pwillener.

    Thank you for your reply. In theory your solution is correct.

    If this program had to be written in VB, C#, C, C++ or Java I would be fine.
    I just cant get used to the syntax of LMC. This is the part that is driving me crazy.
     
  4. CJR19751

    CJR19751 Private E-2

    Thank you again pwillener.
    I took time last night to reflect on what you posted.
    the instruction set is really not that difficult if you think about it.
    this is the instruction set that made more sense to me

    http://voyager.egglescliffe.org.uk/mwc/mukoku/mod/resource/view.php?inpopup=true&id=674

    and the program I created is this:

    START: INP
    IF: BRZ :END
    STA :SUM1
    ADD :SUM2
    STA :SUM2
    OUT
    BRA :START
    SUM1: 0
    SUM2: 0
    END: HLT

    Thank you again pwillener for your in-sight.
     
  5. CJR19751

    CJR19751 Private E-2

    Sorry pwillener, I ment Hello not Hell :)
    I got the LMC working.
    START: INP
    IF: BRZ :END
    STA :SUM1
    ADD :SUM2
    STA :SUM2
    OUT
    BRA :START
    SUM1: 0
    SUM2: 0
    END: HLT
    That was it. All that stress for that.
    Again thank you pwillener
     
  6. pwillener

    pwillener MajorGeek

    Great; congratulations! :cool
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds