Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an assembly code to right shift a given number by 4 bits for positive 2s complement number. Right shift by 4 bits on a

Write an assembly code to right shift a given number by 4 bits for positive 2s complement number. Right shift by 4 bits on a binary string (say 00110011), will shift bits to right, appending 0 to the left at every shift(00000011). The program should take in a 16-bit positive value at memory location Loc1. Store the 16-bit result in Loc2. You can declare the memory locations Loc1 and Loc2 using .BLKW directive. For example, if [Loc1]=0x00A0 then after execution of the program [Loc2] = 0x000A. Your code should start at memory location 0x3000

(Hint: Right shift operation can be obtained if you divide the number by 2. This implementation is to be done only for positive numbers. You can create a subroutine DivideBy2 and call it 4 times to shift by 4 bits. You can come up with other methods as well but make sure to use subroutines.)

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

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions

Question

3. What might you have done differently

Answered: 1 week ago