I'm trying to make a simple x86 program that reverses a string, in this case: "ciao".
section .data
msg db "ciao"
len equ $ - msg
section .text
global _start
_start:
lea eax, [msg]
mov ebx, len
add eax, ebx-1
reverseloop:
push [eax]
sub eax, 1
cmp eax, [msg]
jl reverseloop
When I try to assemble it, I get the error:
main.asm:14: error: operation size not specified
So, I tried to specify the size, by modifying line 14 to:
push byte [eax]
And now I get the error:
main.asm:14: error: invalid combination of opcode and operands
I don't really understand what is the problem here.
The command I use to compile is:
nasm -f elf32 main.asm -o main.o