Beispiel #1
0
    def run_rom(self, rom: ROM):
        # Load rom
        self.rom = rom
        self.pc_reg = rom.header_size

        while self.running:
            op_code = rom.get(self.pc_reg)
            op_position = int.from_bytes(op_code, byteorder='little')
            mode = self.instructionModes[op_position]

            print("")
            print(mode)

            self.addressing_modes(mode)

            self.pc_reg += self.instructionSizes[op_position]
            self.cycles += self.instructionCycles[op_position]

            if self.page_crossed:
                self.cycles += self.instructionPageCycles[op_position]

            instruction_class = self.instructionNames[op_position]
            print(instruction_class)

            instruction = instruction_class()

            # TODO: Try catch not implemented instruction
            instruction.execute(self)