?
Solved

LMC programing trouble

Posted on 2009-06-27
2
Medium Priority
?
315 Views
Last Modified: 2012-05-07
Im writing a program that accepts 3 values as input and produces the largest of the 3 as output.

Still having code issues, have utilized all my resources, what and where am i going wrong in writing the correct code format to achieve the above execution, can you advise thanks.

00 INP   901
01 STO  399
02 INP   901
03 STO   398
04 INP   901
05 STO   397
06 LDA   599
07 BRZ   712
08 LDA   599
09 SUB   298
10 OUT   902
11 BR      615
12 LDA   598
13 ADD   197
14 OUT   902
15 STOP 000

Open in new window

0
Comment
Question by:USN4x4
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 31

Expert Comment

by:moorhouselondon
ID: 24729174
I don't know the intricacies of this language, but assuming this is like standard assembler code, let me have a try:-

Am I right in thinking that INP is equivalent to an Opcode of 9?  LDA = 5?  ADD = 1? etc.

If so:-

A is put into 99
B is put into 98
C is put into 97


The contents of 99 are then being loaded into the Accumulator and testing it for Zero.

Does BRZ really mean Branch if zero?  Are there not Operation Codes more suited for testing whether things are Greater Than or Less Than each other?

I could go further into the code, but let me know whether I'm understanding the language correctly or not first.
0
 
LVL 31

Accepted Solution

by:
moorhouselondon earned 1500 total points
ID: 24729198
Sorry, I rewrote the whole of my comment cos my first attempt was useless, and I left a bit out in the middle, but my question was in fact about the line

11 BR 615

What does this test do?  

In actual fact, if you precede all of the lines with a comment and resubmit them here, I suspect you will have a lightbulb moment and want to close the question.  Yes yes, you are learning programming and programmers aren't supposed to comment things ;-))

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Six Sigma Control Plans
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question