From cfa616d5937cb2c0b705a84db56ced3babc6f260 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 12 Mar 2016 11:51:20 -0500 Subject: [PATCH] Fixed: timing issue versus supplied test ROM was failure to include the Plus 1 ROM in the mix. --- .gitignore | 3 +++ Machines/Electron/Electron.cpp | 7 ++++--- OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj | 4 ++++ .../Mac/Clock Signal/Documents/ElectronDocument.swift | 3 +++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 624ccbf1e..c2d42ca10 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,9 @@ DerivedData *.xcuserstate .DS_Store +# Exclude Electron ROMs +OSBindings/Mac/Clock Signal/Resources/Electron/* + # CocoaPods # # We recommend against adding the Pods directory to your .gitignore. However diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index cde6f6438..732b14d22 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -28,7 +28,7 @@ namespace { static const unsigned int first_graphics_cycle = 33; static const unsigned int real_time_clock_interrupt_line = 100; - static const unsigned int display_end_interrupt_line = 264; + static const unsigned int display_end_interrupt_line = 255; } #define graphics_line(v) ((((v) >> 7) - first_graphics_line + field_divider_line) % field_divider_line) @@ -293,8 +293,9 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin // printf("%04x: %02x (%d)\n", address, *value, _fieldCycles); // } - const unsigned int line_before_cycle = graphics_line(_frameCycles); - const unsigned int line_after_cycle = graphics_line(_frameCycles + cycles); + const unsigned int pixel_line_clock = _frameCycles + 128 - first_graphics_cycle + 80; + const unsigned int line_before_cycle = graphics_line(pixel_line_clock); + const unsigned int line_after_cycle = graphics_line(pixel_line_clock + cycles); // implicit assumption here: the number of 2Mhz cycles this bus operation will take // is never longer than a line. On the Electron, it's a safe one. diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 7a8130733..9ba0da4f8 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -308,6 +308,7 @@ 4BBF99161C8FBA6F0075DAFB /* CRTRunBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF990C1C8FBA6F0075DAFB /* CRTRunBuilder.cpp */; }; 4BBF99171C8FBA6F0075DAFB /* Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF99101C8FBA6F0075DAFB /* Shader.cpp */; }; 4BBF99181C8FBA6F0075DAFB /* TextureTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF99121C8FBA6F0075DAFB /* TextureTarget.cpp */; }; + 4BCB70B41C947DDC005B1712 /* plus1.rom in Resources */ = {isa = PBXBuildFile; fileRef = 4BCB70B31C947DDC005B1712 /* plus1.rom */; }; 4BE5F85E1C3E1C2500C43F01 /* basic.rom in Resources */ = {isa = PBXBuildFile; fileRef = 4BE5F85C1C3E1C2500C43F01 /* basic.rom */; }; 4BE5F85F1C3E1C2500C43F01 /* os.rom in Resources */ = {isa = PBXBuildFile; fileRef = 4BE5F85D1C3E1C2500C43F01 /* os.rom */; }; /* End PBXBuildFile section */ @@ -665,6 +666,7 @@ 4BBF99121C8FBA6F0075DAFB /* TextureTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextureTarget.cpp; sourceTree = ""; }; 4BBF99131C8FBA6F0075DAFB /* TextureTarget.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TextureTarget.hpp; sourceTree = ""; }; 4BBF99191C8FC2750075DAFB /* CRTTypes.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CRTTypes.hpp; sourceTree = ""; }; + 4BCB70B31C947DDC005B1712 /* plus1.rom */ = {isa = PBXFileReference; lastKnownFileType = file; path = plus1.rom; sourceTree = ""; }; 4BE5F85C1C3E1C2500C43F01 /* basic.rom */ = {isa = PBXFileReference; lastKnownFileType = file; path = basic.rom; sourceTree = ""; }; 4BE5F85D1C3E1C2500C43F01 /* os.rom */ = {isa = PBXFileReference; lastKnownFileType = file; path = os.rom; sourceTree = ""; }; /* End PBXFileReference section */ @@ -1221,6 +1223,7 @@ 4BE5F85B1C3E1C2500C43F01 /* Electron */ = { isa = PBXGroup; children = ( + 4BCB70B31C947DDC005B1712 /* plus1.rom */, 4BE5F85C1C3E1C2500C43F01 /* basic.rom */, 4BE5F85D1C3E1C2500C43F01 /* os.rom */, ); @@ -1339,6 +1342,7 @@ 4B2E2D951C399D1200138695 /* ElectronDocument.xib in Resources */, 4BB73EA91B587A5100552FC2 /* Assets.xcassets in Resources */, 4BE5F85F1C3E1C2500C43F01 /* os.rom in Resources */, + 4BCB70B41C947DDC005B1712 /* plus1.rom in Resources */, 4BB73EA71B587A5100552FC2 /* Atari2600Document.xib in Resources */, 4BB73EAC1B587A5100552FC2 /* MainMenu.xib in Resources */, 4BE5F85E1C3E1C2500C43F01 /* basic.rom in Resources */, diff --git a/OSBindings/Mac/Clock Signal/Documents/ElectronDocument.swift b/OSBindings/Mac/Clock Signal/Documents/ElectronDocument.swift index 289032701..46b596615 100644 --- a/OSBindings/Mac/Clock Signal/Documents/ElectronDocument.swift +++ b/OSBindings/Mac/Clock Signal/Documents/ElectronDocument.swift @@ -52,6 +52,9 @@ class ElectronDocument: MachineDocument { } override func readFromData(data: NSData, ofType typeName: String) throws { + if let plus1Path = NSBundle.mainBundle().pathForResource("plus1", ofType: "rom") { + electron.setROM(NSData(contentsOfFile: plus1Path)!, slot: 12) + } electron.setROM(data, slot: 15) }