Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def mod_(input0, input1, output):
"""Performs a modulo operation on the first two operands. The
two input operands can be either registers or literals while
the output operand must be a register.
"""
return definitions.Instruction(definitions.MOD, input0, input1, output)
def xor_(input0, input1, output):
"""Binary XOR operation that connects the first two operands and
stores the result in the third operand. The input operands can be
literals and register values. The output operand must be a
register.
"""
return definitions.Instruction(definitions.XOR, input0, input1, output)
def equ_(input0, input1, output):
"""Extended REIL opcode.
Sets a flag depending on whether another two values are equal. The
input operands can be literal or register values. The output
operand is a register.
"""
return definitions.Instruction(definitions.EQU, input0, input1, output)
def lshl_(input0, input1, output):
"""Extended REIL opcode.
Performs a logical left shift on a value. The two input operands can
be either registers or literals while the output operand must be
a register.
"""
return definitions.Instruction(definitions.LSHL, input0, input1, output)
def sex_(input0, output):
"""Extended REIL opcode.
Performs sign extension on a value. This operand behaves identically
to the STR opcode, unless the output operand is of a larger size to
the input operand, in which case the input is sign-extended instead
of zero-extended.
"""
return definitions.Instruction(definitions.SEX, input0, None, output)
def stm_(value, address):
"""Stores a value to memory. The first operand is the register
value or literal to be stored in memory. The third operand is the
register value or literal that contains the memory address where
the value is stored. The size of the first operand determines the
number of bytes to be written to memory.
"""
return definitions.Instruction(definitions.STM, value, None, address)
def jcc_(condition, target):
"""Performs a conditional jump to another location if the first
input operand is not zero. The first input operand can be either
a register or a literal that specifies the condition. The third
operand specifies the target address of the jump. It can be
either a register, a literal, or a REIL offset.
"""
return definitions.Instruction(definitions.JCC, condition, None, target)
def and_(input0, input1, output):
"""Binary AND operation that connects the first two operands and
stores the result in the third operand. The input operands can be
literals and register values. The output operand must be a register.
"""
return definitions.Instruction(definitions.AND, input0, input1, output)
def ashr_(input0, input1, output):
"""Extended REIL opcode.
Performs an arithmetical right shift on a value. The two input
operands can be either registers or literals while the output operand
must be a register.
"""
return definitions.Instruction(definitions.ASHR, input0, input1, output)
def bsh_(input0, input1, output):
"""Performs a logical shift on a value. If the second operand is
positive, the shift is a left-shift. If the second operand is
negative, the shift is a right-shift. The two input operands can
be either registers or literals while the output operand must be
a register.
"""
return definitions.Instruction(definitions.BSH, input0, input1, output)