# ROMFILE = 'nestest.nes' # STARTADDR = 0xC000 # ROMFILE = 'instr_test-v4/official_only.nes' # # unfortunately, the rom singles use unofficial instructions # ROMFILE = 'instr_test-v4/rom_singles/02-implied.nes' # STARTADDR = None # ROMFILE = 'donkeykong.nes' # STARTADDR = None ROMFILE = 'smb.nes' STARTADDR = None nestestrom = rom.readRom(ROMFILE) c = cpu.CPU(rom=nestestrom) startaddr = c.mem.dereference(mem.VEC_RST) startop = opc.instrFromAddr(startaddr, c) firstops = opc.instrListFromAddr(startaddr, 50, c) firstassem = "\n".join([op.disassemble() for op in firstops]) if STARTADDR is not None: c.PC = STARTADDR c.printState() def run(delay=0): instructions = 0 try: while True: c.tick()
def makeCPU(romfilepath, *cpuargs, **cpukwargs): r = rom.readRom(romfilepath) return cpu.CPU(rom=r, *cpuargs, **cpukwargs)