1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
enum OP { // defined operations
NOP // No operation
, MOV // MOV rs, rt: Move source register to target register.
, LD // LD val, rt: Load value to target register
, LDR // LDR mem, rt: Load value of memory address to target register.
, LDM // LDM rs, mem: Save target register to memory address.
, ADD // ADD rs, rt: Add source register to target register.
, SUB // SUB rs, rt: Subtract source register from target register.
, MUL // MUL rs, rt: Multiply source register to target register.
, DIV // DIV rs, rt: Divide target register by source register.
, MOD // MOD rs, rt: Divide target register modulo by source register.
, INC // INC rt
, DEC // DEC rt
, AND // AND rs, rt: rt &= rs
, OR // OR rs, rt: rt |= rs
, XOR // XOR rs, rt: rt ^= rs
, NOT
, ROR // ROR rs, rt: Right rotation of rt by value of rs.
, ROL // ROL rs, rt: Left rotation of rt by value of rs.
, SR // SR rs, rt: Right shift of rt by value of rs.
, SL // SL ls, rt, Left shift of rt by value of rs
, JMP // JMP mem: Loads ip with value of memory address.
, JZ // JZ mem: Loads ip with value of memory address if zero flag == 0
, JNZ // JNZ mem: Loads ip with value of memory address if zero flag == 1
, CMP // CMP rx, ry: If rx == ry, the cmp-flag == 1.
, GT // GT rx, ry: If rx is greater than ry, cmp-flag == 1.
, LT // LT rx, ry: If rx is greater than ry, cmp-flag == 1.
, POP // POP rs: // Remove stack value and store into register.
, PUSH // PUSH rt: // Add register value to stack.
, PEEK // PEEK rt: // Load stack value into register.
};
| |