Day 8
Shifting
Shifting moves the bits in a register a certain amount of bits left or right.
Any bits shifted past the end of the register are lost and zeros are added when new
ones are needed.
The SHL Instruction
SHL stands for SHift Left and... well... draws a 3d fish on the screen whacking
somebody. I hope you didn't believe that! SHL shifts a register left so many bits...
Examples:
shl ax,2 ; will shift AX left 2 bits, effectively multiplying AX by 4
shl dx,cl ; will shift DX left the amount in CL. Note that only CL can
; be used like that.
SHR stands for SHift Right, works exactly like SHL, except it shifts right and
effectively divides by 2 to the power of the number in CL's position...
This Day In Review
Shifts are useful for many things, learn them well!
Have fun!,
- Mike H
Intro - Day 9
Patater GBAGuy Mirror
Contact