diff --git a/Machines/Vic-20/Vic20.cpp b/Machines/Vic-20/Vic20.cpp new file mode 100644 index 000000000..58e027eaf --- /dev/null +++ b/Machines/Vic-20/Vic20.cpp @@ -0,0 +1,9 @@ +// +// Vic20.cpp +// Clock Signal +// +// Created by Thomas Harte on 04/06/2016. +// Copyright © 2016 Thomas Harte. All rights reserved. +// + +#include "Vic20.hpp" diff --git a/Machines/Vic-20/Vic20.hpp b/Machines/Vic-20/Vic20.hpp new file mode 100644 index 000000000..59f16351a --- /dev/null +++ b/Machines/Vic-20/Vic20.hpp @@ -0,0 +1,22 @@ +// +// Vic20.hpp +// Clock Signal +// +// Created by Thomas Harte on 04/06/2016. +// Copyright © 2016 Thomas Harte. All rights reserved. +// + +#ifndef Vic20_hpp +#define Vic20_hpp + +#include "../../Processors/6502/CPU6502.hpp" +#include "../CRTMachine.hpp" + +namespace Vic20 { + +class Machine: public CPU6502::Processor, public CRTMachine::Machine { +}; + +} + +#endif /* Vic20_hpp */ diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 0edc27528..375490caa 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -28,6 +28,10 @@ 4B69FB3D1C4D908A00B5F0AA /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B69FB3B1C4D908A00B5F0AA /* Tape.cpp */; }; 4B69FB441C4D941400B5F0AA /* TapeUEF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B69FB421C4D941400B5F0AA /* TapeUEF.cpp */; }; 4B69FB461C4D950F00B5F0AA /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B69FB451C4D950F00B5F0AA /* libz.tbd */; }; + 4B73C71A1D036BD90074D992 /* Vic20Document.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B73C7191D036BD90074D992 /* Vic20Document.swift */; }; + 4B73C71D1D036C030074D992 /* Vic20Document.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B73C71B1D036C030074D992 /* Vic20Document.xib */; }; + 4B886FF21D03B517004291C3 /* Vic20.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B886FF01D03B517004291C3 /* Vic20.cpp */; }; + 4B886FF51D03B61E004291C3 /* CSVic20.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B886FF41D03B61E004291C3 /* CSVic20.m */; }; 4B92EACA1B7C112B00246143 /* TimingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B92EAC91B7C112B00246143 /* TimingTests.swift */; }; 4BB298EE1B587D8400A49093 /* 6502_functional_test.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4BB297E01B587D8300A49093 /* 6502_functional_test.bin */; }; 4BB298EF1B587D8400A49093 /* AllSuiteA.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4BB297E11B587D8300A49093 /* AllSuiteA.bin */; }; @@ -373,6 +377,12 @@ 4B69FB421C4D941400B5F0AA /* TapeUEF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TapeUEF.cpp; sourceTree = ""; }; 4B69FB431C4D941400B5F0AA /* TapeUEF.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TapeUEF.hpp; sourceTree = ""; }; 4B69FB451C4D950F00B5F0AA /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; + 4B73C7191D036BD90074D992 /* Vic20Document.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Vic20Document.swift; sourceTree = ""; }; + 4B73C71C1D036C030074D992 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/Vic20Document.xib"; sourceTree = SOURCE_ROOT; }; + 4B886FF01D03B517004291C3 /* Vic20.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Vic20.cpp; path = "Vic-20/Vic20.cpp"; sourceTree = ""; }; + 4B886FF11D03B517004291C3 /* Vic20.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Vic20.hpp; path = "Vic-20/Vic20.hpp"; sourceTree = ""; }; + 4B886FF31D03B61E004291C3 /* CSVic20.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSVic20.h; sourceTree = ""; }; + 4B886FF41D03B61E004291C3 /* CSVic20.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSVic20.m; sourceTree = ""; }; 4B92EAC91B7C112B00246143 /* TimingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TimingTests.swift; sourceTree = ""; }; 4BAE587D1C447B7A005B9AF0 /* KeyCodes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyCodes.h; sourceTree = ""; }; 4BB297DF1B587D8200A49093 /* Clock SignalTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Clock SignalTests-Bridging-Header.h"; sourceTree = ""; }; @@ -793,6 +803,8 @@ 4B55CE4C1C3B3BDA0093A61B /* CSMachine.h */, 4B55CE4D1C3B3BDA0093A61B /* CSMachine.mm */, 4B55CE4F1C3B78A80093A61B /* CSMachine+Subclassing.h */, + 4B886FF31D03B61E004291C3 /* CSVic20.h */, + 4B886FF41D03B61E004291C3 /* CSVic20.m */, 4BAE587D1C447B7A005B9AF0 /* KeyCodes.h */, ); path = Wrappers; @@ -806,6 +818,8 @@ 4B55CE571C3B7D360093A61B /* ElectronDocument.swift */, 4B2E2D931C399D1200138695 /* ElectronDocument.xib */, 4B55CE5E1C3B7D960093A61B /* MachineDocument.swift */, + 4B73C7191D036BD90074D992 /* Vic20Document.swift */, + 4B73C71B1D036C030074D992 /* Vic20Document.xib */, ); path = Documents; sourceTree = ""; @@ -848,6 +862,15 @@ path = Formats; sourceTree = ""; }; + 4B886FF61D03B632004291C3 /* Vic-20 */ = { + isa = PBXGroup; + children = ( + 4B886FF01D03B517004291C3 /* Vic20.cpp */, + 4B886FF11D03B517004291C3 /* Vic20.hpp */, + ); + name = "Vic-20"; + sourceTree = ""; + }; 4BB297E41B587D8300A49093 /* Wolfgang Lorenz 6502 test suite */ = { isa = PBXGroup; children = ( @@ -1191,9 +1214,10 @@ 4BB73EDC1B587CA500552FC2 /* Machines */ = { isa = PBXGroup; children = ( + 4B046DC31CFE651500E9E45E /* CRTMachine.hpp */, 4B2E2D961C3A06EC00138695 /* Atari2600 */, 4B2E2D9E1C3A070900138695 /* Electron */, - 4B046DC31CFE651500E9E45E /* CRTMachine.hpp */, + 4B886FF61D03B632004291C3 /* Vic-20 */, ); name = Machines; path = ../../Machines; @@ -1370,6 +1394,7 @@ 4BE5F85F1C3E1C2500C43F01 /* os.rom in Resources */, 4BCB70B41C947DDC005B1712 /* plus1.rom in Resources */, 4BB73EA71B587A5100552FC2 /* Atari2600Document.xib in Resources */, + 4B73C71D1D036C030074D992 /* Vic20Document.xib in Resources */, 4BB73EAC1B587A5100552FC2 /* MainMenu.xib in Resources */, 4BE5F85E1C3E1C2500C43F01 /* basic.rom in Resources */, ); @@ -1667,11 +1692,14 @@ 4B55CE541C3B7ABF0093A61B /* CSElectron.mm in Sources */, 4B0CCC451C62D0B3001CAC5F /* CRT.cpp in Sources */, 4B55CE591C3B7D360093A61B /* ElectronDocument.swift in Sources */, + 4B886FF21D03B517004291C3 /* Vic20.cpp in Sources */, 4BC3B74F1CD194CC00F86E85 /* Shader.cpp in Sources */, 4B55CE4B1C3B3B0C0093A61B /* CSAtari2600.mm in Sources */, 4B55CE581C3B7D360093A61B /* Atari2600Document.swift in Sources */, 4B0EBFB81C487F2F00A11F35 /* AudioQueue.m in Sources */, 4BBB14311CD2CECE00BDB55C /* IntermediateShader.cpp in Sources */, + 4B886FF51D03B61E004291C3 /* CSVic20.m in Sources */, + 4B73C71A1D036BD90074D992 /* Vic20Document.swift in Sources */, 4BBF99181C8FBA6F0075DAFB /* TextureTarget.cpp in Sources */, 4BC76E691C98E31700E6EF73 /* FIRFilter.cpp in Sources */, 4B55CE5F1C3B7D960093A61B /* MachineDocument.swift in Sources */, @@ -1736,6 +1764,14 @@ path = ..; sourceTree = ""; }; + 4B73C71B1D036C030074D992 /* Vic20Document.xib */ = { + isa = PBXVariantGroup; + children = ( + 4B73C71C1D036C030074D992 /* Base */, + ); + name = Vic20Document.xib; + sourceTree = ""; + }; 4BB73EA51B587A5100552FC2 /* Atari2600Document.xib */ = { isa = PBXVariantGroup; children = ( diff --git a/OSBindings/Mac/Clock Signal/Base.lproj/Atari2600Document.xib b/OSBindings/Mac/Clock Signal/Base.lproj/Atari2600Document.xib index 9e73f7195..e1f140fda 100644 --- a/OSBindings/Mac/Clock Signal/Base.lproj/Atari2600Document.xib +++ b/OSBindings/Mac/Clock Signal/Base.lproj/Atari2600Document.xib @@ -1,5 +1,5 @@ - + diff --git a/OSBindings/Mac/Clock Signal/ClockSignal-Bridging-Header.h b/OSBindings/Mac/Clock Signal/ClockSignal-Bridging-Header.h index 552a4cbd4..c87782a47 100644 --- a/OSBindings/Mac/Clock Signal/ClockSignal-Bridging-Header.h +++ b/OSBindings/Mac/Clock Signal/ClockSignal-Bridging-Header.h @@ -3,8 +3,10 @@ // #import "CSMachine.h" + #import "CSAtari2600.h" #import "CSElectron.h" +#import "CSVic20.h" #import "CSOpenGLView.h" #import "AudioQueue.h" diff --git a/OSBindings/Mac/Clock Signal/Documents/Atari2600Document.swift b/OSBindings/Mac/Clock Signal/Documents/Atari2600Document.swift index e13fff8fa..fd546a79b 100644 --- a/OSBindings/Mac/Clock Signal/Documents/Atari2600Document.swift +++ b/OSBindings/Mac/Clock Signal/Documents/Atari2600Document.swift @@ -26,17 +26,9 @@ class Atari2600Document: MachineDocument { } override var windowNibName: String? { - // Returns the nib file name of the document - // If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this property and override -makeWindowControllers instead. return "Atari2600Document" } - override func dataOfType(typeName: String) throws -> NSData { - // Insert code here to write your document to data of the specified type. If outError != nil, ensure that you create and set an appropriate error when returning nil. - // You can also choose to override fileWrapperOfType:error:, writeToURL:ofType:error:, or writeToURL:ofType:forSaveOperation:originalContentsURL:error: instead. - throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil) - } - override func readFromData(data: NSData, ofType typeName: String) throws { atari2600.setROM(data) } diff --git a/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift b/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift index e752f032f..3f8e8ec60 100644 --- a/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift +++ b/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift @@ -114,4 +114,9 @@ class MachineDocument: NSDocument, CSOpenGLViewDelegate, CSOpenGLViewResponderDe func keyDown(event: NSEvent) {} func keyUp(event: NSEvent) {} func flagsChanged(newModifiers: NSEvent) {} + + // MARK: NSDocument overrides + override func dataOfType(typeName: String) throws -> NSData { + throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil) + } } diff --git a/OSBindings/Mac/Clock Signal/Documents/Vic20Document.swift b/OSBindings/Mac/Clock Signal/Documents/Vic20Document.swift new file mode 100644 index 000000000..08b9b6bc0 --- /dev/null +++ b/OSBindings/Mac/Clock Signal/Documents/Vic20Document.swift @@ -0,0 +1,24 @@ +// +// Vic20Document.swift +// Clock Signal +// +// Created by Thomas Harte on 04/06/2016. +// Copyright © 2016 Thomas Harte. All rights reserved. +// + +import Foundation + +class Vic20Document: MachineDocument { + + private lazy var vic20 = CSVic20() + override func machine() -> CSMachine! { + return vic20 + } + + // MARK: NSDocument overrides + override init() { + super.init() + self.intendedCyclesPerSecond = 1022727 + // TODO: or 1108405 for PAL; see http://www.antimon.org/dl/c64/code/stable.txt + } +} diff --git a/OSBindings/Mac/Clock Signal/Info.plist b/OSBindings/Mac/Clock Signal/Info.plist index 07d3a41d5..3fbd5f02d 100644 --- a/OSBindings/Mac/Clock Signal/Info.plist +++ b/OSBindings/Mac/Clock Signal/Info.plist @@ -74,6 +74,20 @@ NSDocumentClass $(PRODUCT_MODULE_NAME).ElectronDocument + + CFBundleTypeExtensions + + prg + + CFBundleTypeName + Vic-20 Cartridge + CFBundleTypeRole + Viewer + LSTypeIsPackage + 0 + NSDocumentClass + Vic20Document + CFBundleExecutable $(EXECUTABLE_NAME) diff --git a/OSBindings/Mac/Clock Signal/Wrappers/CSVic20.h b/OSBindings/Mac/Clock Signal/Wrappers/CSVic20.h new file mode 100644 index 000000000..039e6afb0 --- /dev/null +++ b/OSBindings/Mac/Clock Signal/Wrappers/CSVic20.h @@ -0,0 +1,13 @@ +// +// CSVic20.h +// Clock Signal +// +// Created by Thomas Harte on 04/06/2016. +// Copyright © 2016 Thomas Harte. All rights reserved. +// + +#import "CSMachine.h" + +@interface CSVic20 : CSMachine + +@end diff --git a/OSBindings/Mac/Clock Signal/Wrappers/CSVic20.m b/OSBindings/Mac/Clock Signal/Wrappers/CSVic20.m new file mode 100644 index 000000000..64d7cdb49 --- /dev/null +++ b/OSBindings/Mac/Clock Signal/Wrappers/CSVic20.m @@ -0,0 +1,13 @@ +// +// CSVic20.m +// Clock Signal +// +// Created by Thomas Harte on 04/06/2016. +// Copyright © 2016 Thomas Harte. All rights reserved. +// + +#import "CSVic20.h" + +@implementation CSVic20 + +@end