Question: Shifting bits around in assembly is another interesting concept! x 8 6 allows you to 'shift' bits around in a register. Take, for instance, al
Shifting bits around in assembly is another interesting concept!
x allows you to 'shift' bits around in a register.
Take, for instance, al the lowest bits of rax.
The value in al in bits is:
rax
If we shift once to the left using the shl instruction:
shl al
The new value is:
al
Everything shifted to the left and the highest bit fell off
while a new was added to the right side.
You can use this to do special things to the bits you care about.
Shifting has the nice side affect of doing quick multiplication by
or division by and can also be used to compute modulo.
Here are the important instructions:
shl reg reg Shift reg left by the amount in reg
shr reg reg Shift reg right by the amount in reg
Note: 'reg can be replaced by a constant or memory location
Using only the following instructions:
mov, shr shl
Please perform the following:
Set rax to the th least significant byte of rdi.
For example:
rdi B B B B B B B B
Set rax to the value of B
We will now set the following in preparation for your code:
rdi xeedcad
Please give me your assembly in bytes up to x bytes:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
