![]() |
![]() |
NavigationHomeUser Guide Hotkeys Command Line ASM Commands Arithmetic and Logical Program Control I/O Operations Manipulating Memory About |
Command OverviewArithmetic and Logical Commandsadd x, y, zCommand performs an additon. x := y + zx, y, z are arbitrary registers out of the set {R0, R1, ..., R31} Example: add R7, R2, R3 evaluates to: R7 := R2 + R3 sub x, y, zCommand performs a subtraction. x := y - zx, y, z are arbitrary registers out of the set {R0, R1, ..., R31} Example: sub R7, R2, R3 evaluates to: R7 := R2 - R3 mul x, y, zCommand performs a multiplication. x := y * zx, y, z are arbitrary registers out of the set {R0, R1, ..., R31} Example: mul R7, R2, R3 evaluates to: R7 := R2 * R3 div x, y, zCommand performs a division. x := y / zx, y, z are arbitrary registers out of the set {R0, R1, ..., R31} Example: div R7, R2, R3 evaluates to: R7 := R2 / R3 mod x, y, zCommand performs a modulo operation. x := y % zx, y, z are arbitrary registers out of the set {R0, R1, ..., R31} Example: mod R7, R2, R3 evaluates to: R7 := R2 % R3 and x, y, zCommand performs a bitwise and operation. x := y & zx, y, z are arbitrary registers out of the set {R0, R1, ..., R31} Example: and R7, R2, R3 evaluates to: R7 := R2 & R3 or x, y, zCommand performs a bitwise or operation. x := y | zx, y, z are arbitrary registers out of the set {R0, R1, ..., R31} Example: or R7, R2, R3 evaluates to: R7 := R2 | R3 not x, yCommand performs a bitwise not operation. x := ~ yx, y are arbitrary registers out of the set {R0, R1, ..., R31} Example: not R7, R2 evaluates to: R7 := ~R2 const x, cCommand stores a constant value c into a register x. x := cx is an arbitrary register out of the set {R0, R1, ..., R31} c is any natural number < 2^22 Example: const R7, 11 evaluates to: R7 := 11 sll x, y, scCommand performs a left shift operation by sc bits. x := y << scx, y are arbitrary registers out of the set {R0, R1, ..., R31} sc is an arbitrary number out of the set < {0, 1, ..., 31} Example: sll R7, R2, 11 evaluates to: R7 := R2 << 11 incr x, cCommand increments the value stored in register x by the constant c. x += cx is an arbitrary register out of the set {R0, R1, ..., R31} c is any natural number < 2^22 Example: incr R0, 11 decr x, cCommand decrements the value stored in register x by the constant c. x -= cx is an arbitrary register out of the set {R0, R1, ..., R31} c is any natural number < 2^22 Example: decr R0, 11 Program Controlgoto xCommand performs an unconditional jump to x. PC := xx is either a label or an arbitrary register ( in register mode ) out of the set {R0, R1, ..., R31} Example: goto loop1 Example: goto R31 ifeq x, y, zCommand performs a conditional jump. PC := ( y == z ? x : PC +1 )x is either a label or an arbitrary register (in register mode) out of the set {R0, R1, ..., R31} y, z are arbitrary registers out of the set {R0, R1, ..., R31} Example: ifeq loop1, R1, R0 evaluates to if (R1 == R0) goto loop1 Example: ifeq R2, R1, R0 evaluates to if (R1 == R0) goto R2 iflt x, y, zCommand performs a conditional jump. PC := ( y < z ? x : PC +1 )x is either a label or an arbitrary register (in register mode) out of the set {R0, R1, ..., R31} y, z are arbitrary registers out of the set {R0, R1, ..., R31} Example: iflt loop1, R1, R0 evaluates to if (R1 < R0) goto loop1 Example: iflt R2, R1, R0 evaluates to if (R1 < R0) goto R2 haltCommand stops processor.nopCommand does not perform any action. PC := PC + 1I/O Operationsin xCommand reads an 8 bit character from the command line into register x. x := getchar()x is an arbitrary register out of the set {R0, R1, ..., R31} Example: in R0 Hint: When the program encounters an in command the command interface will function as the input device. Whenever it turns blue, the program awaits a user input. out xCommand prints the first 8 bits in register x on the output field. putchar(x)x is an arbitrary register out of the set {R0, R1, ..., R31} Example: out R0 Manipulating the Memoryload x, yCommand reads value from memory. x := mem[y]x , y are arbitrary registers out of the set {R0, R1, ..., R31} Example: load R11, R1 store x, yCommand writes value into memory. mem[y] := xx , y are arbitrary registers out of the set {R0, R1, ..., R31} Example: store R11, R1 data b0, b1, b2, b3Command writes the 32 bit value at the current position into the binary file.b3 * 2^24 + b2 * 2^16 + b1 * 2^8 + b0 b0, b1, b2, b3 are 8 bit values each, with a distinct weighting. Example: data 0, 0, 0, 0 |