Exemplo n.º 1
0
    def __init__(self):
        super().__init__()
        nes = Nes()
        nes.load('roms/mario.nes')

        # configure ppu
        self._ppu_bus = Bus()
        self._ppu_pattern = PatternTable()
        self._ppu_pattern.load(nes.chr)
        self._ppu_name = NameTable()
        self._ppu_palette = PaletteTable()
        self._ppu_bus.connect(self._ppu_pattern)
        self._ppu_bus.connect(self._ppu_name)
        self._ppu_bus.connect(self._ppu_palette)
        self._ppu = Ppu(self._ppu_bus)

        # configure cpu
        self._cpu_ram = Ram()
        self._pgr = PGRRom()
        self._pgr.load(nes.pgr)
        self._papu_ram = PAuExp()
        self._cpu_bus = Bus()
        self._cpu_bus.connect(self._pgr)
        self._cpu_bus.connect(self._cpu_ram)
        self._cpu_bus.connect(self._papu_ram)
        self._cpu_bus.connect(self._ppu.get_register())
        self._cpu = Cpu6502(self._cpu_bus)
        self._cpu.reset()

        self._ppu.set_request_nmi(self._cpu.request_nmi)

        self._addr_map, self._code = self._cpu.decode(0x8000, 0xFF00)
        self._font = pygame.font.SysFont('inconsolatan', 24)
        self._cpu_running = False
        self._cpu_time_last = 0
Exemplo n.º 2
0
def ppu_test():
    nes = Nes()
    nes.load('roms/mario.nes')

    chr_rom = CHRRom()
    chr_rom.load(nes.chr)
    v_ram = VRam()
Exemplo n.º 3
0
def main():
    _ppu_bus = Bus()
    _ppu_pattern = PatternTable()
    # _ppu_pattern.load(nes.chr)
    _ppu_name = NameTable()
    _ppu_palette = PaletteTable()
    _ppu_bus.connect(_ppu_pattern)
    _ppu_bus.connect(_ppu_name)
    _ppu_bus.connect(_ppu_palette)
    _ppu = Ppu(_ppu_bus)

    ram = Ram()
    pgr = PGRRom()
    ppu_reg = PPURegister(_ppu_bus)
    pau_exp = PAuExp()
    nes = Nes()
    nes.load('roms/nestest.nes')
    pgr.load(nes.pgr)

    bus = Bus()
    bus.connect(pgr)
    bus.connect(ram)
    bus.connect(pau_exp)
    bus.connect(ppu_reg)

    cpu = Cpu6502(bus)
    cpu.test_mode()

    real_log = Log()
    n = 0
    while True:
        n += 1
        log = cpu.log()
        if not real_log.check(log):
            # print('F: {}'.format(OrderedDict(log)))
            # print('T: {}'.format(OrderedDict(real_log.log())))
            # print('{} Addr: {}, Data: {}'.format(n, cpu._addr, cpu._data))
            break
        else:
            pass
            # print('T: {}'.format(OrderedDict(log)))
        cpu.run()
        end = real_log.next()
        if end:
            break
    print('{} ins passed'.format(n))
Exemplo n.º 4
0
from pprint import pprint
from nes import Nes

emulator = Nes()
emulator.load('../roms/tutor.nes')
pprint(emulator.__dict__)