Purchase Solution

Little Man Computer: Higher of two numbers

Not what you're looking for?

Ask Custom Question

The following LMC (Little Man Computer) program is supposed to input two numbers, compare them, and output the higher of the two numbers. There is something wrong with this program but I can not figure it out. Please help me fix it.

Mailbox Mnemonic Code
01 IN 901
02 STO 90 390
03 IN 901
04 STO 91 391
05 SUB 90 290
06 BRP 10 810
07 LDA 91 591
08 OUT 902
09 COB 000
10 LDA 90 590
11 OUT 902
12 COB 000

Purchase this Solution

Solution Summary

For ease of understanding, solution works with the equivalent source code form of the given program. It first explains the cause of the bug in the given program and then gives the solution to fix that.

Solution Preview

Your given program must be looking something like below in source form.

IN
STO FST
IN
STO SND
SUB FST
BRP FGS
LDA SND
OUT
COB
FGS LDA FST
OUT
COB
FST DAT ...

Purchase this Solution


Free BrainMass Quizzes
C++ Operators

This quiz tests a student's knowledge about C++ operators.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

C# variables and classes

This quiz contains questions about C# classes and variables.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Javscript Basics

Quiz on basics of javascript programming language.