linux - Assembly printing a simple counter -
im new in assembly 8086 , im trying implement calculator in assembly.
i required count number of operation received user, , print @ end. every time tried print variable value prints : 134520956 instead of 1. ( checked gdb, wrote: mov eax [operator_count] , value of eax 1 required)
this code:
section .rodata int_format: db "%d", 10, 0 section .bss operator_count: resb 10 main: mov [operator_count], dword 0 ; rest not relevant....... inc dword [operator_count] push operator_count ;push string stuck push int_format call printf add esp, 4 ;remove pushed argument ;exit normaly thanks help...
edit: works :)
inc dword [operator_count] push dword [operator_count] ;push string stuck push int_format call printf add esp, 8 ;remove pushed argument
push operator_count pushes address, not value. try push dword [operator_count] instead. – jester
Comments
Post a Comment