ID Number: Q72708
6.00 | 6.00
MS-DOS | OS/2
buglist6.00
Summary:
The Microsoft Macro Assembler (MASM) version 6.0 will generate
incorrect code when the IMUL instruction contains an operand that is a
constant value from 128 to 255. No errors or warnings are displayed
while assembling.
More Information:
The sample code below demonstrates this problem. The assembler
incorrectly treats the constant as an 8-bit signed value rather than a
signed word. In converting from a signed byte to a signed word, it
extends the sign bit through the upper byte. Thus, 255 (0ffh) becomes
-1 (0ffffh). In the program below, the result of the IMUL instruction
is -1.
To work around this problem, qualify the constant as a word. For
example:
IMUL di,WORD PTR 255 ; This works.
Microsoft has confirmed this to be a problem in MASM version 6.0. We
are researching this problem and will post new information here as it
becomes available.
Sample Code
-----------
; Assemble Options: none
.286
.model small
.code
main proc
mov di, 1
imul di, 255
; imul di, WORD PTR 255 ; <--- This works.
mov ax, 4c00h
int 21h
main endp
end main