Pregunta

I'm trying to handtune a piece of code(a function originally writen in C++) and the assembler throws this error: error A2022:instruction operands must be the same size

at the lines that use the 'movq' instruction.

The code:

.686P       
.mmx          
.xmm           
.MODEL flat, stdcall
.STACK 4096

.data
packedbytes db 10, 20, -30, 40, 50, 60, -70, 80
packedwords dw 10, 20, 30, 40
packeddwords dd 10, 20

.code
main PROC 

    movq mm0, packedbytes   ; <== error thrown here
    movq mm1, packedwords   ; <== here
    movq mm2, packeddwords  ; <== and here

    mov a0, 04d
    mov al, 0d  
    int 21h     
main ENDP
END main

I'm using masm on a 32 bit box.

¿Fue útil?

Solución

I've figured it out. You can't use the registers directly; you can only place data via a pointer(at least with masm).

    mov edx, offset packedbytes
    movq mm0, [edx] 
    mov edx, offset packedwords
    movq mm1, [edx]
    mov edx, offset packeddwords   
    movq mm2, [edx] 

This should do the trick.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top