Question
Write an assembly language program that circularly shifts rightward a value in memory a certain number of times . The number of times to shift
Write an assembly language program that circularly shifts rightward a value in memory a certain number of times. The number of times to shift should also be stored in memory.
Example: Suppose one memory location holds the value (0101100101110110)2 and another holds the number of times to shift (5). Then, at the end of the program, the value stored in memory should be (1011001011001011)2. You will need to convert the number of times to shift (5) to a negative number (-5) so that you can run a loop 5 times (loop stops on zero). If instead 3 times, convert to -3, etc.
Requirements:
- Organize your program into 3 columns as per the book/online lecture: labels, instructions, comments. For example:
ORG 2A | /Program starts at address 2A | |
LDA X1 | /Load X1 to AC | |
ADD X2 I | /Add value at address in X2 to AC | |
STA X3 | /Store sum at X3 | |
X1, | DEC 100 | /First value to add |
X2, | HEX 2F | /Location of 2nd value to add |
X3, | DEC -1 | /Second value to add, result |
END | /End of program |
- Use labels for any data in memory or locations used for branching.
- Add a descriptive comment (/) to the right of each instruction.
- Write a complete program with ORG and END pseudoinstructions as well as a HLT.
- Symbol table: Include the address symbol table (example: p. 183 in text, also in Programming Online Lecture) that would be produced by a first pass of the assembler through your program. Recall the symbol table maps labels to addresses–ORG is highly relevant.
- Format: Submit the program and symbol table in a single Word (.docx) [also exportable from Google Docs], PDF, or plain text file. The 3 program columns should line up (you may wish to use a word-processor table feature).
- Bonus: Write a subroutine in the program that somehow helps accomplish the task.
Upload a single document containing your entire program. Note that since you cannot run the program, you must be able to trace each step to verify it works.
Step by Step Solution
3.32 Rating (158 Votes )
There are 3 Steps involved in it
Step: 1
Also implemented a simulation in Morris mano computer and it is working ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started