Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions 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
expand button
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
Check Mark
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

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