shift right and shift left assembly language

1k views Asked by At

If I want to say for example bx is a number:

shl bx,1
shr bx,1

What will be the new bx value? Does it stay the same?

1

There are 1 answers

3
Brendan On

What will be the new bx value? Does it stay the same?

No (or not necessarily). The shl bx,1 will get rid of the highest bit, and the shr bx,1 won't bring the old highest bit back. This means that a value like 0x8123 will become 0x0123.

Mostly, it'd be almost the same as using and bx,0x7FFF to clear the highest bit (except for the carry flag).