Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Find the output of the following assembly code manually when the input is 15. Use the table below to keep track of each iteration.

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
1. Find the output of the following assembly code manually when the input is 15. Use the table below to keep track of each iteration. INP STO SUB STO ZRSC JMP OUT JMP DONE OUT X YACC Output SEC DONESTP DAT DAT 0 2. Run the code so you can verify that it works according to your expectations. Take a screenshot. 3. Explain briefly what this program does? 4. What happens if the input value was set to 8? Modify the program by inserting an instruction in the appropriate place so that it will work for all input values. Clearly indicate the instruction and its location. Then complete the following table for input value set to 8. Y ACc Output Binary Opcode Description 1111 STP this stops the computer, no more fetch/decode/execute cycles until you reset. 0001 ADD fetch a number from memory and add it to the contents of the accumulator, replacing the value in the accumulator. E.g. 0001000000001111 -get the value at memory location 15 and add that to accumulator 0010 SUB just like ADD, only subtract. 0011 LOD fetch a number from memory and store it into the accumulator, replacing its old value E.g. 0011000000001111 get the value at memory location 15 and store that value into the accumulator. 0100 LDI load immediate; the value (data) to be put into the accumulator is the operand (the rightmost 12 bits of the instruction); do not go to memory like LOD E.g. 0100000000001111 store the accumulator's value into memory at the indicated location. E.g. 0101000000001111store the accumulator's value into memory location 15. 0101 STO 1. Find the output of the following assembly code manually when the input is 15. Use the table below to keep track of each iteration. INP STO SUB STO ZRSC JMP OUT JMP DONE OUT X YACC Output SEC DONESTP DAT DAT 0 2. Run the code so you can verify that it works according to your expectations. Take a screenshot. 3. Explain briefly what this program does? 4. What happens if the input value was set to 8? Modify the program by inserting an instruction in the appropriate place so that it will work for all input values. Clearly indicate the instruction and its location. Then complete the following table for input value set to 8. Y ACc Output Binary Opcode Description 1111 STP this stops the computer, no more fetch/decode/execute cycles until you reset. 0001 ADD fetch a number from memory and add it to the contents of the accumulator, replacing the value in the accumulator. E.g. 0001000000001111 -get the value at memory location 15 and add that to accumulator 0010 SUB just like ADD, only subtract. 0011 LOD fetch a number from memory and store it into the accumulator, replacing its old value E.g. 0011000000001111 get the value at memory location 15 and store that value into the accumulator. 0100 LDI load immediate; the value (data) to be put into the accumulator is the operand (the rightmost 12 bits of the instruction); do not go to memory like LOD E.g. 0100000000001111 store the accumulator's value into memory at the indicated location. E.g. 0101000000001111store the accumulator's value into memory location 15. 0101 STO

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

1. What are the peculiarities of viruses ?

Answered: 1 week ago

Question

Describe the menstrual cycle in a woman.

Answered: 1 week ago

Question

What about leadership lessons from particularly good or bad bosses?

Answered: 1 week ago