Exemple #1
0
def _api_call(sm: VM):
    _b = get_next_byte(sm)
    _args = get_next_byte(sm, 2)
    args = [sm.pop() for _ in range(_args)]
    fun = sm.get_data_at(_b)
    f = FUNCTIONS[fun]
    f(*args)
    [sm.push(i) for i in args]
Exemple #2
0
def _or(sm: VM):
    b, a = sm.pop(), sm.pop()
    sm.push(a | b)
Exemple #3
0
def _xor(sm: VM):
    b, a = sm.pop(), sm.pop()
    sm.push(a ^ b)
Exemple #4
0
def _and(sm: VM):
    b, a = sm.pop(), sm.pop()
    sm.push(a & b)
Exemple #5
0
def _sub(sm: VM):
    b, a = sm.pop(), sm.pop()
    sm.push(a + b)
Exemple #6
0
def _mul(sm: VM):
    b, a = sm.pop(), sm.pop()
    sm.push(a * b)
Exemple #7
0
def _div(sm: VM):
    b, a = sm.pop(), sm.pop()
    sm.push(int(a / b))
Exemple #8
0
def _add(sm: VM):
    b, a = sm.pop(), sm.pop()
    sm.push(a + b)