write in assebly language using lc3 simulator LC3 simulator-https://wchargin.com/lc3web/  Write a program that implements a for loop that adds 5 to R3 every iteration a. Increment a register by 1 in every cycle of the loop to keep track of the loop iterations b. Store the maximum amount of iterations that the loop can have in a memory location c. Your for loop should start at 0 iterations (i.e. i = 0) and stop looping once the maximum is reached Psuedo code: .ORIG x3000 ; Step 1: Clear R3 ; Step 2: Clear R0 ; Step 3: Load the value of MAX into R1 (maximum amount of iterations) ; Step 4: Take the two's compliment of R1 (2 instructions!)   loop ; Step 5: Add #5 to R3 (result) ; Step 6: Increment R0 (loop iteration counter) ; Step 7: Add R1 and R0 and put the result in R2 (Since we did a 2's complement on R1, we are essentially subtracting R1 from R0) ; Step 8: Branch if negative back to loop (this means that R1 > R0 and we need to keep looping) ; Step 9: Halt CPU   MAX .FILL x5 .END

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

write in assebly language using lc3 simulator

LC3 simulator-https://wchargin.com/lc3web/ 

Write a program that implements a for loop that adds 5 to R3 every iteration

a. Increment a register by 1 in every cycle of the loop to keep track of the loop iterations
b. Store the maximum amount of iterations that the loop can have in a memory location
c. Your for loop should start at 0 iterations (i.e. i = 0) and stop looping once the maximum is reached

Psuedo code:

  1. .ORIG x3000
  2. ; Step 1: Clear R3
  3. ; Step 2: Clear R0
  4. ; Step 3: Load the value of MAX into R1 (maximum amount of iterations)
  5. ; Step 4: Take the two's compliment of R1 (2 instructions!)
  6.  
  7. loop ; Step 5: Add #5 to R3 (result)
  8. ; Step 6: Increment R0 (loop iteration counter)
  9. ; Step 7: Add R1 and R0 and put the result in R2 (Since we did a 2's complement on R1, we are essentially subtracting R1 from R0)
  10. ; Step 8: Branch if negative back to loop (this means that R1 > R0 and we need to keep looping)
  11. ; Step 9: Halt CPU
  12.  
  13. MAX .FILL x5
  14. .END
Expert Solution
Step 1

LC3 (Little Computer 3) is a simulator for a simple computer architecture that is commonly used to teach assembly language programming. The LC3 simulator provides an environment for writing, testing, and executing assembly language programs.

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education