Learning Objectives Understand writing simple programs in the LC3 simulator Learn the interface of the LC3 simulator and editor Overview You will be implementing simple loops, if statements, and mathematical operations in assembly. The Programs You will be writing 4 separate programs in assembly for the LC3: 1. Write a program that calculates the result of z = x a. Store x and y in memory locations when writing your program (use .FILL) b. The output of your result, z, should be left in register R3 at the end of your program C. Assume (6 >= x >= 0) and (6 >= y >= 0) 2. 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 3. Write a program that implements a while loop a. Loop while(RO > -10) b. For every iteration of the loop subtract 2 from RO C. RO should start at 0 4. Implement an if-else statement a. An if-else statement will execute one out of two blocks of code b. C. Your if-else statement should check if RO = R1, then make R3 = 5, if RO R1, then make R3 = -5 You can manually modify RO, R1, and R3, in the simulator (before running your program only). You do not have to program values for these registers

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

pls help! write a program from the following in assembley language code. you can you the online simulator lc3 https://wchargin.com/lc3web/ .pls help me i am really confused!

Learning Objectives
Understand writing simple programs in the LC3 simulator
Learn the interface of the LC3 simulator and editor
Overview
You will be implementing simple loops, if statements, and mathematical operations in assembly.
The Programs
You will be writing 4 separate programs in assembly for the LC3:
1. Write a program that calculates the result of z = x
a.
Store x and y in memory locations when writing your program (use .FILL)
b. The output of your result, z, should be left in register R3 at the end of your program
Assume (6 >= x >= 0) and (6 >= y >= 0)
C.
2. 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
3. Write a program that implements a while loop
a. Loop while(RO > -10)
b.
For every iteration of the loop subtract 2 from RO
C.
RO should start at 0
4. Implement an if-else statement
a.
An if-else statement will execute one out of two blocks of code
b. Your if-else statement should check if R0 = R1, then make R3 = 5, if RO ‡ R1, then make R3 = -5
C. You can manually modify RO, R1, and R3, in the simulator (before running your program only). You do not
have to program values for these registers
Transcribed Image Text:Learning Objectives Understand writing simple programs in the LC3 simulator Learn the interface of the LC3 simulator and editor Overview You will be implementing simple loops, if statements, and mathematical operations in assembly. The Programs You will be writing 4 separate programs in assembly for the LC3: 1. Write a program that calculates the result of z = x a. Store x and y in memory locations when writing your program (use .FILL) b. The output of your result, z, should be left in register R3 at the end of your program Assume (6 >= x >= 0) and (6 >= y >= 0) C. 2. 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 3. Write a program that implements a while loop a. Loop while(RO > -10) b. For every iteration of the loop subtract 2 from RO C. RO should start at 0 4. Implement an if-else statement a. An if-else statement will execute one out of two blocks of code b. Your if-else statement should check if R0 = R1, then make R3 = 5, if RO ‡ R1, then make R3 = -5 C. You can manually modify RO, R1, and R3, in the simulator (before running your program only). You do not have to program values for these registers
Expert Solution
Step 1

Program in assembly

 

1.

.FILL x 
.FILL y

z = x + y

.END

 

2.

.FILL i 
.FILL max

for (i = 0; i < max; i++) { 
R3 = R3 + 5 
}

.END

 

3.

.FILL RO

while (RO > -10) { 
RO = RO - 2 
}

.END

 

4.

.FILL RO 
.FILL R1

if (RO == R1) { 
R3 = 5 
} else { 
R3 = -5 
}

.END

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY