# Instructions Instructions are the base of all [casio_asm][main] programs. They are what instructs the [processor][proc] to act. Instructions can be represented in their [assembler][asm_file] form or in their [bytecode][bin_file] form. Instructions are described in detail in `opcode.list` and implemented in `executerImp.c`. ## Instruction execution An instruction may take one or two arguments from registers, an immediate argument or none at all. All required arguments that are not explicitly supplied are popped from the stack. ## Instruction families There are several instruction families for different purposes. Here are some examples: ### Arithmetic instructions These instructions end in `_i` or `_d` and represent a basic arithmetic operation, like an addition. They take one or two arguments. Examples include `add_i`, `div_d` and `mod_i`. ### bitwise instructions These instructions represent bitwise operations, like a bitshift or an exclusive or. They take one or two arguments. Examples include `shlt`, `xor` and `not`. ### Logic instructions These instructions end in `_l` and represent logic operations, like negation. They take one or two arguments. Examples include `and_l`, `not_l` and `xor_l`. ### Comparison instructions These instructions end in `_i` or `_d` and represent arithmetic comparison. They take two arguments. Examples include `eq_i`, `ge_d` and `neq_i`. ### Stack control instructions These instructions are used to control the stack. Examples include `push`, `swap` and `top`. ### Flow control instructions These instructions are used to jump conditionally or unconditionally to other points in the program. Their first argument is the jump address. Examples include `call`, `jmp` and `jif`. ### Register control instructions These instructions are used to manage data contained in registers. They are the only ones (except `puind`) to alter their content. Examples include `store`, `swregi` and `puind`. ### Processor control instructions These instructions alter the status of the processor, be it the status register, interrupts or idle state. The `ext` instruction is used to call external functions. Examples include `stat_s`, `halt` and `inth`. ### Memory manipulation These instructions allow for direct access to the managed RAM. Write instructions take two arguments and read instructions take a single argument. Examples include `mem_wr`, `lastad` and `mem_bw`. ### Value managment instructions These instructions are used to convert from one data type to another. They take one argument. Examples include `i2d` and `d2i`. [main]: ./main.md [proc]: ./proc.md [asm_file]: ./asm_file.md [bin_file]: ./bin_file.md