diff --git a/A2Mac copy-Info.plist b/A2Mac copy-Info.plist
new file mode 100644
index 0000000..a17db71
--- /dev/null
+++ b/A2Mac copy-Info.plist
@@ -0,0 +1,34 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ $(DEVELOPMENT_LANGUAGE)
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIconFile
+
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ $(PRODUCT_NAME)
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ 1.0
+ CFBundleVersion
+ 1
+ LSApplicationCategoryType
+ public.app-category.education
+ LSMinimumSystemVersion
+ $(MACOSX_DEPLOYMENT_TARGET)
+ NSHumanReadableCopyright
+ Copyright © 2019 GameAlloy. All rights reserved.
+ NSMainStoryboardFile
+ Main
+ NSPrincipalClass
+ NSApplication
+
+
diff --git a/A2Mac copy2-Info.plist b/A2Mac copy2-Info.plist
new file mode 100644
index 0000000..a17db71
--- /dev/null
+++ b/A2Mac copy2-Info.plist
@@ -0,0 +1,34 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ $(DEVELOPMENT_LANGUAGE)
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIconFile
+
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ $(PRODUCT_NAME)
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ 1.0
+ CFBundleVersion
+ 1
+ LSApplicationCategoryType
+ public.app-category.education
+ LSMinimumSystemVersion
+ $(MACOSX_DEPLOYMENT_TARGET)
+ NSHumanReadableCopyright
+ Copyright © 2019 GameAlloy. All rights reserved.
+ NSMainStoryboardFile
+ Main
+ NSPrincipalClass
+ NSApplication
+
+
diff --git a/A2Mac.xcodeproj/project.pbxproj b/A2Mac.xcodeproj/project.pbxproj
index d6784b1..ba915e7 100644
--- a/A2Mac.xcodeproj/project.pbxproj
+++ b/A2Mac.xcodeproj/project.pbxproj
@@ -13,10 +13,31 @@
32BFFB5B22EACC630003B53F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32BFFB5A22EACC630003B53F /* AppDelegate.swift */; };
32BFFB5D22EACC630003B53F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32BFFB5C22EACC630003B53F /* ViewController.swift */; };
32BFFB5F22EACC660003B53F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB5E22EACC660003B53F /* Assets.xcassets */; };
- 32BFFB6222EACC660003B53F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB6022EACC660003B53F /* Main.storyboard */; };
32BFFB6E22EACC660003B53F /* A2MacTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32BFFB6D22EACC660003B53F /* A2MacTests.swift */; };
32BFFB7922EACC660003B53F /* A2MacUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32BFFB7822EACC660003B53F /* A2MacUITests.swift */; };
32C45306232E3EEF0000EBA1 /* RepeatingTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C45305232E3EEF0000EBA1 /* RepeatingTimer.swift */; };
+ 32C4530B2331F7220000EBA1 /* 6502.c in Sources */ = {isa = PBXBuildFile; fileRef = 32439F7422ECD8AD0077AAE0 /* 6502.c */; };
+ 32C4530C2331F7220000EBA1 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32BFFB5C22EACC630003B53F /* ViewController.swift */; };
+ 32C4530D2331F7220000EBA1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32BFFB5A22EACC630003B53F /* AppDelegate.swift */; };
+ 32C4530E2331F7220000EBA1 /* RepeatingTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C45305232E3EEF0000EBA1 /* RepeatingTimer.swift */; };
+ 32C453112331F7220000EBA1 /* fail1.txt in Resources */ = {isa = PBXBuildFile; fileRef = 32EDB7A123272CA80073AF2D /* fail1.txt */; };
+ 32C453122331F7220000EBA1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB5E22EACC660003B53F /* Assets.xcassets */; };
+ 32C453132331F7220000EBA1 /* apple.rom in Resources */ = {isa = PBXBuildFile; fileRef = 32439F8422ECD8AD0077AAE0 /* apple.rom */; };
+ 32C453152331F7220000EBA1 /* 6502_functional_test.bin in Resources */ = {isa = PBXBuildFile; fileRef = 326ED2EE232D7A0000A41337 /* 6502_functional_test.bin */; };
+ 32C4531D2331FED90000EBA1 /* 6502.c in Sources */ = {isa = PBXBuildFile; fileRef = 32439F7422ECD8AD0077AAE0 /* 6502.c */; };
+ 32C4531E2331FED90000EBA1 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32BFFB5C22EACC630003B53F /* ViewController.swift */; };
+ 32C4531F2331FED90000EBA1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32BFFB5A22EACC630003B53F /* AppDelegate.swift */; };
+ 32C453202331FED90000EBA1 /* RepeatingTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C45305232E3EEF0000EBA1 /* RepeatingTimer.swift */; };
+ 32C453232331FED90000EBA1 /* fail1.txt in Resources */ = {isa = PBXBuildFile; fileRef = 32EDB7A123272CA80073AF2D /* fail1.txt */; };
+ 32C453242331FED90000EBA1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB5E22EACC660003B53F /* Assets.xcassets */; };
+ 32C453252331FED90000EBA1 /* apple.rom in Resources */ = {isa = PBXBuildFile; fileRef = 32439F8422ECD8AD0077AAE0 /* apple.rom */; };
+ 32C453272331FED90000EBA1 /* 6502_functional_test.bin in Resources */ = {isa = PBXBuildFile; fileRef = 326ED2EE232D7A0000A41337 /* 6502_functional_test.bin */; };
+ 32C4532E233345430000EBA1 /* QuietView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C4532D233345420000EBA1 /* QuietView.swift */; };
+ 32C4532F233345820000EBA1 /* QuietView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C4532D233345420000EBA1 /* QuietView.swift */; };
+ 32C45330233345820000EBA1 /* QuietView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C4532D233345420000EBA1 /* QuietView.swift */; };
+ 32C4533123335E560000EBA1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB6022EACC660003B53F /* Main.storyboard */; };
+ 32C4533223335E570000EBA1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB6022EACC660003B53F /* Main.storyboard */; };
+ 32C4533323335E570000EBA1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB6022EACC660003B53F /* Main.storyboard */; };
32EDB7A223272CA80073AF2D /* fail1.txt in Resources */ = {isa = PBXBuildFile; fileRef = 32EDB7A123272CA80073AF2D /* fail1.txt */; };
/* End PBXBuildFile section */
@@ -75,6 +96,12 @@
32BFFB7822EACC660003B53F /* A2MacUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = A2MacUITests.swift; sourceTree = ""; };
32BFFB7A22EACC660003B53F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
32C45305232E3EEF0000EBA1 /* RepeatingTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RepeatingTimer.swift; sourceTree = ""; };
+ 32C453072331C0910000EBA1 /* NSLayoutManager-Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSLayoutManager-Extension.swift"; sourceTree = ""; };
+ 32C453192331F7220000EBA1 /* Speedtest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Speedtest.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 32C4531A2331F7220000EBA1 /* A2Mac copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "A2Mac copy-Info.plist"; path = "/Users/trudnai/Projects/A2Mac/A2Mac copy-Info.plist"; sourceTree = ""; };
+ 32C4532B2331FED90000EBA1 /* Functiontest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Functiontest.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 32C4532C2331FEDA0000EBA1 /* A2Mac copy2-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "A2Mac copy2-Info.plist"; path = "/Users/trudnai/Projects/A2Mac/A2Mac copy2-Info.plist"; sourceTree = ""; };
+ 32C4532D233345420000EBA1 /* QuietView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuietView.swift; sourceTree = ""; };
32EDB7A123272CA80073AF2D /* fail1.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = fail1.txt; sourceTree = ""; };
/* End PBXFileReference section */
@@ -100,6 +127,20 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 32C4530F2331F7220000EBA1 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 32C453212331FED90000EBA1 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@@ -132,6 +173,8 @@
32BFFB6C22EACC660003B53F /* A2MacTests */,
32BFFB7722EACC660003B53F /* A2MacUITests */,
32BFFB5822EACC630003B53F /* Products */,
+ 32C4531A2331F7220000EBA1 /* A2Mac copy-Info.plist */,
+ 32C4532C2331FEDA0000EBA1 /* A2Mac copy2-Info.plist */,
);
sourceTree = "";
};
@@ -141,6 +184,8 @@
32BFFB5722EACC630003B53F /* A2Mac.app */,
32BFFB6922EACC660003B53F /* A2MacTests.xctest */,
32BFFB7422EACC660003B53F /* A2MacUITests.xctest */,
+ 32C453192331F7220000EBA1 /* Speedtest.app */,
+ 32C4532B2331FED90000EBA1 /* Functiontest.app */,
);
name = Products;
sourceTree = "";
@@ -158,6 +203,8 @@
32439F8622ECD8AD0077AAE0 /* common.h */,
32BFFB5A22EACC630003B53F /* AppDelegate.swift */,
32BFFB5C22EACC630003B53F /* ViewController.swift */,
+ 32C4532D233345420000EBA1 /* QuietView.swift */,
+ 32C453072331C0910000EBA1 /* NSLayoutManager-Extension.swift */,
32C45305232E3EEF0000EBA1 /* RepeatingTimer.swift */,
32EDB7A123272CA80073AF2D /* fail1.txt */,
32BFFB5E22EACC660003B53F /* Assets.xcassets */,
@@ -243,6 +290,40 @@
productReference = 32BFFB7422EACC660003B53F /* A2MacUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
+ 32C453092331F7220000EBA1 /* Speedtest */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 32C453162331F7220000EBA1 /* Build configuration list for PBXNativeTarget "Speedtest" */;
+ buildPhases = (
+ 32C4530A2331F7220000EBA1 /* Sources */,
+ 32C4530F2331F7220000EBA1 /* Frameworks */,
+ 32C453102331F7220000EBA1 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = Speedtest;
+ productName = A2Mac;
+ productReference = 32C453192331F7220000EBA1 /* Speedtest.app */;
+ productType = "com.apple.product-type.application";
+ };
+ 32C4531B2331FED90000EBA1 /* Functiontest */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 32C453282331FED90000EBA1 /* Build configuration list for PBXNativeTarget "Functiontest" */;
+ buildPhases = (
+ 32C4531C2331FED90000EBA1 /* Sources */,
+ 32C453212331FED90000EBA1 /* Frameworks */,
+ 32C453222331FED90000EBA1 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = Functiontest;
+ productName = A2Mac;
+ productReference = 32C4532B2331FED90000EBA1 /* Functiontest.app */;
+ productType = "com.apple.product-type.application";
+ };
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -283,6 +364,8 @@
32BFFB5622EACC630003B53F /* A2Mac */,
32BFFB6822EACC660003B53F /* A2MacTests */,
32BFFB7322EACC660003B53F /* A2MacUITests */,
+ 32C453092331F7220000EBA1 /* Speedtest */,
+ 32C4531B2331FED90000EBA1 /* Functiontest */,
);
};
/* End PBXProject section */
@@ -293,9 +376,9 @@
buildActionMask = 2147483647;
files = (
32EDB7A223272CA80073AF2D /* fail1.txt in Resources */,
+ 32C4533123335E560000EBA1 /* Main.storyboard in Resources */,
32BFFB5F22EACC660003B53F /* Assets.xcassets in Resources */,
32439F8822ECD8AD0077AAE0 /* apple.rom in Resources */,
- 32BFFB6222EACC660003B53F /* Main.storyboard in Resources */,
326ED2EF232D7A0000A41337 /* 6502_functional_test.bin in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -314,6 +397,30 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 32C453102331F7220000EBA1 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 32C453112331F7220000EBA1 /* fail1.txt in Resources */,
+ 32C4533223335E570000EBA1 /* Main.storyboard in Resources */,
+ 32C453122331F7220000EBA1 /* Assets.xcassets in Resources */,
+ 32C453132331F7220000EBA1 /* apple.rom in Resources */,
+ 32C453152331F7220000EBA1 /* 6502_functional_test.bin in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 32C453222331FED90000EBA1 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 32C453232331FED90000EBA1 /* fail1.txt in Resources */,
+ 32C4533323335E570000EBA1 /* Main.storyboard in Resources */,
+ 32C453242331FED90000EBA1 /* Assets.xcassets in Resources */,
+ 32C453252331FED90000EBA1 /* apple.rom in Resources */,
+ 32C453272331FED90000EBA1 /* 6502_functional_test.bin in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -323,6 +430,7 @@
files = (
32439F8722ECD8AD0077AAE0 /* 6502.c in Sources */,
32BFFB5D22EACC630003B53F /* ViewController.swift in Sources */,
+ 32C4532E233345430000EBA1 /* QuietView.swift in Sources */,
32BFFB5B22EACC630003B53F /* AppDelegate.swift in Sources */,
32C45306232E3EEF0000EBA1 /* RepeatingTimer.swift in Sources */,
);
@@ -344,6 +452,30 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 32C4530A2331F7220000EBA1 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 32C4530B2331F7220000EBA1 /* 6502.c in Sources */,
+ 32C4530C2331F7220000EBA1 /* ViewController.swift in Sources */,
+ 32C4532F233345820000EBA1 /* QuietView.swift in Sources */,
+ 32C4530D2331F7220000EBA1 /* AppDelegate.swift in Sources */,
+ 32C4530E2331F7220000EBA1 /* RepeatingTimer.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 32C4531C2331FED90000EBA1 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 32C4531D2331FED90000EBA1 /* 6502.c in Sources */,
+ 32C4531E2331FED90000EBA1 /* ViewController.swift in Sources */,
+ 32C45330233345820000EBA1 /* QuietView.swift in Sources */,
+ 32C4531F2331FED90000EBA1 /* AppDelegate.swift in Sources */,
+ 32C453202331FED90000EBA1 /* RepeatingTimer.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
@@ -501,8 +633,8 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
- OTHER_CFLAGS = "-DFUNCTIONTEST";
- OTHER_SWIFT_FLAGS = "-DFUNCTIONTEST";
+ OTHER_CFLAGS = "";
+ OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.gamealloy.A2Mac;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
@@ -618,6 +750,107 @@
};
name = Release;
};
+ 32C453172331F7220000EBA1 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CODE_SIGN_ENTITLEMENTS = A2Mac/A2Mac.entitlements;
+ CODE_SIGN_STYLE = Automatic;
+ COMBINE_HIDPI_IMAGES = YES;
+ DEVELOPMENT_TEAM = W6TFQTZ4DA;
+ GCC_FAST_MATH = YES;
+ INFOPLIST_FILE = "A2Mac copy-Info.plist";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/../Frameworks",
+ );
+ OTHER_CFLAGS = "-DFUNCTIONTEST";
+ OTHER_SWIFT_FLAGS = "-DFUNCTIONTEST";
+ PRODUCT_BUNDLE_IDENTIFIER = com.gamealloy.A2Mac;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
+ SWIFT_OBJC_BRIDGING_HEADER = "A2Mac/A2Mac-Bridging-Header.h";
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 5.0;
+ };
+ name = Debug;
+ };
+ 32C453182331F7220000EBA1 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CODE_SIGN_ENTITLEMENTS = A2Mac/A2Mac.entitlements;
+ CODE_SIGN_STYLE = Automatic;
+ COMBINE_HIDPI_IMAGES = YES;
+ DEVELOPMENT_TEAM = W6TFQTZ4DA;
+ GCC_FAST_MATH = YES;
+ GCC_OPTIMIZATION_LEVEL = fast;
+ INFOPLIST_FILE = "A2Mac copy-Info.plist";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/../Frameworks",
+ );
+ OTHER_CFLAGS = "-DSPEEDTEST";
+ OTHER_SWIFT_FLAGS = "-DSPEEDTEST";
+ PRODUCT_BUNDLE_IDENTIFIER = com.gamealloy.A2Mac;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = "A2Mac/A2Mac-Bridging-Header.h";
+ SWIFT_VERSION = 5.0;
+ };
+ name = Release;
+ };
+ 32C453292331FED90000EBA1 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CODE_SIGN_ENTITLEMENTS = A2Mac/A2Mac.entitlements;
+ CODE_SIGN_STYLE = Automatic;
+ COMBINE_HIDPI_IMAGES = YES;
+ DEVELOPMENT_TEAM = W6TFQTZ4DA;
+ GCC_FAST_MATH = YES;
+ INFOPLIST_FILE = "A2Mac copy2-Info.plist";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/../Frameworks",
+ );
+ OTHER_CFLAGS = "-DFUNCTIONTEST";
+ OTHER_SWIFT_FLAGS = "-DFUNCTIONTEST";
+ PRODUCT_BUNDLE_IDENTIFIER = com.gamealloy.A2Mac;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
+ SWIFT_OBJC_BRIDGING_HEADER = "A2Mac/A2Mac-Bridging-Header.h";
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 5.0;
+ };
+ name = Debug;
+ };
+ 32C4532A2331FED90000EBA1 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CODE_SIGN_ENTITLEMENTS = A2Mac/A2Mac.entitlements;
+ CODE_SIGN_STYLE = Automatic;
+ COMBINE_HIDPI_IMAGES = YES;
+ DEVELOPMENT_TEAM = W6TFQTZ4DA;
+ GCC_FAST_MATH = YES;
+ GCC_OPTIMIZATION_LEVEL = fast;
+ INFOPLIST_FILE = "A2Mac copy2-Info.plist";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/../Frameworks",
+ );
+ OTHER_CFLAGS = "";
+ PRODUCT_BUNDLE_IDENTIFIER = com.gamealloy.A2Mac;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = "A2Mac/A2Mac-Bridging-Header.h";
+ SWIFT_VERSION = 5.0;
+ };
+ name = Release;
+ };
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -657,6 +890,24 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
+ 32C453162331F7220000EBA1 /* Build configuration list for PBXNativeTarget "Speedtest" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 32C453172331F7220000EBA1 /* Debug */,
+ 32C453182331F7220000EBA1 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 32C453282331FED90000EBA1 /* Build configuration list for PBXNativeTarget "Functiontest" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 32C453292331FED90000EBA1 /* Debug */,
+ 32C4532A2331FED90000EBA1 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
/* End XCConfigurationList section */
};
rootObject = 32BFFB4F22EACC630003B53F /* Project object */;
diff --git a/A2Mac.xcodeproj/xcuserdata/trudnai.xcuserdatad/xcschemes/xcschememanagement.plist b/A2Mac.xcodeproj/xcuserdata/trudnai.xcuserdatad/xcschemes/xcschememanagement.plist
index b357688..1d88928 100644
--- a/A2Mac.xcodeproj/xcuserdata/trudnai.xcuserdatad/xcschemes/xcschememanagement.plist
+++ b/A2Mac.xcodeproj/xcuserdata/trudnai.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -14,6 +14,16 @@
orderHint
1
+ Function Test.xcscheme
+
+ orderHint
+ 2
+
+ Speedtest.xcscheme
+
+ orderHint
+ 3
+
SuppressBuildableAutocreation
@@ -32,6 +42,16 @@
primary
+ 32C453092331F7220000EBA1
+
+ primary
+
+
+ 32C4531B2331FED90000EBA1
+
+ primary
+
+
diff --git a/A2Mac/6502.c b/A2Mac/6502.c
index 95ac9d6..f9eedc2 100644
--- a/A2Mac/6502.c
+++ b/A2Mac/6502.c
@@ -7,7 +7,6 @@
//
#define CLK_WAIT
-#define NO_SPEED_TEST
#include
#include
@@ -30,6 +29,24 @@
#define RESET_VECTOR 0xFFFC
#define IRQ_VECTOR 0xFFFE
+const unsigned long long int iterations = 100*G;
+unsigned long long int inst_cnt = 0;
+
+const unsigned int fps = 30;
+const unsigned int MHz_6502 = 1.023 * M; // 2 * M; // 4 * M; // 8 * M; // 16 * M; // 128 * M; // 256 * M; // 512 * M;
+const unsigned int clk_6502_per_frm = MHz_6502 / fps;
+
+unsigned long long tick_per_sec = G;
+unsigned long long tick_6502_per_sec = 0;
+
+INLINE unsigned long long rdtsc(void)
+{
+ unsigned hi, lo;
+ __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi) );
+ return ( (unsigned long long)lo) | ( ((unsigned long long)hi) << 32 );
+}
+
+
/**
Instruction Implementations
@@ -47,8 +64,31 @@ m6502_t m6502 = { 0, 0, 0, 0, 0, 0, 0, HLT };
INLINE int m6502_Step() {
-
+
#ifdef DEBUG
+ switch ( m6502.PC ) {
+ case 0xE000:
+ dbgPrintf("START...\n");
+ break;
+
+ case 0xF168:
+ dbgPrintf("START...\n");
+ break;
+
+ case 0xF16B:
+ dbgPrintf("START...\n");
+ break;
+
+ case 0xF195: // RAM size init
+ dbgPrintf("START...\n");
+ break;
+
+ default:
+ break;
+ }
+#endif
+
+#ifdef FUNCTIONTEST
switch ( m6502.PC ) {
case 0x400:
dbgPrintf("START...\n");
@@ -494,30 +534,13 @@ INLINE int m6502_Step() {
default:
printf("%04X: Unimplemented Instruction 0x%02X\n", m6502.PC -1, memread( m6502.PC -1 ));
- break;
+ return 2;
}
// } // fetch16
return 4;
}
-const unsigned long long int iterations = G;
-unsigned long long int inst_cnt = 0;
-
-const unsigned int fps = 30;
-const unsigned int MHz_6502 = 1.023 * M;
-const unsigned int clk_6502_per_frm = MHz_6502 / fps;
-
-unsigned long long tick_per_sec = G;
-unsigned long long tick_6502_per_sec = 0;
-
-INLINE unsigned long long rdtsc(void)
-{
- unsigned hi, lo;
- __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi) );
- return ( (unsigned long long)lo) | ( ((unsigned long long)hi) << 32 );
-}
-
unsigned long long ee = 0;
unsigned long long dd = 0;
@@ -533,11 +556,11 @@ void m6502_Run() {
unsigned int clkfrm = 0;
// init time
-#ifdef CLK_WAIT
- unsigned long long elpased = (unsigned long long)-1LL;
-#endif
+//#ifdef CLK_WAIT
+// unsigned long long elpased = (unsigned long long)-1LL;
+//#endif
-#ifdef SPEED_TEST
+#ifdef SPEEDTEST
for ( unsigned long long int i = 0; i < iterations ; i++ )
#elif defined( CLK_WAIT )
for ( clkfrm = 0; clkfrm < clk_6502_per_frm ; clkfrm += clk )
@@ -594,7 +617,7 @@ void m6502_Run() {
// dd /= 2;
// get the new time in ticks needed to simulate exact 6502 clock
- elpased = tick_6502_per_sec * clktime;
+ // elpased = tick_6502_per_sec * clktime;
// query time + wait
@@ -631,8 +654,9 @@ void m6502_Reset() {
tick_per_sec = e - epoch;
tick_6502_per_sec = tick_per_sec / MHz_6502;
- memset( RAM, 0, sizeof(RAM) );
-
+ memset( RAM, 0xFF, sizeof(RAM) );
+ memset( RAM + 0xC000, 0, 0x1000 ); // I/O area should be 0
+
m6502.A = m6502.X = m6502.Y = 0xFF;
// reset vector
m6502.SP = 0xFF -3;
@@ -644,7 +668,7 @@ void m6502_Reset() {
m6502.IF = 0;
// memory size
- *((uint16_t*)(&RAM[0x73])) = 0xC000;
+// *((uint16_t*)(&RAM[0x73])) = 0xC000;
#ifdef FUNCTIONTEST
FILE * f = fopen("/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/6502_functional_test.bin", "rb");
@@ -659,7 +683,7 @@ void m6502_Reset() {
m6502.PC = 0x400;
#else
- FILE * f = fopen("/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/apple.rom", "rb");
+ FILE * f = fopen("/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/Apple2Plus.rom", "rb");
if (f == NULL) {
perror("Failed: ");
return;
@@ -789,13 +813,13 @@ void tst6502() {
m6502_Run();
// clock_t end = clock();
// double execution_time = ((double) (end - start)) / CLOCKS_PER_SEC;
- unsigned long long e = rdtsc();
- unsigned long long t = e - epoch;
- double execution_time = (double)t / tick_per_sec;
+ unsigned long long end = rdtsc();
+ unsigned long long elapsed = end - epoch;
+ double execution_time = (double)elapsed / tick_per_sec;
double mips = inst_cnt / (execution_time * M);
double mhz = clktime / (execution_time * M);
- printf("clk:%llu Elpased time: (%llu / %llu / %llu), %.3lfs (%.3lf MIPS, %.3lf MHz)\n", clktime, tick_per_sec, MHz_6502, tick_6502_per_sec, execution_time, mips, mhz);
+ printf("clk:%llu Elpased time: (%llu / %u / %llu), %.3lfs (%.3lf MIPS, %.3lf MHz)\n", clktime, tick_per_sec, MHz_6502, tick_6502_per_sec, execution_time, mips, mhz);
// printf(" dd:%llu ee:%llu nn:%llu\n", dd, ee, ee - dd);
}
diff --git a/A2Mac/6502.h b/A2Mac/6502.h
index 1f537be..11a7ec4 100644
--- a/A2Mac/6502.h
+++ b/A2Mac/6502.h
@@ -12,7 +12,7 @@
#import "stdint.h"
#ifdef DEBUG
-#define dbgPrintf(format, ...)
+#define dbgPrintf(format, ...) printf (format, ## __VA_ARGS__)
#define dbgPrintf2(format, ...) printf (format, ## __VA_ARGS__)
#else
#define dbgPrintf(format, ...)
diff --git a/A2Mac/Apple2_mmio.h b/A2Mac/Apple2_mmio.h
index 2740334..075bb0f 100644
--- a/A2Mac/Apple2_mmio.h
+++ b/A2Mac/Apple2_mmio.h
@@ -325,7 +325,13 @@ INLINE uint8_t src_ind_Y() {
return memread8( addr_ind_Y() );
}
INLINE uint8_t * dest_ind_Y() {
- return & RAM[ addr_ind_Y() ];
+ uint16_t addr = addr_ind_Y();
+ if ( (addr >= 0xC000) && (addr <= 0xC0FF) ) {
+ addr = 0xC111;
+ }
+ // return & RAM[ addr_abs_Y() ];
+ return & RAM[ addr ];
+// return & RAM[ addr_ind_Y() ];
}
/**
diff --git a/A2Mac/Base.lproj/Main.storyboard b/A2Mac/Base.lproj/Main.storyboard
index d9a6173..a3eefdb 100644
--- a/A2Mac/Base.lproj/Main.storyboard
+++ b/A2Mac/Base.lproj/Main.storyboard
@@ -678,15 +678,15 @@
-
+
-
+
-
+
@@ -698,30 +698,68 @@
-
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+ NSAllRomanInputSourcesLocaleIdentifier
+
+
+
+
+
-
-
+
+
-
-
+
+
+ 1234567890123456789012345678901234567890
+@@@@@@@@@1@@@@@@@@@2@@@@@@@@@3@@@@@@@@@4
+@@@@@@@@@@@@@@@@@@@3@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@4@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@5@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@6@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@7@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@8@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@9@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@10@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@11@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@12@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@13@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@14@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@15@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@16@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@17@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@18@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@19@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@20@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@21@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@22@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@23@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@24@@@@@@@@@@@@@@@@@@@@
-
+
+
+ NSAllRomanInputSourcesLocaleIdentifier
+
-
+
@@ -760,22 +798,25 @@
+
-
-
-
+
+
-
-
-
-
+
+
+
+
+
+
-
+
+
@@ -783,5 +824,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/A2Mac/NSLayoutManager-Extension.swift b/A2Mac/NSLayoutManager-Extension.swift
new file mode 100644
index 0000000..495288e
--- /dev/null
+++ b/A2Mac/NSLayoutManager-Extension.swift
@@ -0,0 +1,70 @@
+//
+// NSLayoutManager-Extension.swift
+// A2Mac
+//
+// Created by Tamas Rudnai on 9/17/19.
+// Copyright © 2019 GameAlloy. All rights reserved.
+//
+
+import Foundation
+import Cocoa
+import AppKit
+
+class LayoutManager : NSLayoutManager {
+
+ var text: String? { return textStorage?.string }
+
+ var font: NSFont = NSFont.systemFont(ofSize: NSFont.systemFontSize) {
+ didSet {
+ guard let text = self.text else { return }
+ let textRange = NSMakeRange(0, (text as NSString).length)
+ invalidateGlyphs(forCharacterRange: textRange, changeInLength: 0, actualCharacterRange: nil)
+ invalidateLayout(forCharacterRange: textRange, actualCharacterRange: nil)
+ }
+ }
+
+ override func drawBackground(forGlyphRange glyphsToShow: NSRange, at origin: CGPoint) {
+
+ super.drawBackground(forGlyphRange: glyphsToShow, at:origin)
+
+ guard let text = self.text else { return }
+
+ enumerateLineFragments(forGlyphRange: glyphsToShow)
+ { (rect: CGRect, usedRect: CGRect, textContainer: NSTextContainer, glyphRange: NSRange, stop: UnsafeMutablePointer) -> Void in
+
+ let characterRange = self.characterRange(forGlyphRange: glyphRange, actualGlyphRange: nil)
+
+ // Draw invisible tab space characters
+
+ let line = (self.text! as NSString).substring(with: characterRange)
+
+ do {
+
+ let expr = try NSRegularExpression(pattern: "\t", options: [])
+
+ expr.enumerateMatches(in: line, options: [.reportProgress], range: NSRange(location: 0, length: line.count))
+ { (result: NSTextCheckingResult?, flags: NSRegularExpression.MatchingFlags, stop: UnsafeMutablePointer) in
+
+ if let result = result {
+
+ let range = NSMakeRange(result.range.location + characterRange.location, result.range.length)
+ let characterRect = self.boundingRect(forGlyphRange: range, in: textContainer)
+
+ let symbol = "\u{21E5}"
+ let attrs = [NSAttributedString.Key.font : self.font]
+ let height = (symbol as NSString).size(withAttributes: attrs).height
+ symbol.draw(in: characterRect.offsetBy(dx: 1.0, dy: height * 0.5), withAttributes: attrs)
+
+ }
+
+ }
+
+ } catch let error as NSError {
+ print(error.localizedDescription)
+ }
+
+ }
+
+ }
+
+}
diff --git a/A2Mac/QuietView.swift b/A2Mac/QuietView.swift
new file mode 100644
index 0000000..3af0305
--- /dev/null
+++ b/A2Mac/QuietView.swift
@@ -0,0 +1,15 @@
+//
+// View.swift
+// A2Mac
+//
+// Created by Tamas Rudnai on 9/18/19.
+// Copyright © 2019 GameAlloy. All rights reserved.
+//
+
+import Cocoa
+
+class QuietView: NSView {
+ override func performKeyEquivalent(with event: NSEvent) -> Bool {
+ return true
+ }
+}
diff --git a/A2Mac/ViewController.swift b/A2Mac/ViewController.swift
index 46f3dd4..4264883 100644
--- a/A2Mac/ViewController.swift
+++ b/A2Mac/ViewController.swift
@@ -10,6 +10,7 @@ import Cocoa
class ViewController: NSViewController {
+ @IBOutlet weak var displayField: NSTextField!
@IBOutlet weak var display: NSTextFieldCell!
@IBOutlet weak var speedometer: NSTextFieldCell!
@@ -19,13 +20,31 @@ class ViewController: NSViewController {
// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ !\"#$%&'()*+,-./0123456789:;<=>?" +
// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~?"
- static let charConvStr : String =
- "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ !\"#$%&'()*+,-./0123456789:;<=>?" +
- "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_░!\"#$%&'()*+,-./0123456789:;<=>?" + // FL
- "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ !\"#$%&'()*+,-./0123456789:;<=>?" +
- "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~?"
+// static let charConvStr : String =
+// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ !\"#$%&'()*+,-./0123456789:;<=>?" +
+// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_░!\"#$%&'()*+,-./0123456789:;<=>?" + // FL
+// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\u{E0A0}!\"#$%&'()*+,-./0123456789:;<=>?" +
+// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~?"
- static let charConvTbl = Array( charConvStr )
+// static let charConvStr : String =
+// "\u{E140}\u{E141}\u{E142}\u{E143}\u{E144}\u{E145}\u{E146}\u{E147}\u{E148}\u{E149}\u{E14A}\u{E14B}\u{E14C}\u{E14D}\u{E14E}\u{E14F}\u{E150}\u{E151}\u{E152}\u{E153}\u{E154}\u{E155}\u{E156}\u{E157}\u{E158}\u{E159}\u{E15A}\u{E15B}\u{E15C}\u{E15D}\u{E15E}\u{E15F}\u{E120}\u{E121}\u{E122}\u{E123}\u{E124}\u{E125}\u{E126}\u{E127}\u{E128}\u{E129}\u{E12A}\u{E12B}\u{E12C}\u{E12D}\u{E12E}\u{E12F}\u{E130}\u{E131}\u{E132}\u{E133}\u{E134}\u{E135}\u{E136}\u{E137}\u{E138}\u{E139}\u{E13A}\u{E13B}\u{E13C}\u{E13D}\u{E13E}\u{E13F}" +
+// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_░!\"#$%&'()*+,-./0123456789:;<=>?" + // FL
+// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\u{E0A0}!\"#$%&'()*+,-./0123456789:;<=>?" +
+// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~?"
+
+ static let charConvStrFlashOff : String =
+ "\u{E140}\u{E141}\u{E142}\u{E143}\u{E144}\u{E145}\u{E146}\u{E147}\u{E148}\u{E149}\u{E14A}\u{E14B}\u{E14C}\u{E14D}\u{E14E}\u{E14F}\u{E150}\u{E151}\u{E152}\u{E153}\u{E154}\u{E155}\u{E156}\u{E157}\u{E158}\u{E159}\u{E15A}\u{E15B}\u{E15C}\u{E15D}\u{E15E}\u{E15F}\u{E120}\u{E121}\u{E122}\u{E123}\u{E124}\u{E125}\u{E126}\u{E127}\u{E128}\u{E129}\u{E12A}\u{E12B}\u{E12C}\u{E12D}\u{E12E}\u{E12F}\u{E130}\u{E131}\u{E132}\u{E133}\u{E134}\u{E135}\u{E136}\u{E137}\u{E138}\u{E139}\u{E13A}\u{E13B}\u{E13C}\u{E13D}\u{E13E}\u{E13F}" +
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ !\"#$%&'()*+,-./0123456789:;<=>?" + // FL
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\u{E0A0}!\"#$%&'()*+,-./0123456789:;<=>?" +
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~?"
+
+ static let charConvStrFlashOn : String =
+ "\u{E140}\u{E141}\u{E142}\u{E143}\u{E144}\u{E145}\u{E146}\u{E147}\u{E148}\u{E149}\u{E14A}\u{E14B}\u{E14C}\u{E14D}\u{E14E}\u{E14F}\u{E150}\u{E151}\u{E152}\u{E153}\u{E154}\u{E155}\u{E156}\u{E157}\u{E158}\u{E159}\u{E15A}\u{E15B}\u{E15C}\u{E15D}\u{E15E}\u{E15F}\u{E120}\u{E121}\u{E122}\u{E123}\u{E124}\u{E125}\u{E126}\u{E127}\u{E128}\u{E129}\u{E12A}\u{E12B}\u{E12C}\u{E12D}\u{E12E}\u{E12F}\u{E130}\u{E131}\u{E132}\u{E133}\u{E134}\u{E135}\u{E136}\u{E137}\u{E138}\u{E139}\u{E13A}\u{E13B}\u{E13C}\u{E13D}\u{E13E}\u{E13F}" +
+ "\u{E140}\u{E141}\u{E142}\u{E143}\u{E144}\u{E145}\u{E146}\u{E147}\u{E148}\u{E149}\u{E14A}\u{E14B}\u{E14C}\u{E14D}\u{E14E}\u{E14F}\u{E150}\u{E151}\u{E152}\u{E153}\u{E154}\u{E155}\u{E156}\u{E157}\u{E158}\u{E159}\u{E15A}\u{E15B}\u{E15C}\u{E15D}\u{E15E}\u{E15F}\u{E120}\u{E121}\u{E122}\u{E123}\u{E124}\u{E125}\u{E126}\u{E127}\u{E128}\u{E129}\u{E12A}\u{E12B}\u{E12C}\u{E12D}\u{E12E}\u{E12F}\u{E130}\u{E131}\u{E132}\u{E133}\u{E134}\u{E135}\u{E136}\u{E137}\u{E138}\u{E139}\u{E13A}\u{E13B}\u{E13C}\u{E13D}\u{E13E}\u{E13F}" +
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\u{E0A0}!\"#$%&'()*+,-./0123456789:;<=>?" +
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~?"
+
+ static var charConvTbl = Array( charConvStrFlashOff )
let textLineOfs : [Int] = [
0x000, 0x080, 0x100, 0x180, 0x200, 0x280, 0x300, 0x380, 0x028, 0x0A8, 0x128, 0x1A8,
@@ -34,22 +53,24 @@ class ViewController: NSViewController {
var workItem : DispatchWorkItem? = nil;
@IBAction func Power(_ sender: Any) {
-// if ( workItem != nil ) {
-// workItem!.cancel();
-// workItem = nil;
-// }
-// else {
-// workItem = DispatchWorkItem {
-// DispatchQueue.global(qos: .userInteractive).async {
-//// DispatchQueue.global(qos: .userInitiated).async {
-//// DispatchQueue.global(qos: .background).async {
-// tst6502()
-// }
-// }
-// DispatchQueue.global().async(execute: workItem!);
-// }
-
+ #if SPEEDTEST
+ if ( workItem != nil ) {
+ workItem!.cancel();
+ workItem = nil;
+ }
+ else {
+ workItem = DispatchWorkItem {
+ DispatchQueue.global(qos: .userInteractive).async {
+// DispatchQueue.global(qos: .userInitiated).async {
+// DispatchQueue.global(qos: .background).async {
+ tst6502()
+ }
+ }
+ DispatchQueue.global().async(execute: workItem!);
+ }
+ #else
m6502_Reset()
+ #endif
}
@IBAction func Reset(_ sender: Any) {
@@ -140,49 +161,85 @@ class ViewController: NSViewController {
}
- let textBaseAddr = 0x400
- let textBufferSize = 0x400
+ static let textBaseAddr = 0x400
+ static let textBufferSize = 0x400
let textLines = 24
let textCols = 40
+ let lineEndChars = 1
var frameCnt = 0
+// let spaceChar : Character = "\u{E17F}"
+// let blockChar : Character = "\u{E07F}"
let spaceChar : Character = " "
let blockChar : Character = "░"
var flashingSpace : Character = " "
- let textBufferPointer = UnsafeRawBufferPointer(start: &RAM + 0x400, count: 0x400)
- var txtArr = [Character](repeating: " ", count: 0x400)
+ let ramBufferPointer = UnsafeRawBufferPointer(start: &RAM, count: 64 * 1024)
+ let textBufferPointer = UnsafeRawBufferPointer(start: &RAM + textBaseAddr, count: textBufferSize)
+ var txtArr = [Character](repeating: " ", count: textBufferSize)
var s = String()
- func Update() {
+ func HexDump() {
+ var txt : String = ""
+ for y in 0...textLines - 1 {
+ txt += String(format: "%04X: ", y * 16)
+ for x in 0...15 {
+ let byte = ramBufferPointer[ y * 16 + x ]
+ let chr = String(format: "%02X ", byte)
+ txt += chr
+ }
+ txt += "\n"
+ }
+
+ DispatchQueue.main.async {
+ self.display.stringValue = txt;
+ self.speedometer.stringValue = String(format: "%0.3lf MHz", mhz);
+ }
+ }
+
+ func Update() {
+
+ #if SPEEDTEST
+ #else
m6502_Run()
+ #endif
+
+// HexDump()
+// return
frameCnt += 1
if ( frameCnt == 15 ) {
- flashingSpace = blockChar
+// flashingSpace = blockChar
+ ViewController.charConvTbl = Array( ViewController.charConvStrFlashOn )
}
else if ( frameCnt >= 30 ) {
- flashingSpace = spaceChar
+// flashingSpace = spaceChar
+ ViewController.charConvTbl = Array( ViewController.charConvStrFlashOff )
frameCnt = 0
}
var txt : String = ""
-
+
for y in 0...textLines-1 {
// let textAddr = textBaseAddr + textLineOfs[y]
+
+// let linePointer = UnsafeMutableRawPointer( mutating: &RAM + textBaseAddr + y * textCols ) //( start: &RAM + 0x400, count: 0x400)
+// let lineStr = String(bytesNoCopy: linePointer, length: textCols, encoding: .ascii, freeWhenDone: false)!
+// txt += lineStr + "\n"
+
for x in 0...textCols-1 {
let byte = textBufferPointer[ textLineOfs[y] + x ]
let idx = Int(byte);
- var chr = ViewController.charConvTbl[idx]
+ let chr = ViewController.charConvTbl[idx]
// is it a cursor? (slashing space)
- if ( chr == blockChar ) {
- chr = flashingSpace
- }
+// if ( chr == "blockChar" ) {
+// chr = flashingSpace
+// }
// print("byte \(index): \(chr)")
// txt = txt + "\(chr)"
- txtArr[ y * (textCols+1) + x ] = chr
+ txtArr[ y * (textCols + lineEndChars) + x ] = chr
}
@@ -198,7 +255,7 @@ class ViewController: NSViewController {
// }
// txt = txt + "\n"
- txtArr[ y * (textCols+1) + textCols ] = "\n"
+ txtArr[ y * (textCols + lineEndChars) + textCols ] = "\n"
}
// txtArr[ textLines * (textCols+1) + textCols ] = "\0"
txt = String(txtArr)
@@ -225,6 +282,18 @@ class ViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
+
+ NSEvent.addLocalMonitorForEvents(matching: .flagsChanged) {
+ self.flagsChanged(with: $0)
+ return $0
+ }
+ NSEvent.addLocalMonitorForEvents(matching: .keyDown) {
+ self.keyDown(with: $0)
+ return $0
+ }
+
+ displayField.maximumNumberOfLines = textLines
+ displayField.preferredMaxLayoutWidth = displayField.frame.width
// DispatchQueue.main.asyncAfter(deadline: .now() + 1/30, execute: {
// self.update()
diff --git a/A2Mac/instructions/6502_instr_arithmetic.h b/A2Mac/instructions/6502_instr_arithmetic.h
index 849fd77..27fdc0a 100644
--- a/A2Mac/instructions/6502_instr_arithmetic.h
+++ b/A2Mac/instructions/6502_instr_arithmetic.h
@@ -118,7 +118,6 @@ INLINE void SBC( uint8_t src ) {
}
m6502.C = tmp < 0x100;
-
m6502.V = ( (m6502.A ^ tmp) & 0x80 ) && ( (m6502.A ^ src) & 0x80 );
set_flags_NZ( m6502.A = tmp );
}
diff --git a/A2Mac/instructions/6502_instr_misc.h b/A2Mac/instructions/6502_instr_misc.h
index ae82b14..7f4d3ee 100644
--- a/A2Mac/instructions/6502_instr_misc.h
+++ b/A2Mac/instructions/6502_instr_misc.h
@@ -23,6 +23,8 @@
INLINE void BRK() {
dbgPrintf("BRK ");
PUSH_addr(m6502.PC +1); // PC +2, however, fetch already incremented it by 1
+ // B flag should be set before pushing flags onto the stack
+ m6502.B = 1;
PUSH(m6502.SR);
m6502.I = 1;
JMP(memread16(IRQ_VECTOR));