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
有帮助吗?

解决方案

.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.

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top