Access Write Violation When Accessing the Value of a Register in assembly x86 -
compare proto, p1:dword, p2:dword .code compare proc p1:dword, p2:dword mov eax, p1 mov edx, p2 mov eax, [eax] ;getting access violation here mov edx, [edx] ; 1 here too, why? sub eax, edx ret compare endp main proc local thesize:dword mov thesize, 3 mov fill, 5 invoke compare, thesize, thesize ret main endp
hey guys, curious why code isn't working? what's alternative way make work, i'm playing around registers , trying similar code when filling array, got stuck @ point.
thanks in advance!
not sure doing, since looks want dereference mem address, must use addr
local vars get/pass address.
main proc local thesize:dword mov thesize, 3 ; invoke compare, thesize, thesize ; same as: ; push 3 ; push 3 ; call compare ; want: invoke compare, addr thesize, addr thesize ; same as: ; lea eax, thesize ; push eax ; push eax ; call compare ret main endp
Comments
Post a Comment