- Apple ][ Font

- Inverse characters
- Flashing characters
- Boot - RAM size detection bug fixed
- Frame around Text Field
- Fixed BRK
- Debug Target
- Speed Test target
This commit is contained in:
Tamas Rudnai 2019-09-19 02:27:56 -07:00
parent fe5f30114d
commit 8f914756eb
13 changed files with 677 additions and 99 deletions

34
A2Mac copy-Info.plist Normal file
View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.education</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2019 GameAlloy. All rights reserved.</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

34
A2Mac copy2-Info.plist Normal file
View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.education</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2019 GameAlloy. All rights reserved.</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View File

@ -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 = "<group>"; };
32BFFB7A22EACC660003B53F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
32C45305232E3EEF0000EBA1 /* RepeatingTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RepeatingTimer.swift; sourceTree = "<group>"; };
32C453072331C0910000EBA1 /* NSLayoutManager-Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSLayoutManager-Extension.swift"; sourceTree = "<group>"; };
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 = "<absolute>"; };
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 = "<absolute>"; };
32C4532D233345420000EBA1 /* QuietView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuietView.swift; sourceTree = "<group>"; };
32EDB7A123272CA80073AF2D /* fail1.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = fail1.txt; sourceTree = "<group>"; };
/* 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 = "<group>";
};
@ -141,6 +184,8 @@
32BFFB5722EACC630003B53F /* A2Mac.app */,
32BFFB6922EACC660003B53F /* A2MacTests.xctest */,
32BFFB7422EACC660003B53F /* A2MacUITests.xctest */,
32C453192331F7220000EBA1 /* Speedtest.app */,
32C4532B2331FED90000EBA1 /* Functiontest.app */,
);
name = Products;
sourceTree = "<group>";
@ -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 */;

View File

@ -14,6 +14,16 @@
<key>orderHint</key>
<integer>1</integer>
</dict>
<key>Function Test.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
</dict>
<key>Speedtest.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
@ -32,6 +42,16 @@
<key>primary</key>
<true/>
</dict>
<key>32C453092331F7220000EBA1</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>32C4531B2331FED90000EBA1</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

View File

@ -7,7 +7,6 @@
//
#define CLK_WAIT
#define NO_SPEED_TEST
#include <stdio.h>
#include <unistd.h>
@ -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);
}

View File

@ -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, ...)

View File

