Esempio n. 1
0
# Memory Init
Memory = Memory("TETRIS.gb")

# CPU Init
CPU = CPU(Memory)
CPU.DEBUG = False

# GPU Init, pass in the memory that has been initialized in the CPU
GPU = GPU(Memory)

time_display = time.clock()

while RUNNING:

    cycles_before = CPU.cycles
    CPU.fetch()
    if CPU.PC >= 0x100:
        print("0x" + hex(CPU.PC)[2:].zfill(4).upper() + " : ", end="")
        CPU.decode()
        print(CPU.debug_string + "	", end="")
        for i in range(0, CPU.instruction_length - 1):
            print(hex(CPU.args[i])[2:].zfill(2).upper() + " ", end="")
        print("")
        CPU.print_registers()
        #input()
    else:
        CPU.decode()

    CPU.execute()
    cycles_after = CPU.cycles
    cycles_passed = cycles_after - cycles_before