Pergunta

So, I'm trying to add variables, but it doesn't want to work. I have a really simple program.

program tested;

var
    i: int8;
    x: int8;


begin tested;
    mov(10, i);
    mov(5, x);
    add(i, x);
    stdout.put(x);

end tested;

I get the following error: "Error in file 'tested.hla' at line 11 [errid:129712/hlaparse.c]: syntax error, unexpected ')', expecting '('. Near: << ) >>"

Mov is supposed to move the number into the variable..and add is supposed to add two things. Why isn't it working?

I don't really understand hla so any help would be most appreciated.

Foi útil?

Solução 2

Note that 5 and 10 are "constants" and you cannot change the values of 5 or 10. Remember mov(dest, source); for example: mov(x,i); copy the value of i and put it in the address of x

Outras dicas

add( source, destination );

In case you weren't privy, both destination and source operands cannot be memory locations. That's why it's not working.

Source can be register, constant, or memory
Destination can be register or memory
Both cannot be memory
Both must be the same size

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top