private void DoCycle() { if (frameCycles == 0) { board.inputRead = false; board.PollInput(); board.cpu.LagCycles = 0; } //disk.Execute(); board.Execute(); frameCycles++; // load PRG file if needed if (loadPrg) { // check to see if cpu PC is at the BASIC warm start vector if (board.cpu.PC == ((board.ram.Peek(0x0303) << 8) | board.ram.Peek(0x0302))) { //board.ram.Poke(0x0302, 0xAE); //board.ram.Poke(0x0303, 0xA7); ////board.ram.Poke(0x0302, board.ram.Peek(0x0308)); ////board.ram.Poke(0x0303, board.ram.Peek(0x0309)); //if (inputFileInfo.Data.Length >= 6) //{ // board.ram.Poke(0x0039, inputFileInfo.Data[4]); // board.ram.Poke(0x003A, inputFileInfo.Data[5]); //} PRG.Load(board.pla, inputFileInfo.Data); loadPrg = false; } } if (frameCycles == cyclesPerFrame) { board.Flush(); _islag = !board.inputRead; if (_islag) { _lagcount++; } frameCycles -= cyclesPerFrame; _frame++; //Console.WriteLine("CPUPC: " + C64Util.ToHex(board.cpu.PC, 4) + " 1541PC: " + C64Util.ToHex(disk.PC, 4)); int test = board.cpu.LagCycles; DriveLightOn = DriveLED; } }
// process frame public void FrameAdvance(bool render, bool rendersound) { board.inputRead = false; board.PollInput(); board.cpu.LagCycles = 0; for (int count = 0; count < cyclesPerFrame; count++) { //disk.Execute(); board.Execute(); // load PRG file if needed if (loadPrg) { // check to see if cpu PC is at the BASIC warm start vector if (board.cpu.PC == ((board.ram.Peek(0x0303) << 8) | board.ram.Peek(0x0302))) { //board.ram.Poke(0x0302, 0xAE); //board.ram.Poke(0x0303, 0xA7); ////board.ram.Poke(0x0302, board.ram.Peek(0x0308)); ////board.ram.Poke(0x0303, board.ram.Peek(0x0309)); //if (inputFileInfo.Data.Length >= 6) //{ // board.ram.Poke(0x0039, inputFileInfo.Data[4]); // board.ram.Poke(0x003A, inputFileInfo.Data[5]); //} PRG.Load(board.pla, inputFileInfo.Data); loadPrg = false; } } } board.Flush(); _islag = !board.inputRead; if (_islag) { LagCount++; } _frame++; //Console.WriteLine("CPUPC: " + C64Util.ToHex(board.cpu.PC, 4) + " 1541PC: " + C64Util.ToHex(disk.PC, 4)); int test = board.cpu.LagCycles; CoreComm.DriveLED = DriveLED; }
// process frame public void FrameAdvance(bool render, bool rendersound) { board.inputRead = false; board.PollInput(); board.cpu.LagCycles = 0; for (int count = 0; count < cyclesPerFrame; count++) { //disk.Execute(); board.Execute(); #if false if (board.cpu.PC == 0xE16F && (board.cpu.ReadPort() & 0x7) == 7) { // HUGE kernal hack to load files // the only purpose for this is to be able to run the Lorenz // test suite! int fileNameLength = board.ram.Peek(0xB7); int fileNameOffset = board.ram.Peek(0xBB) | ((int)board.ram.Peek(0xBC) << 8); byte[] fileNameRaw = new byte[fileNameLength]; for (int i = 0; i < fileNameLength; i++) { fileNameRaw[i] = board.ram.Peek(fileNameOffset + i); } var enc = System.Text.Encoding.ASCII; string fileName = enc.GetString(fileNameRaw); string filePath = Path.Combine(@"E:\Programming\Visual Studio 2013\Vice\testprogs\general\Lorenz-2.15\src\", fileName + ".prg"); if (File.Exists(filePath)) { PRG.Load(board.pla, File.ReadAllBytes(filePath)); } board.cpu.PC = 0xE1B5; } #endif // load PRG file if needed if (loadPrg) { // check to see if cpu PC is at the BASIC warm start vector if (board.cpu.PC == ((board.ram.Peek(0x0303) << 8) | board.ram.Peek(0x0302))) { //board.ram.Poke(0x0302, 0xAE); //board.ram.Poke(0x0303, 0xA7); ////board.ram.Poke(0x0302, board.ram.Peek(0x0308)); ////board.ram.Poke(0x0303, board.ram.Peek(0x0309)); //if (inputFileInfo.Data.Length >= 6) //{ // board.ram.Poke(0x0039, inputFileInfo.Data[4]); // board.ram.Poke(0x003A, inputFileInfo.Data[5]); //} PRG.Load(board.pla, inputFileInfo.Data); loadPrg = false; } } } board.Flush(); _islag = !board.inputRead; if (_islag) { LagCount++; } _frame++; //Console.WriteLine("CPUPC: " + C64Util.ToHex(board.cpu.PC, 4) + " 1541PC: " + C64Util.ToHex(disk.PC, 4)); int test = board.cpu.LagCycles; DriveLightOn = DriveLED; }