Exception thrown: Access violation reading location

0

I am using a sample code from an old book but the code is written as inline assembly! I created a new console app project. added MASM dependancy and the file type is Microsoft Macro Assembler.

I keep getting this error whether it's targeted for 32 or 64!

=>MOVAPS XMM0, [esi]
Exception thrown at 0x00D4101C in Project3.exe: 0xC0000005: Access violation reading location 0xFFFFFFFF
Exception thrown at 0x00000000004F101C in Project3.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

asmcode.asm

.model flat,c
.const
 .data
A     dd 0.1,0.2,0.3,0.4 
B     dd 1,2,3,4


 .code
main PROC
        MOV esi, A
        MOV edi, B
        MOVAPS XMM0, [esi]
        MOVUPS XMM1, [edi]
        ADDPS XMM0, XMM1
        MOVAPS XMM1, XMM0
        MOVAPS[esi], XMM0
        MOVUPS[edi], XMM1
        
main endp
 end 

Any idea why it's not working? When I try to get the address of A and B instead of the address of the registers esi and edi, it works

so this works

MOVAPS XMM0, [A]
MOVUPS XMM1, [B]

FYI The code works with the registers in inline assembly

visual-studio
assembly
masm
sse
asked on Stack Overflow Feb 11, 2021 by ma1169 • edited Feb 11, 2021 by Peter Cordes

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0