Printf & Scanf in assembly languange x86 using notepad++ and ollydebugger -
can explain me how scanf , printf works in assembly? enter 1 number , when try print number again random character. here's code:
.data msg1 db "n=",0 msg2 db "n is:",0 n dd 0 formatd db "%d",0 .code start: push offset msg1 ; put msg1 on stack call printf ; print msg1 add esp,8 ; clear stack push offset n ; put n on stack push offset formatd ; put n format on stack call scanf ; write n value add esp,12 ; clear stack mov ebx,n ; copy n in ebx push offset msg2 ; put msg2 on stack call printf ; print msg2 push ebx ; put n on stack push offset formatd ; put n format on stack call printf ; print n value add esp,20 ; clear stack push 0 call exit end start
Comments
Post a Comment