@ -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() ];
}
/**

View File

@ -678,15 +678,15 @@
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="0.0"/>
<point key="canvasLocation" x="118" y="-190"/>
</scene>
<!--Window Controller-->
<scene sceneID="R2V-B0-nI4">
<objects>
<windowController id="B8D-0N-5wS" sceneMemberID="viewController">
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
<window key="window" title="Apple ][ Emulator" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<rect key="contentRect" x="196" y="240" width="810" height="440"/>
<rect key="contentRect" x="196" y="240" width="720" height="420"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<connections>
<outlet property="delegate" destination="B8D-0N-5wS" id="98r-iN-zZc"/>
@ -698,30 +698,68 @@
</windowController>
<customObject id="Oky-zY-oP4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="250"/>
<point key="canvasLocation" x="11" y="120"/>
</scene>
<!--View Controller-->
<scene sceneID="hIz-AP-VOD">
<objects>
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModule="A2Mac" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="m2S-Jp-Qdl">
<rect key="frame" x="0.0" y="0.0" width="810" height="440"/>
<view key="view" id="m2S-Jp-Qdl" customClass="QuietView" customModule="A2Mac" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="680" height="400"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Uza-t6-XSw">
<rect key="frame" x="10" y="10" width="700" height="420"/>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" mirrorLayoutDirectionWhenInternationalizing="never" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iIF-Q5-Onc">
<rect key="frame" x="0.0" y="0.0" width="584" height="400"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" enabled="NO" allowsUndo="NO" sendsActionOnEndEditing="YES" state="on" baseWritingDirection="leftToRight" drawsBackground="YES" id="cIa-Sd-4OZ">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" red="0.12549019610000001" green="0.18039215689999999" blue="0.12549019610000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<allowedInputSourceLocales>
<string>NSAllRomanInputSourcesLocaleIdentifier</string>
</allowedInputSourceLocales>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" mirrorLayoutDirectionWhenInternationalizing="never" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SEL-hl-0c0">
<rect key="frame" x="6" y="8" width="572" height="384"/>
<constraints>
<constraint firstAttribute="width" constant="700" id="YGY-gy-pSn"/>
<constraint firstAttribute="height" constant="420" id="dWL-EL-ab7"/>
<constraint firstAttribute="width" constant="568" id="uez-Mi-0Sh"/>
<constraint firstAttribute="height" constant="384" id="zl6-au-oZj"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" enabled="NO" allowsUndo="NO" sendsActionOnEndEditing="YES" state="on" borderStyle="border" placeholderString="Apple ][ Emulator Virtual Monitor" drawsBackground="YES" id="5AO-Gd-Lzo">
<font key="font" size="14" name="Courier-Bold"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" state="on" baseWritingDirection="leftToRight" alignment="center" id="pIk-RC-s5g">
<font key="font" size="16" name="PrintChar21"/>
<mutableString key="title">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@@@@@@@@@@@@@@@@@@@@</mutableString>
<color key="textColor" name="systemGreenColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" red="0.12549019607843137" green="0.17933968321917809" blue="0.12549019607843137" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" name="selectedTextBackgroundColor" catalog="System" colorSpace="catalog"/>
<allowedInputSourceLocales>
<string>NSAllRomanInputSourcesLocaleIdentifier</string>
</allowedInputSourceLocales>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mfd-12-bcR">
<rect key="frame" x="714" y="402" width="92" height="32"/>
<rect key="frame" x="586" y="362" width="90" height="32"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="t2i-0h-wau"/>
</constraints>
@ -734,7 +772,7 @@
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rR3-9T-NFu">
<rect key="frame" x="714" y="371" width="92" height="32"/>
<rect key="frame" x="586" y="331" width="90" height="32"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="sbX-nh-SV3"/>
</constraints>
@ -747,7 +785,7 @@
</buttonCell>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FZk-VW-alq">
<rect key="frame" x="718" y="20" width="84" height="17"/>
<rect key="frame" x="631" y="20" width="41" height="17"/>
<constraints>
<constraint firstAttribute="height" constant="17" id="ai1-6C-5tW"/>
</constraints>
@ -760,22 +798,25 @@
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="mfd-12-bcR" secondAttribute="trailing" constant="10" id="3NC-0i-OPC"/>
<constraint firstItem="mfd-12-bcR" firstAttribute="leading" secondItem="iIF-Q5-Onc" secondAttribute="trailing" constant="8" id="3ia-2r-dgK"/>
<constraint firstAttribute="trailing" secondItem="rR3-9T-NFu" secondAttribute="trailing" constant="10" id="68s-0C-BVZ"/>
<constraint firstItem="FZk-VW-alq" firstAttribute="leading" secondItem="Uza-t6-XSw" secondAttribute="trailing" constant="10" id="Aab-ZA-fW3"/>
<constraint firstItem="mfd-12-bcR" firstAttribute="leading" secondItem="Uza-t6-XSw" secondAttribute="trailing" constant="10" id="CFN-hq-O5V"/>
<constraint firstItem="Uza-t6-XSw" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" constant="10" id="Dmb-dB-rhg"/>
<constraint firstAttribute="bottom" secondItem="FZk-VW-alq" secondAttribute="bottom" constant="20" id="E2f-MY-c2Y"/>
<constraint firstItem="iIF-Q5-Onc" firstAttribute="leading" secondItem="m2S-Jp-Qdl" secondAttribute="leading" id="LGA-tZ-gFh"/>
<constraint firstItem="rR3-9T-NFu" firstAttribute="leading" secondItem="iIF-Q5-Onc" secondAttribute="trailing" constant="8" id="ON4-IE-HmP"/>
<constraint firstAttribute="trailing" secondItem="FZk-VW-alq" secondAttribute="trailing" constant="10" id="Q0s-uC-GPT"/>
<constraint firstAttribute="trailing" secondItem="Uza-t6-XSw" secondAttribute="trailing" constant="100" id="UBG-e6-psp"/>
<constraint firstAttribute="bottom" secondItem="Uza-t6-XSw" secondAttribute="bottom" constant="10" id="agC-TV-DPy"/>
<constraint firstItem="Uza-t6-XSw" firstAttribute="leading" secondItem="m2S-Jp-Qdl" secondAttribute="leading" constant="10" id="kDF-dq-M0E"/>
<constraint firstItem="rR3-9T-NFu" firstAttribute="leading" secondItem="Uza-t6-XSw" secondAttribute="trailing" constant="10" id="kOZ-D6-JaQ"/>
<constraint firstItem="SEL-hl-0c0" firstAttribute="bottom" secondItem="iIF-Q5-Onc" secondAttribute="bottom" constant="-8" id="Q2B-a3-gBp"/>
<constraint firstItem="SEL-hl-0c0" firstAttribute="leading" secondItem="iIF-Q5-Onc" secondAttribute="leading" constant="8" id="QGx-a9-RR9"/>
<constraint firstItem="SEL-hl-0c0" firstAttribute="top" secondItem="iIF-Q5-Onc" secondAttribute="top" constant="8" id="aWz-Ad-PIM"/>
<constraint firstAttribute="bottom" secondItem="iIF-Q5-Onc" secondAttribute="bottom" id="acb-Dy-fu5"/>
<constraint firstItem="SEL-hl-0c0" firstAttribute="trailing" secondItem="iIF-Q5-Onc" secondAttribute="trailing" constant="-8" id="cmY-Vb-ckJ"/>
<constraint firstItem="iIF-Q5-Onc" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" id="m3e-ww-N7S"/>
<constraint firstItem="rR3-9T-NFu" firstAttribute="top" secondItem="mfd-12-bcR" secondAttribute="bottom" constant="10" id="ycb-iY-X4I"/>
<constraint firstItem="mfd-12-bcR" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" constant="10" id="zDl-Cs-xmz"/>
</constraints>
</view>
<connections>
<outlet property="display" destination="5AO-Gd-Lzo" id="Khc-vv-2HB"/>
<outlet property="display" destination="pIk-RC-s5g" id="Hvd-DI-h6z"/>
<outlet property="displayField" destination="SEL-hl-0c0" id="4Pc-hG-qQf"/>
<outlet property="speedometer" destination="FBZ-dh-6Fs" id="L0v-RY-xwB"/>
</connections>
</viewController>
@ -783,5 +824,18 @@
</objects>
<point key="canvasLocation" x="75" y="655"/>
</scene>
<!--View Controller-->
<scene sceneID="3mD-p5-bXf">
<objects>
<viewController id="0dI-nD-R6h" sceneMemberID="viewController">
<view key="view" id="9P3-wv-TR8">
<rect key="frame" x="0.0" y="0.0" width="450" height="300"/>
<autoresizingMask key="autoresizingMask"/>
</view>
</viewController>
<customObject id="PHy-ah-Fqo" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="723" y="320"/>
</scene>
</scenes>
</document>

View File

@ -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<ObjCBool>) -> 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<ObjCBool>) 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)
}
}
}
}

15
A2Mac/QuietView.swift Normal file
View File

@ -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
}
}

View File

@ -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()

View File

@ -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 );
}

View File

@ -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));