Project: Add RunFrame

This commit is contained in:
Blue 2020-06-21 22:15:30 +02:00
parent 89030dfc04
commit 4f5f276b2e
2 changed files with 20 additions and 5 deletions

View file

@ -56,7 +56,7 @@ namespace ProjectPSX {
string diskFilename = GetDiskFilename();
psx = new ProjectPSX(this, diskFilename);
psx.POWER_ON();
psx.RunUncapped();
this.getScreen().MouseDoubleClick += new MouseEventHandler(toggleDebug);

View file

@ -45,17 +45,32 @@ namespace ProjectPSX {
}
public void POWER_ON() {
var timer = new System.Timers.Timer(1000);
timer.Elapsed += OnTimedEvent;
timer.Enabled = true;
}
public void RunUncapped() {
Task t = Task.Factory.StartNew(EXECUTE, TaskCreationOptions.LongRunning);
}
public void RunFrame() {
//33868800 / 60 = 564480 / 300 (Sync * underclock) = 1882~
for(int i = 0; i < 1882; i++) {
for (int j = 0; j < SYNC_CYCLES; j++) {
cpu.Run();
//cpu.handleInterrupts();
counter++;
}
bus.tick(SYNC_CYCLES * MIPS_UNDERCLOCK);
cpu.handleInterrupts();
}
}
private void EXECUTE() {
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
Thread.CurrentThread.Priority = ThreadPriority.Highest;
var timer = new System.Timers.Timer(1000);
timer.Elapsed += OnTimedEvent;
timer.Enabled = true;
try {
while (true) {
for (int j = 0; j < SYNC_CYCLES; j++) {