Example #1
0
    def __init__(self, cartridge_path):
        self.cpu = CPU()
        self.memory = None
        self.cart = None
        self.mapper = None
        # self.instructions = None
        self.chr_rom = None

        try:
            self.cart = Cartridge(cartridge_path)
            self.chr_rom = self.cart.get_chr_rom()

            sprites = get_sprites(self.chr_rom)

            game = ScreenController([0] * 0x4000, [0xFE] * 0x100)
            game.set_sprites(sprites)
            while True:
                game.init_info()
                game.draw_sprites()
                game.display()

            # self.instructions = self.cart.get_prg_rom()
            #
            # if self.cart.get_mapper_type() == MapperType.NROM:
            #     self.mapper = NromMapper(self.cart)
            # else:
            #     raise ValueError("Cartridge specifies a mapper type not supported yet")
            #
            # InstructionCollection.initialize()
            # Runner.run(self.instructions, self.cpu, self.memory)

        except Exception as err:
            print(e)
            print(err.args)
Example #2
0
 def setUp(self):
     self.cpu = CPU()
     self.memory = Memory(self.cpu)
     # mock state
     self.cpu.state.a.set_value(77)
     self.cpu.state.x.set_value(88)
     self.cpu.state.y.set_value(99)
     self.memory.set_content(100, 55)
Example #3
0
 def setUp(self):
     self.cpu = CPU()
     self.memory = Memory(self.cpu)
     # mock state
     self.memory.set_content(100, 77)
     self.memory.set_content(101, 0)
     self.memory.set_content(102, 128)
     self.cpu.state.a.set_value(1)
     self.cpu.state.x.set_value(1)
     self.cpu.state.y.set_value(1)
Example #4
0
 def setUp(self):
     self.cpu = CPU()
     self.memory = Memory(self.cpu)
     self.memory.set_content(0xA000, 0b11000000)
     self.cpu.state.a.set_value(0b01000000)
Example #5
0
 def setUp(self):
     self.cpu = CPU()
     self.memory = Memory(self.cpu)
     self.memory.set_content(100, 8)
     self.memory.set_content(101, 1)
Example #6
0
 def setUp(self):
     self.cpu = CPU()
     self.memory = Memory(self.cpu)
Example #7
0
 def setUp(self):
     self.cpu = CPU()
     self.memory = Memory(self.cpu)
     # memory Mock
     self.memory.memory = [InstructionAddressingTest.POSITION_PLACEHOLDER] * Memory.MEMORY_LIMIT
Example #8
0
    def setUp(self):
        self.cpu = CPU()
        self.memory = Memory(self.cpu)
        self.memory.reset()

        self.cpu.state.pc.set_value(10)
Example #9
0
 def setUp(self):
     self.cpu = CPU()
     self.memory = Memory(self.cpu)
     self.top = self.memory.stack.get_top()