So I'm trying to implement the strlength function in x86 assembly. I've got most of it down, but I can't figure out how to print the integer value to the console. I'm using the sys_write call and all that I'm getting is a weird symbol for output or nothing at all. Can anyone tell me how I can accurately print out my counter in ECX to the console?
section .text
global _start
_start:
getInput:
mov eax, 3
mov ebx, 0
mov ecx, msg
mov edx, 50
int 0x80
mov eax, msg
xor ecx, ecx
jmp compare
counter:
add eax, 1
add ecx, 1
compare:
cmp [eax], byte 0
jnz counter
dec ecx
mov [len], ecx
printInput:
mov eax, 4
mov ebx, 1
mov ecx, len
mov edx, 50
int 0x80
mov eax, 1
mov ebx, 0
int 0x80
section .bss
msg resb 50
len resb 5