public int run(int[] args) { CPU.loadDataRegister(addrMode, size.getRealSize(), args); CPU.dataReg.setValue(CPU.a.getValue()); CPU.saveDataReg(); int cycles = 4; if (!CPU.status.isMemoryAccess()) cycles++; return cycles; }
public static void init(InputStream is, boolean isZip) { CPU.resetCPU(); PPU.init(); printStats(); Log.debug("====Starting SNO===="); RomLoader rl = new RomLoader(is, isZip); if (rl.getRomInfo().isHiROM()) mem = new HiROMMemory(); else mem = new LoROMMemory(); rl.loadMemory(mem); instCount = 0; // Initiate Reset Vector CPU.resetVectorInit(); }
public static void cycle(long count) throws Exception { long instCount = 0; // Do as many instructions as set in properties file // Will execute indefinitely if instruction count is negative try { while ((instCount < count || count < 0) && running) { if (pause && !advanceFrameOnce) continue; CPU.cycle(); instCount++; } } catch (Exception err) { // Finish timing and print stats before throwing error up timeEnd = new Date().getTime(); System.out.println("Total time: " + ((timeEnd - timeBegin) / 1000) + " seconds"); System.out.println("Instructions performed: " + instCount); System.out.println("Cycles performed: " + Timing.getCycles()); System.out.println( "Average speed: " + (((Timing.getCycles() + 0f) / ((timeEnd - timeBegin + 0f) / 1000f)) / (1024f * 1024f)) + " MHz"); System.out.println( "Average speed: " + (((Timing.getCycles() + 0f) / ((timeEnd - timeBegin + 0f) / 1000f))) + " Hz"); printMMaps(); throw err; } Core.instCount += instCount; }