def _cond_jp(processor, memory, pc, flag, jump_value): address, pc = fetch_word(memory, pc) if processor.condition(flag) == jump_value: processor.special_registers['pc'] = address return 10, True, pc else: return 10, False, pc
def execute(self, processor, memory, pc): address, pc = fetch_word(memory, pc) if not self.processor.condition('c'): call_to(self.processor, 3, address) return 5, True, pc else: return 3, False, pc
def execute(self, processor, memory, pc): src_address, pc = fetch_word(memory, pc) low_byte = self.memory[0xffff & src_address] high_byte = self.memory[0xffff & (src_address + 1)] self.processor.main_registers['h'] = high_byte self.processor.main_registers['l'] = low_byte return 16, False, pc
def execute(self, processor, memory, pc): src_address, pc = fetch_word(memory, pc) low_byte = self.memory[0xffff & src_address] high_byte = self.memory[0xffff & (src_address + 1)] self.processor.main_registers[self.destination_reg[0]] = high_byte self.processor.main_registers[self.destination_reg[1]] = low_byte return 20, False, pc
def execute(self, processor, memory, pc): word, pc = fetch_word(memory, pc) call_to(self.processor, 3, word) return 17, True, pc
def execute(self, processor, memory, pc): address, pc = fetch_word(memory, pc) jp_to(self.processor, address) return 10, True, pc
def execute(self, processor, memory, pc): address, pc = fetch_word(memory, pc) self.memory[0xffff & address] = self.processor.main_registers['a'] return 13, False, pc
def execute(self, processor, memory, pc): src_address, pc = fetch_word(memory, pc) low_byte = self.memory[0xffff & src_address] high_byte = self.memory[0xffff & (src_address + 1)] self.processor.index_registers[self.indexed_reg] = big_endian_value([low_byte, high_byte]) return 20, False, pc
def execute(self, processor, memory, pc): dest_address, pc = fetch_word(memory, pc) high_byte, low_byte = high_low_pair(self.processor.index_registers[self.indexed_reg]) self.memory[0xffff & dest_address] = low_byte self.memory[0xffff & (dest_address + 1)] = high_byte return 20, False, pc
def execute(self, processor, memory, pc): address, pc = fetch_word(memory, pc) self.processor.index_registers[self.indexed_reg] = address return 14, False, pc
def execute(self, processor, memory, pc): address, pc = fetch_word(memory, pc) self.processor.special_registers['sp'] = address return 10, False, pc
def execute(self, processor, memory, pc): dest_address, pc = fetch_word(memory, pc) self.memory[0xffff & dest_address] = self.processor.main_registers['l'] self.memory[0xffff & dest_address + 1] = self.processor.main_registers['h'] return 16, False, pc
def execute(self, processor, memory, pc): dest_address, pc = fetch_word(memory, pc) self.memory[0xffff & dest_address] = self.processor.main_registers[self.source_reg[1]] self.memory[0xffff & dest_address + 1] = self.processor.main_registers[self.source_reg[0]] return 20, False, pc