Question
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
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