I want to make simple program that read input from STDIN and then format it in loop and show changed input using stdout. But I get three errors:
Error: junk `message($counter)' after expression
Error: suffix or operands invalid for `add'
Error: suffix or operands invalid for `cmp'
From what I understand from documentation, operands are good for cmp and add, but I'm not 100% sure. I searched internet for some examples and everyone use register as counter. Do I have to use register as counter? I think that probably not, because of ABI convention, but I have no other idea
SYSEXIT = 1
SYSCALL32 = 0x80
SYSEXIT_SUCCESS = 0
SYSWRITE = 4
STDOUT = 1
SYSREAD = 3
STDIN = 0
message_size = 100
.global _start
.data
message: .space message_size
communicate: .ascii "Podaj slowo:"
communicate_size = . - communicate
counter: .long $0
.text
_start:
mov $SYSWRITE, %eax
mov $STDOUT, %ebx
mov $communicate, %ecx
mov $communicate_size, %edx
int $SYSCALL32
mov $SYSREAD, %eax
mov $STDIN, %ebx
mov $message, %ecx
mov $message_size, %edx
int $SYSCALL32
cipher:
addl $13 message($counter)
incb counter
cmp $counter %eax
ja cipher
mov $SYSWRITE, %eax
mov $STDOUT, %ebx
mov $message, %ecx
mov $message_size, %edx
int $SYSCALL32
mov $SYSEXIT, %eax
mov $SYSEXIT_SUCCESS, %ebx
int $SYSCALL32