D2L Bright space Find the Maximum Write a LC-3 assembly language program to comp
ID: 3841261 • Letter: D
Question
D2L Bright space Find the Maximum Write a LC-3 assembly language program to compute the maximum value stored in 10 memory locations, where the values are all positive integers in the range 1 to 32767, Program input Store 10 values in consecutive memory locations. Store them starting from location x3200 Program output: The maximum of the 10 values should be stored in the memory location x320A Follow the these steps: Write your program Type your program in a text editor. Your program file needs to be in plain text format, in a file called maxval.asm. Your program should start from memory location x3000. Start labels, opcode, operands, and comments in same column for each line. Use comments to explain what each register does and give explanatory comments for most instructions. Use meaningful symbolic names. Test your program: After converting your program to an object file using the lc3as command, load the object file in the LC-3 simulator and test it using multiple sets of input values (in the range 1 to x7FFF). In the simulator,Explanation / Answer
.ORIG x3000
GET_MAX
LD R1, NUMBER_MARKS ; R1 holds the total number of marks need to examine
LD R2, MARKS_ADDRESS ; R2 holds starting address 0x3200
AND R3, R3, #0
LOOP1 LDR R4, R2, #0
NOT R5, R4
ADD R5, R5, #1
ADD R5, R5, R3
BRp NEXT1
ADD R3, R4, #0
NEXT1 ADD R2, R2, #1
ADD R1, R1, #-1
BRp LOOP1
LEA R0,MAXIMUM_MARKS
STR R3, R0, #0
;DATA DECLARATION
NUMBER_MARKS .FILL 10
MARKS_ADDRESS .FILL x3200
MAXIMUM_MARKS .BLKW 1 x320A
.END
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.