Q49707: Shifting (SHL) Using an 8-Bit Constant
Article: Q49707
Product(s): See article
Version(s): 5.10 | 5.10
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | | mspl13_masm
Last Modified: 29-MAR-1990
Problem:
Page 96 of the "Microsoft Macro Assembler for MS OS/2 and MS-DOS
Operating Systems: Version 5.1 Update" says that I can use the
shift-left instruction (SHL) with an 8-bit constant. Yet, when I
assemble my source code, I get the following error:
A2052: Improper operand type
Response:
The third paragraph on Page 96 states the following:
On the 8088 and 8086, the source operand can be either CL or 1. On
the 80186-80386 processors, the source operand can be CL or an
8-bit constant.
To use the 8-bit constant, you must specify that you are writing 186,
286, or 386 code. The assembler assumes the worst and defaults to the
8088 options and doesn't accept the 8-bit constant.
The following code generates the error:
.model small
.code
shl bl,2
end
To correct the problem, use the .186, .286, or .386 directive such as
the following:
.model small
.286
.code
shl bl,2
end
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
Copyright Microsoft Corporation 1986-2002.