Hello!
This is C Program in NASM.
I can access "myNumber", read value, but, when i try to change it,
then crash.
I tried many ways, but no way, so far,
there you can see some debug information.
Does anybody has any clue,
what's wrong here and
what changes needs to be made, to make it work?
[bits 32]
[SEGMENT .DATA USE32]
global _myNumber
_myNumber dd 2132
txtFormat: db "Value: %d",0
[SEGMENT .TEXT USE32]
[GLOBAL _main]
[EXTERN _printf]
_main:
push ebp
mov ebp,esp
; Print Address
mov eax,dword _myNumber
push eax
push dword txtFormat
call _printf
add esp,8
; Output -> Value: 4202496
; Print address value
mov eax,dword [_myNumber]
push eax
push dword txtFormat
call _printf
add esp,8
; Output -> Value: 2132
;Try change
mov eax, _myNumber
mov [eax],dword 1111
; Window Event Viewer:
; Faulting application problem1.exe, version 0.0.0.0,
; faulting module problem1.exe, version 0.0.0.0,
; fault address 0x0000302e.
mov esp,ebp
pop ebp
mov eax,0
ret
nasm.exe -f win32 -o program1.o program1.asm
gcc -m32 -o program1.exe program1.o
Thanks, Encryptor256!