Questions tagged [little-man-computer]

Little Man Computer (LMC) models an instructional Von Neumann computer architecture and uses assembly language.

Little Man Computer (LMC) models an instructional Von Neumann computer architecture and uses language. It is mostly used for educational purposes.

Questions about programming issues involving LMC should clarify which simulator the code should run on, as there are different interpretations on how a LMC should work with negative numbers and overflow.

There are several simulators available on the web, including those published by:

These take assembly code as input and run the program visualising the process.

For more info, see:

90 questions
0
votes
1 answer

Using LMC to solve algebraic equations

I am getting stuck on writing a program for the following:     a2 + (b x c). There appears to be a problem with my loops, but I cannot solve it. I can get a2 and a multiplication, but when I try to combine the two, it just keeps asking for inputs…
Kemo03
  • 1
0
votes
1 answer

LMC Program (Using branch) to store values in different locations

So this is for a school project: I need to design a program (using a branch loop) that stores 1 in memory location 91, 2 in 92 etc... to 5 is stored in 95. I am not very knowledgable of LMC and would like some advice on it. I use…
Sam Hockham
  • 23
  • 1
  • 6
0
votes
1 answer

Saving a value into a 2D array

I'm trying to set up an array where I can save a value into the 2D array so I can use it later for calculations. I have set up the array however when I go to save the value it changes the value into the value of the array position E.g. array[0][0]…
0
votes
3 answers

Design an algorithm to input 2 numbers and then output the lowest number in little man computing

I have a program I'm doing and I want to input two numbers so that the LMC can output the smallest one. MY code is giving me the biggest number, help me fix it. INP STA first INP STA second SUB second BRP secondBig LDA second OUT BRA…
Jeff
  • 13
  • 1
  • 3
0
votes
1 answer

Little Man Computer : if(value==0){ some_statements;

I'm personally attempting to learn the little man computer. I found a problem: Write an LMC (Little Man Computer) program to do the following task. if (value == 0) { some_statements; } next_statement; My current answer: 00 901 IN…
0
votes
1 answer

A LMC(little man computer) program to multiply two negative numbers

Can you help me to write a lmc program to multiply 2 negatives (-x)*(-y) = xy? For example, if you input -5 and -6, it should give you 30. I have done for x*y=xy INP STA FIRST INP STA SECOND LOOP LDA COUNT ADD ONE STA COUNT LDA TOTAL ADD FIRST STA…
0
votes
1 answer

Why are these few lines of assembly code necessary for my program to function properly?

I have created a simple program on LMC that squares an input. INP STA X LDA X STA Y LOOP LDA Y BRZ END LDA ANSWER ADD X STA ANSWER LDA Y SUB ONE STA Y …
Enigmatic
  • 3,902
  • 6
  • 26
  • 48
0
votes
3 answers

Design an algorithm to input 3 numbers and then output the highest in little man computing

I can program it to output the highest of 2 numbers but am stuck on how to output the highest of 3 numbers input. Can anyone help please?
Janine Hawkins
  • 19
  • 1
  • 1
  • 2
0
votes
2 answers

LMC changing the y value

This is the code in JavaScript that I want to convert to LMC assembly code: My task is to write a program for LMC that…
JACK13
  • 1
  • 1
0
votes
1 answer

Little Man Computer won't branch at zero when looping

so I am creating a thing in the LMC where I count from 5 to 17 and display the odd numbers. I've got the code done however when I try to branch at zero when the code hits 17 it won't work and it will keep outputting past 17. The way I'm trying to do…
0
votes
3 answers

Little Man Computer Loops

How would I create a loop that allows multiple inputs entered and stored in mailboxes. I have trouble storing it in different mailboxes. The program will stop when 000 is entered or there is no more room in the mailboxes. Thanks for the help!
0
votes
1 answer

LMC Instructions for traffic lights (if statements)

I have an assignment for school where I have an input number, and based on that input, I take the traffic controller and use different directions. The LMC knows add, subtraction, input, output, etc. Based on my input (either 0, 5, 10, or 15) I have…
0
votes
1 answer

Little Man Computer Sorting two numbers biggest to smallest

The program is designed to subtract the first input by the second and if the result is positive or zero then input 1 is bigger (or the same) so input 1 is outputed first. This all works fine when the first number is bigger but when the first number…
Huhmit
  • 1
  • 1
  • 3
0
votes
0 answers

Merge sort in LMC / Assembly

I want to implement a merge sort in LMC where I input a pre-sorted array of values and store them then input a second pre-sorted array of values and merge sort them with the first array but I'm having a lot of trouble with my sorting and array shift…
0
votes
4 answers

Regarding Little man computer remainder (modulus) of dividing numers

Write a program that asks the user to enter 2 numbers. The program then displays to the screen (OUT) the result of taking the remainder (modulus) of dividing the second number into the first number. For example, if the first number entered was 14…
Karan
  • 1
  • 1
  • 1