A few days ago I started learning assembly (32bit) and I have a question. I want to create a program which counting 'x' (only small letter) in text and shows it on the screen (this case -> 4). I wrote that but i am stuck. What have i to do in 'counting'?
Run
gcc -m32 program.s
./a.out
Output
4
My Code
.intel_syntax noprefix
.text
.global main
main:
mov eax, offset messg
push eax
call counting
add esp , 4
//print result
push eax
mov eax, offset printf_arg1
push eax
call printf
add esp, 8
exit:
//return from code
mov eax, 0
ret
counting:
// HERE
.data
messg:
.asciz "x Exemple XText x"
printf_arg1:
.asciz "%i"