i need some help regarding the CMOVxx instructions. the sample below should work in my opinion, but upon compilation i get an error:
"invalid instruction operands (A2070)" --> the CMOVNZ.

ML.EXE has version 6.15.8803
LINK.EXE has version 5.12.8078

i compile the program using "project/assemble & link" in the qeditor menu.
can it be that these files are outdated and do not support the CMOVxx instructions? if they do, what's wrong?
do i have to compile the program manually (i.e. typing the commands myself)?

i have a pentium III. as far as i know this one supports the mentioned instructions.

.model flat, stdcall
option casemap: none

CheckDriveC proto :DWORD

include \masm32\include\windows.inc

include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib

yes db "YES", 0
no db "NO", 0

invoke GetLogicalDrives ; get drives
invoke CheckDriveC, eax ; check if drive C: is available
.if (eax == 0)
invoke MessageBox, 0, addr no, NULL, 48
invoke MessageBox, 0, addr yes, NULL, 64
invoke ExitProcess, 0

CheckDriveC proc uses ebx esi edi ebp DriveList: DWORD
mov eax, DriveList
and eax, 4 ; if bit #2 is set -> C is available
cmovnz eax, 1
CheckDriveC endp
end main
Posted on 2002-11-06 12:51:31 by ploptor
It always helps to consult documentation:

From the intel developers manual:

0F 45 /r CMOVNZ r16, r/m16 Move if not zero (ZF=0)
0F 45 /r CMOVNZ r32, r/m32 Move if not zero (ZF=0)

CMOVcc doesn't support imediate operands

Intead try:

mov eax,DriveList
and eax,4
shr eax,2
Posted on 2002-11-06 23:10:15 by huh