Esempio n. 1
0
import time

from CPU import CPU
from GPU import GPU
from Memory import Memory

RUNNING = True
STEP = False

# 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="")
Esempio n. 2
0
import time
import os

from CPU import CPU
from GPU import GPU
from Memory import Memory

RUNNING = True
STEP = False

# Create the memory, to be accessed by several components
Memory = Memory("TETRIS.gb")

# Central Processing Unit (CPU)
CPU = CPU(Memory)
CPU.DEBUG = True

# Graphical Processing Unit (GPU)
GPU = GPU(Memory)

try:
    os.remove("log.txt")
except:
    pass

file = open("log.txt", "w")

BREAKPOINTS = []
BREAK = False

while RUNNING: