KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q39373: FIX: Warning A4057 Generated Instead of Error A2019

Article: Q39373
Product(s): Microsoft Macro Assembler
Version(s): 5.1
Operating System(s): 
Keyword(s): 
Last Modified: 04-MAY-2001

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Macro Assembler (MASM), version 5.1 
-------------------------------------------------------------------------------

SYMPTOMS
========

The code below is correctly flagged as an error in the Microsoft Macro Assembler
(MASM) versions 5.0, 6.0, 6.0a, 6.0b, but MASM 5.1 generates a warning and
incorrect code.

The following is the error generated by MASM 5.0

  A2019: Wrong type of register

Macro Assembler Version 5.1 fails to generate an error on the MOV instruction
using the 8-bit registers (AH, BH, CH, DH, AL, BL, CL, DL) with segment
registers (CS, DS, ES, SS). Instead, the following warning is generated

  A4057: Illegal size for operand

The code generated is also in error. Each of the (8-bit) byte registers maps to
the set (SP, DI, BP, SI, AX, BX, CX, DX).

The following is the error generated by MASM 6.0

  A2024: invalid operand size for instruction

STATUS
======

Microsoft has confirmed this to be a problem in MASM version 5.1. This problem
was corrected in MASM version 6.0.

MORE INFORMATION
================

The following sample code demonstrates the problem:

Sample Code:
------------

  ;Assemble options needed: none

  _TEXT   segment word public 'CODE'
        ; instruction in source     Generated code shown in listing
          mov     ds, ah          ; mov   ds, sp
          mov     ds, bh          ; mov   ds, di
          mov     ds, ch          ; mov   ds, bp
          mov     ds, dh          ; mov   ds, si

          mov     ds, al          ; mov   ds, ax
          mov     ds, bl          ; mov   ds, bx
          mov     ds, cl          ; mov   ds, cx
          mov     ds, dl          ; mov   ds, dx

          mov     ah, 4ch
          int     21h
  _TEXT   ends
          end

Additional query words: 5.10 buglist5.10 fixlist6.00

======================================================================
Keywords          :  
Technology        : kbMASMsearch kbAudDeveloper kbMASM510
Version           : :5.1
Solution Type     : kbfix

=============================================================================

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.