Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SAL instruction in MASM 1

Status
Not open for further replies.

pirigyi

Technical User
Apr 26, 2001
11
US
I'm new to programming and I'm stumped w/ this question...

Assume that the AX register contains the Decimal value 16. Use of the SAL instruction will change the value of the data in the given register by how much for EACH SHIFT LEFT operation?

What is the MINIMUM number of executions of the SAL instruction that will cause the contents of the AX register to be 0(zero)?

Any help would be appreciated!

Thanks a million!
 
I haven't done this in while, so I'm relying on memory.
Each SAL operation would shift the entire contents left by 1 bit, essentially doubling the current value until the first ON bit falls off the left side. For example:

0000 0000 0001 0000 (dec 16)

1st SAL leaves

0000 0000 0010 0000 (dec 32)

To determine the number of operations needed to revert to 0, count the number of bits to the left of the right-most ON bit and add 1. Jay
 
Thanks bro, greatly appreciated.

mike
 
SAL (Shift Arithmetic Left) and SAR (Shift Arithmetic Right) are basically the same as SHL (SHift Left) and SHR (SHift Right) but SAL/SAR leaves the sign bit untouched whereas SHL/SHR shift all the bits. Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
Don't worry what people think about you. They're too busy wondering what you think about them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top