Question

This program is supposed to set RO-1 if theres a 5 in one of ten memory locations, starting at x3100 Else, it should set RO

   write a LC-3 program

0 0
Add a comment Improve this question Transcribed image text
Answer #1
1.  First we set R0=1, R1=-5 ,r3=10, R4=x3100 , R2=M[R4]
then we check if there is value 5 at memory location R4 if yes so we will halt
if no then we will do this calculations 
R4++
R3--
R2=M[R4]
2. Then we check if there is value zero in R3 then we will set R3 to 0 and halt else we will set value of R2 again to 5
in ist iteration when condition shown in line is checked this will match and we assume that the condition is false so we will increment R4 like x3101 
decrement R3 as 9 and save the value of memory to r2 AND CHECK THAT IF ITS FALSE THEN WE WILL REPEAT STEP2 

3.Then we check if there is value zero in R3 then we will set R3 to 0 and halt else we will set value of R2 again to VALUE SET BY MEMORY in 2ND iteration when condition shown in line is checked this will match and we assume that the condition is false so we will increment R4 like x3102 
decrement R3 as 8 and save the value of memory to r2 AND CHECK THAT IF ITS FALSE THEN WE WILL REPEAT STEP2 

4.Then we check if there is value zero in R then we will set R3 to 0 and halt else we will set value of R2 again to VALUE SET BY MEMORY
in 3RD iteration when condition shown in line is checked this will match and we assume that the condition is false so we will increment R4 like x3103 
decrement R3 as 6 and save the value of memory to r2 AND CHECK THAT IF ITS FALSE THEN WE WILL REPEAT STEP2 

5. Then we check if there is value zero in R3 then we will set R3 to 0 and halt else we will set value of R2 again to VALUE SET BY MEMORY
in 4TH iteration when condition shown in line is checked this will match and we assume that the condition is false so we will increment R4 like x3104 
decrement R3 as 5 and save the value of memory to r2 and check that if it's FALSE then we will REPEAT STEP2 

So here is 4TH iteration and we found 5 but now the condition will FALSE and we will HALT the program and statement will be 5 cantc find because our scenario is to find it at X3107 A
and its at X3104.
Add a comment
Know the answer?
Add Answer to:
This program is supposed to set RO-1 if there's a 5 in one of ten memory locations, starting at x...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 5.3 Rewrite the following program fragment that is written using the GPR instruction set for execution...

    5.3 Rewrite the following program fragment that is written using the GPR instruction set for execution on a CISC processor that provides the same instruction set as the GPR processor but allows the register addressing mode to be used on the input operands or destination of any instruction. (Yes, the code fragment will execute correctly as written on such a processor. Your goal should be to reduce the number of instructions as much as possible. ) Assume that the program...

  • Section B - ARM Assembly Language (25 marks) An ARM instruction set summary is provided at...

    Section B - ARM Assembly Language (25 marks) An ARM instruction set summary is provided at the end of this paper 1. (5 marks) Consider the following assembly instruction STMFD r13!, (r5-6} Before executing this instruction, registers hold the following values: Register Value Register r9 Value r4 0x00400040 0x00000000 r5 r10 0x11223344 0x00800080 r6 0x55667788 r11 0x10001000 r7 0x99aabbcc r12 0x20002000 r8 exddeeff00 r13 ex40004000 What memory locations are affected after executing the above instruction? In a table, with a...

  • Implement the following statements using MS430 assembly instructions. You may use more than one, ...

    Implement the following statements using MS430 assembly instructions. You may use more than one, but you should minimize the number of instructions required. You can use both native and emulated instructions. Use hex notation for all numbers 1. (a) Move the word located in register R14 to R15 (b) Increment the word in R6 by 2. (c) Perform a bitwise ANDing of the word located at address 0x0240 with the datum in R15, placing the results in R15. (d) Rotate...

  • Write a program in ARM assembly using ARMSim# to perform the following tasks: 1. Open a...

    Write a program in ARM assembly using ARMSim# to perform the following tasks: 1. Open a file named "integers.dat" and keep track of the following information: a.The first integer value is (i) b. The ith integer value is (j) c. Count the total number of integers in the file d. Count the number of integers that are less than j e. Count how many even numbers are less than j f. And how many odd numbers are less than j...

  • Note: The question needs to be answered in "C Programming Languange ". And after the question fin...

    Note: The question needs to be answered in "C Programming Languange ". And after the question find 3 pages for needed informations. Spring CE4717 Language Processors Q1. Consider the following LEx program. return R1 return R2 return R3 return R4 return R5; return R6; IA-2a-z)[A-Za-z0-9]- -2 10-91+ 10-9a-EA-FI Ihi] [01] [01] 이삐 t Vtin) int main (void) int tcode; do f tcode -yylex()i printf ("token type td \"%s\"\n", tcode, yytext); ) while (tcode)i return 0; i. Explain the steps needed...

  • Group Project 1 The Micro-1 Processor Simulation <Micro-1 Computer> Here's the organization of a computer equipped...

    Group Project 1 The Micro-1 Processor Simulation <Micro-1 Computer> Here's the organization of a computer equipped with a Micro-1 processor Memory contains an array of integer cells: int cell[] = new int[CAP]; where CAP is the capacity of memory. Initially this is set to 256. Internally, the Micro-1 processor is equipped with eight 32-bit data/address registers and two 32 bit control registers: PC, the program counter, contains the address of the next instruction to execute. IR, the instruction register, contains...

  • This C++ Program consists of: operator overloading, as well as experience with managing dynamic memory allocation...

    This C++ Program consists of: operator overloading, as well as experience with managing dynamic memory allocation inside a class. Task One common limitation of programming languages is that the built-in types are limited to smaller finite ranges of storage. For instance, the built-in int type in C++ is 4 bytes in most systems today, allowing for about 4 billion different numbers. The regular int splits this range between positive and negative numbers, but even an unsigned int (assuming 4 bytes)...

  • 1.) a.) Using the simplified instruction set shown for part b, write code for the following....

    1.) a.) Using the simplified instruction set shown for part b, write code for the following. Suppose memory locations 1400 to 1449 contain 16-bit words. Each word represents 2 ASCII characters. Write code to read in and write out these 100 characters. Left-side character from location 1400 should be first, right-side character from location 1400 should be second, and remaining characters follow in numeric order. Assume you have access to 4 registers: R1, R2, R3, R4. Each register holds one...

  • Use program control statements in the following exercises: Question 1 . Write pseudocode for the following:...

    Use program control statements in the following exercises: Question 1 . Write pseudocode for the following: • Input a time in seconds. • Convert this time to hours, minutes, and seconds and print the result as shown in the following example: 2 300 seconds converts to 0 hours, 38 minutes, 20 seconds. Question 2. The voting for a company chairperson is recorded by entering the numbers 1 to 5 at the keyboard, depending on which of the five candidates secured...

  • Java BlackJack Game: Help with 1-4 using the provided code below Source code for Project3.java: import...

    Java BlackJack Game: Help with 1-4 using the provided code below Source code for Project3.java: import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; public class Project3 extends JFrame implements ActionListener { private static int winxpos = 0, winypos = 0; // place window here private JButton exitButton, hitButton, stayButton, dealButton, newGameButton; private CardList theDeck = null; private JPanel northPanel; private MyPanel centerPanel; private static JFrame myFrame = null; private CardList playerHand = new CardList(0); private CardList dealerHand = new CardList(0);...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT