Skip to content

Variables

timofey edited this page Dec 11, 2021 · 4 revisions

Variables

CPU registers: REG0, REG1, REG2, REG3, REG4, REG5, COUNTER, INP/OUT

you can copy from register to register

You can`t copy register value to itself!

COPY REG0 REG1 copies from reg0 to reg1

COPY 28 REG1 copies 28 to reg1

COPY INP REG1 copies from input to reg1

COPY OUT REG1 copies from input to reg1, because input and output the same thing

Also you can copy values as bytes

COPY b1 REG1 copies 00000001 to reg1 COPY b101 REG1 copies 00000101 to reg1 COPY b11 REG1 copies 00000011 to reg1


constants

Make constant is very easy

CONS VAR 9 where VAR is name of constant and 9 is constant value

CONS VAR 9
ADDI VAR INP REG0

adds to reg0 var(9) + input

constants are not variables! the compiler does not store constants as separate variables, but replaces their call with the value of the constant

Clone this wiki locally