예제 #1
0
 def operate(self, current_address, callback):
     if self.condition.value == 0:
         message = Message(action=Action.jump,
                           args=[self.destination.value])
     else:
         message = Message(action=Action.no_op, args=[])
     if conditional_logs and condition(current_address):
         print('**')
         print(f'current address: {current_address}')
         print(message.action)
         print(message.args)
         print('**')
         print()
     return callback(message)
예제 #2
0
 def operate(self, current_address, callback):
     message = Message(action=Action.push_stack, args=[self.token_value])
     if conditional_logs and condition(current_address):
         print('**')
         print(f'current address: {current_address}')
         print(message.action)
         print(message.args)
         print('**')
         print()
     return callback(message)
예제 #3
0
 def operate(self, current_address, callback):
     message = Message(action=Action.no_op, args=[])
     if conditional_logs and condition(current_address):
         print('**')
         print(f'current address: {current_address}')
         print(message.action)
         print(message.args)
         print('**')
         print()
     return callback(message)
예제 #4
0
 def operate(self, current_address, callback):
     print(f'current address: {current_address}')
     message = Message(action=Action.update_display, args=[self.ascii_code])
     if conditional_logs and condition(current_address):
         print('**')
         print(f'current address: {current_address}')
         print(message.action)
         print(message.args)
         print('**')
         print()
     return callback(message)
예제 #5
0
 def operate(self, current_address, callback):
     message = Message(action=Action.write_memory,
                       args=[self.target_address, self.source_token])
     if conditional_logs and condition(current_address):
         print('**')
         print(f'current address: {current_address}')
         print(message.action)
         print(message.args)
         print('**')
         print()
     return callback(message)
예제 #6
0
 def operate(self, current_address, callback):
     new_value = (self.left.value | self.right.value)
     message = Message(action=Action.update_register,
                       args=[self.address, new_value])
     if conditional_logs and condition(current_address):
         print('**')
         print(f'current address: {current_address}')
         print(message.action)
         print(message.args)
         print('**')
         print()
     return callback(message)
예제 #7
0
 def operate(self, current_address, callback):
     user_input = input('type stuff: ')
     self.write_location.value = user_input
     message = Message(action=Action.update_register,
                       args=[self.write_location])
     if conditional_logs and condition(current_address):
         print('**')
         print(f'current address: {current_address}')
         print(message.action)
         print(message.args)
         print('**')
         print()
     return callback(message)
예제 #8
0
    def operate(self, current_address, callback):
        def bit_not(n, numbits=15):
            return (1 << numbits) - 1 - n

        new_value = bit_not(self.original.value)
        message = Message(action=Action.update_register,
                          args=[self.address, new_value])
        if conditional_logs and condition(current_address):
            print('**')
            print(f'current address: {current_address}')
            print(message.action)
            print(message.args)
            print('**')
            print()
        return callback(message)