Write the following pseudocode in assembly language code that can be outed into a simulate like Lc3 simulat
Write the following pseudocode in assembly language code that can be outed into a simulate like Lc3 simulator! Thank you!
.FILL i
.FILL max
for (i = 0; i < max; i++) {
R3 = R3 + 5
}
.END
![](/static/compass_v2/shared-icons/check-mark.png)
The assembly code:
i .FILL
max .javascript:;FILL
AND R0, R0, #0 ; AND with 0 yields zero
ST R0, i ; store 0 in i
TEST LD R0, i ; get i
LD R1, max ; get max
NOT R1, R1 ; two's complement
ADD R1, R1, #1
ADD R0, R0, R1 ; compute i - max
BRzp END ; done when (i - max) >= 0
LD R0, R3 ; load from memory to a register
ADD R0, R0, #1 ; increment value
ST R0, R3 ; store from register to memory
INCR LD R0, i ; get i
ADD R0, R0, #1 ; increment it
ST R0, i ; save the new value
BR TEST ; go back and test again
END ; code after loop completes
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)