SRP Debugger SRP Debugger

Navigation

Home

User Guide
Hotkeys
Command Line

ASM Commands
  Arithmetic and Logical
  Program Control
  I/O Operations
  Manipulating Memory

About

Command Overview

Arithmetic and Logical Commands


add  x, y, z

  Command performs an additon. x := y + z
  x, 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, z

  Command performs a subtraction. x := y - z
  x, 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, z

  Command performs a multiplication. x := y * z
  x, 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, z

  Command performs a division. x := y / z
  x, 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, z

  Command performs a modulo operation. x := y % z
  x, 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, z

  Command performs a bitwise and operation. x := y & z
  x, 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, z

  Command performs a bitwise or operation. x := y | z
  x, y, z are arbitrary registers out of the set {R0, R1, ..., R31}
  Example: or R7, R2, R3 evaluates to: R7 := R2 | R3


not  x, y

  Command performs a bitwise not operation. x := ~ y
  x, y are arbitrary registers out of the set {R0, R1, ..., R31}
  Example: not R7, R2 evaluates to: R7 := ~R2


const  x, c

  Command stores a constant value c into a register x.   x := c
  x 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, sc

  Command performs a left shift operation by sc bits. x := y << sc
  x, 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, c

  Command increments the value stored in register x by the constant c. x += c
  x is an arbitrary register out of the set {R0, R1, ..., R31}
  c is any natural number < 2^22
  Example:  incr R0, 11


decr  x, c

  Command decrements the value stored in register x by the constant c. x -= c
  x is an arbitrary register out of the set {R0, R1, ..., R31}
  c is any natural number < 2^22
  Example:  decr R0, 11


Program Control


goto  x

  Command performs an unconditional jump to x. PC := x
  x 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,  z

  Command 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,  z

  Command 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


halt

  Command stops processor.


nop

  Command does not perform any action. PC := PC + 1


I/O Operations


in  x

  Command 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  x

  Command 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 Memory


load  x, y

  Command 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, y

  Command writes value into memory. mem[y] := x
  x , y are arbitrary registers out of the set {R0, R1, ..., R31}
  Example:  store R11, R1


data  b0, b1, b2, b3

  Command 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