Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an LC-3 assembly language program that determines the maximum and minimum

ID: 3802653 • Letter: W

Question

Write an LC-3 assembly language program that determines the maximum and minimum values of an array. Your program should start at memory location x3000; the “max” and “min” values should be formatted (e.g., "Max = ...", etc.) and output to the console using the memory-mapped I/O registers (not the system traps). Test your program by executing it using the LC-3 simulator. The number of elements in the array should be specified in the memory location immediately following your program, and then the values in the array should follow this number. For this assignment, you should turn in a paper program listing and screen shot of your console output. Use appropriate formatting and comments to make your program easy to read and understand. Also include your name and a “Register Dictionary” at the beginning of your program. To simplify output formatting, you may assume that all of the values in the array are unsigned and less than ten (i.e. positive single digits). Use the following array data values when you run the program for the console I/O screen shot: 1,3,7,2,5,4,8,7,0,2.

Explanation / Answer

assume you are refering to the McGraw-Hill LC-3 simulator. I have downloaded the (I hope appropriate) package; assuming that is correct, I have to unpack, learn the package, write the program, and add it to this post...

Ok, a "WORD" is two bytes -- and the simulator is a "RISC" style machine, that doesn't allow direct byte access.

BRnzp means "branch always" Each BR may have up to three conditions (negative, zero, positive). So BR means "branch never". As well, there is no "MOVE" instruction, ADD is used. Some operands read left to right, some right to left -- I'll have to sort that mess out.

My first program in LC-3:

| .ORIG x3000
| LEA R0,STRING
| PUTS
| HALT
|STRING .STRINGZ "Hello, world "
| .END

PUTS and HALT are implemented as "TRAPS" that are serviced by an operating system written in LC-3. I guess that is going to be coursework for you in the very near future.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote