Question

when I try to compile movd instruction it is showing error as

error A2085:instruction or register not accepted in current CPU mode

My code is as follows:

.386                
.model flat, c                                           
.code

add_func_asm PROC                                                 
movd     eax, ebx
ret    
add_func_asm endp

END

this is .asm file and I called this function from a C file

I fixed it by using below code

.586    
.mmx            
.model flat, c                                           
.code                          
add_func_asm PROC                                                 
movd     mm1, ebx
ret    
add_func_asm endp

END
Was it helpful?

Solution

.386

That cannot work, the 386 processor didn't have this instruction. You have to target .586 (Pentium and up) and explicitly state that you want to use the MMX instruction set. Fix:

.586
.mmx

That will get the assembler to accept the MOVD instruction. Next thing you'll have to do is fix the operands. Moving from ebx to eax is not valid, and pointless, you'll have to specify an MMx register.

OTHER TIPS

MOVD and MOVQ are MMX instructions, so you need to use a .MMX (or .XMM) directive to enable the instruction set.

Try mov eax, ebx instead for moving 32 bits.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top