def __init__(self, romFilePath): self.sim6507 = Sim6502() self.simTIA = SimTIA() self.emuPIA = EmuPIA() self.rom = array('B', [0] * 4096) self.bankSwitchROMOffset = 0 self.programLen = 0 self.loadProgram(romFilePath) self.sim6507.resetChip() # The 6507's IRQ and NMI are connected to the supply voltage # Setting them to 'pulled high' will keep them high. self.sim6507.setPulledHigh(self.sim6507.getWireIndex('IRQ')) self.sim6507.setPulledHigh(self.sim6507.getWireIndex('NMI')) self.sim6507.recalcWireNameList(['IRQ', 'NMI']) # TIA CS1 is always high. !CS2 is always grounded self.simTIA.setPulledHigh(self.simTIA.getWireIndex('CS1')) self.simTIA.setPulledLow(self.simTIA.getWireIndex('CS2')) self.simTIA.recalcWireNameList(['CS1','CS2']) # We're running an Atari 2600 program, so set memory locations # for the console's switches and joystick state. # Console switches: # d3 set to 1 for color (vs B&W), # d1 select set to 1 for 'switch not pressed' # d0 set to 1 switch self.writeMemory(0x0282, 0x0B, True) # No joystick motion # joystick trigger buttons read on bit 7 of INPT4 and INPT5 of TIA self.writeMemory(0x0280, 0xFF, True)