SASANQUA
SASANQUA

Reputation: 75

Access violation when using two consecutive mov instructions

I am new to assembly language so i was trying to learn the mov instruction using MASM in Visual Studio. Access violation error occured when i tried to use two consecutive mov instructions that load a constant into the register.

.model small

.code

main proc
    mov ax, 38
    mov ax, 38 ; Error occured when executing this instruction
    mov ax, 100h
main endp

end main

I tried to search for solutions but nothing found so i am wondering: Is it even valid to use two consecutive mov instructions to load the same register with the same value (different value doesn't work either) ?

Upvotes: 0

Views: 166

Answers (1)

SASANQUA
SASANQUA

Reputation: 75

Thanks to @Michael the problem is resolved now. I changed .model small to .model flat for 32-bit.

Upvotes: 2

Related Questions