From a589be4302e8ac0e9f3f910f2ef148e17717223f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesu=CC=81s=20A=2E=20A=CC=81lvarez?= Date: Sat, 28 May 2016 19:21:22 +0200 Subject: [PATCH] add Mac II bundle with 1024x768@8-bit display --- Mini vMac.xcodeproj/project.pbxproj | 180 +++++++++++++++++++++ Mini vMac/AppDelegate.m | 3 +- Mini vMac/MYOSGLUE.m | 78 ++++++++-- Mini vMac/MacII/CNFGGLOB.h | 98 ++++++++++++ Mini vMac/MacII/CNFGRAPI.h | 33 ++++ Mini vMac/MacII/EMCONFIG.h | 232 ++++++++++++++++++++++++++++ Mini vMac/MacII/Info.plist | 28 ++++ 7 files changed, 639 insertions(+), 13 deletions(-) create mode 100644 Mini vMac/MacII/CNFGGLOB.h create mode 100644 Mini vMac/MacII/CNFGRAPI.h create mode 100644 Mini vMac/MacII/EMCONFIG.h create mode 100644 Mini vMac/MacII/Info.plist diff --git a/Mini vMac.xcodeproj/project.pbxproj b/Mini vMac.xcodeproj/project.pbxproj index 52392bd..9098150 100644 --- a/Mini vMac.xcodeproj/project.pbxproj +++ b/Mini vMac.xcodeproj/project.pbxproj @@ -25,6 +25,26 @@ 2834236D1CF9C1320088B634 /* SNDEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423531CF9C0F10088B634 /* SNDEMDEV.c */; }; 2834236E1CF9C1320088B634 /* SONYEMDV.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423551CF9C0F10088B634 /* SONYEMDV.c */; }; 2834236F1CF9C1320088B634 /* VIAEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 2834235B1CF9C0F10088B634 /* VIAEMDEV.c */; }; + 283423861CF9C4CB0088B634 /* Emulator.m in Sources */ = {isa = PBXBuildFile; fileRef = 283422F21CF8F5400088B634 /* Emulator.m */; }; + 283423881CF9C4CB0088B634 /* MYOSGLUE.m in Sources */ = {isa = PBXBuildFile; fileRef = 28CE8ECB1CD4CDC500FE25A8 /* MYOSGLUE.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + 283423A31CF9C5880088B634 /* MacII.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 283423961CF9C4CB0088B634 /* MacII.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 283423D21CF9C66D0088B634 /* ADBEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423231CF9C0F10088B634 /* ADBEMDEV.c */; }; + 283423D31CF9C66D0088B634 /* ASCEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423271CF9C0F10088B634 /* ASCEMDEV.c */; }; + 283423D41CF9C66D0088B634 /* GLOBGLUE.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423341CF9C0F10088B634 /* GLOBGLUE.c */; }; + 283423D51CF9C66D0088B634 /* IWMEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423371CF9C0F10088B634 /* IWMEMDEV.c */; }; + 283423D61CF9C66D0088B634 /* M68KITAB.c in Sources */ = {isa = PBXBuildFile; fileRef = 2834233B1CF9C0F10088B634 /* M68KITAB.c */; }; + 283423D71CF9C66D0088B634 /* MINEM68K.c in Sources */ = {isa = PBXBuildFile; fileRef = 2834233D1CF9C0F10088B634 /* MINEM68K.c */; }; + 283423D81CF9C66D0088B634 /* MOUSEMDV.c in Sources */ = {isa = PBXBuildFile; fileRef = 2834233F1CF9C0F10088B634 /* MOUSEMDV.c */; }; + 283423D91CF9C66D0088B634 /* PROGMAIN.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423441CF9C0F10088B634 /* PROGMAIN.c */; }; + 283423DA1CF9C66D0088B634 /* ROMEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423461CF9C0F10088B634 /* ROMEMDEV.c */; }; + 283423DB1CF9C66D0088B634 /* RTCEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423481CF9C0F10088B634 /* RTCEMDEV.c */; }; + 283423DC1CF9C66D0088B634 /* SCCEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 2834234A1CF9C0F10088B634 /* SCCEMDEV.c */; }; + 283423DD1CF9C66D0088B634 /* SCRNEMDV.c in Sources */ = {isa = PBXBuildFile; fileRef = 2834234C1CF9C0F10088B634 /* SCRNEMDV.c */; }; + 283423DE1CF9C66D0088B634 /* SCSIEMDV.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423511CF9C0F10088B634 /* SCSIEMDV.c */; }; + 283423DF1CF9C66D0088B634 /* SONYEMDV.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423551CF9C0F10088B634 /* SONYEMDV.c */; }; + 283423E01CF9C66D0088B634 /* VIA2EMDV.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423591CF9C0F10088B634 /* VIA2EMDV.c */; }; + 283423E11CF9C66D0088B634 /* VIAEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 2834235B1CF9C0F10088B634 /* VIAEMDEV.c */; }; + 283423E21CF9C66D0088B634 /* VIDEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 2834235D1CF9C0F10088B634 /* VIDEMDEV.c */; }; 28848B621CDE97D600B86C45 /* InsertDiskViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28848B611CDE97D600B86C45 /* InsertDiskViewController.m */; }; 28848B651CDE97E900B86C45 /* SettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28848B641CDE97E900B86C45 /* SettingsViewController.m */; }; 28BA897E1CE7315400A98104 /* KBKey.m in Sources */ = {isa = PBXBuildFile; fileRef = 28BA89751CE7315400A98104 /* KBKey.m */; }; @@ -72,6 +92,13 @@ remoteGlobalIDString = 283422C91CF8EF8C0088B634; remoteInfo = "minivmac-plus4m"; }; + 283423A01CF9C5730088B634 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 28F676B51CD15E0B00FC6FA6 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2834237D1CF9C4CB0088B634; + remoteInfo = MacII; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -81,6 +108,7 @@ dstPath = ""; dstSubfolderSpec = 13; files = ( + 283423A31CF9C5880088B634 /* MacII.framework in Embed Frameworks */, 283422D21CF8EF8C0088B634 /* MacPlus4M.framework in Embed Frameworks */, ); name = "Embed Frameworks"; @@ -186,6 +214,11 @@ 2834235C1CF9C0F10088B634 /* VIAEMDEV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = VIAEMDEV.h; sourceTree = ""; }; 2834235D1CF9C0F10088B634 /* VIDEMDEV.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = VIDEMDEV.c; sourceTree = ""; }; 2834235E1CF9C0F10088B634 /* VIDEMDEV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = VIDEMDEV.h; sourceTree = ""; }; + 283423961CF9C4CB0088B634 /* MacII.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MacII.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 283423991CF9C5380088B634 /* CNFGGLOB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNFGGLOB.h; sourceTree = ""; }; + 2834239A1CF9C5380088B634 /* CNFGRAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNFGRAPI.h; sourceTree = ""; }; + 2834239B1CF9C5380088B634 /* EMCONFIG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EMCONFIG.h; sourceTree = ""; }; + 2834239C1CF9C5380088B634 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28848B601CDE97D600B86C45 /* InsertDiskViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InsertDiskViewController.h; sourceTree = ""; }; 28848B611CDE97D600B86C45 /* InsertDiskViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InsertDiskViewController.m; sourceTree = ""; }; 28848B631CDE97E900B86C45 /* SettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsViewController.h; sourceTree = ""; }; @@ -269,6 +302,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 283423901CF9C4CB0088B634 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 28F676BA1CD15E0B00FC6FA6 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -319,6 +359,7 @@ children = ( 283422F01CF8F3530088B634 /* Shared */, 283422CB1CF8EF8C0088B634 /* MacPlus4M */, + 283423981CF9C5380088B634 /* MacII */, ); name = "Emulator Bundles"; sourceTree = ""; @@ -403,6 +444,17 @@ path = mnvm_core; sourceTree = ""; }; + 283423981CF9C5380088B634 /* MacII */ = { + isa = PBXGroup; + children = ( + 283423991CF9C5380088B634 /* CNFGGLOB.h */, + 2834239A1CF9C5380088B634 /* CNFGRAPI.h */, + 2834239B1CF9C5380088B634 /* EMCONFIG.h */, + 2834239C1CF9C5380088B634 /* Info.plist */, + ); + path = MacII; + sourceTree = ""; + }; 28BA896E1CE7314500A98104 /* Keyboard */ = { isa = PBXGroup; children = ( @@ -433,6 +485,7 @@ 28F6B4A81CF07EC9002D76D0 /* liblibmfs.a */, 28F6B4B61CF07F32002D76D0 /* liblibres.a */, 283422CA1CF8EF8C0088B634 /* MacPlus4M.framework */, + 283423961CF9C4CB0088B634 /* MacII.framework */, ); name = Products; sourceTree = ""; @@ -560,6 +613,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 283423911CF9C4CB0088B634 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ @@ -581,6 +641,24 @@ productReference = 283422CA1CF8EF8C0088B634 /* MacPlus4M.framework */; productType = "com.apple.product-type.framework"; }; + 2834237D1CF9C4CB0088B634 /* MacII */ = { + isa = PBXNativeTarget; + buildConfigurationList = 283423931CF9C4CB0088B634 /* Build configuration list for PBXNativeTarget "MacII" */; + buildPhases = ( + 2834237E1CF9C4CB0088B634 /* Sources */, + 283423901CF9C4CB0088B634 /* Frameworks */, + 283423911CF9C4CB0088B634 /* Headers */, + 283423921CF9C4CB0088B634 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = MacII; + productName = "minivmac-plus4m"; + productReference = 283423961CF9C4CB0088B634 /* MacII.framework */; + productType = "com.apple.product-type.framework"; + }; 28F676BC1CD15E0B00FC6FA6 /* Mini vMac */ = { isa = PBXNativeTarget; buildConfigurationList = 28F676D41CD15E0B00FC6FA6 /* Build configuration list for PBXNativeTarget "Mini vMac" */; @@ -596,6 +674,7 @@ ); dependencies = ( 283422D01CF8EF8C0088B634 /* PBXTargetDependency */, + 283423A11CF9C5730088B634 /* PBXTargetDependency */, ); name = "Mini vMac"; productName = "Mini vMac"; @@ -666,6 +745,9 @@ CreatedOnToolsVersion = 7.3.1; DevelopmentTeam = UJXNDZ5TNU; }; + 2834237D1CF9C4CB0088B634 = { + DevelopmentTeam = UJXNDZ5TNU; + }; 28F676BC1CD15E0B00FC6FA6 = { CreatedOnToolsVersion = 7.3; DevelopmentTeam = UJXNDZ5TNU; @@ -699,6 +781,7 @@ 28F6B4A71CF07EC9002D76D0 /* libmfs */, 28F6B4B51CF07F32002D76D0 /* libres */, 283422C91CF8EF8C0088B634 /* MacPlus4M */, + 2834237D1CF9C4CB0088B634 /* MacII */, ); }; /* End PBXProject section */ @@ -711,6 +794,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 283423921CF9C4CB0088B634 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 28F676BB1CD15E0B00FC6FA6 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -780,6 +870,32 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 2834237E1CF9C4CB0088B634 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 283423DF1CF9C66D0088B634 /* SONYEMDV.c in Sources */, + 283423DE1CF9C66D0088B634 /* SCSIEMDV.c in Sources */, + 283423861CF9C4CB0088B634 /* Emulator.m in Sources */, + 283423DD1CF9C66D0088B634 /* SCRNEMDV.c in Sources */, + 283423DB1CF9C66D0088B634 /* RTCEMDEV.c in Sources */, + 283423881CF9C4CB0088B634 /* MYOSGLUE.m in Sources */, + 283423D71CF9C66D0088B634 /* MINEM68K.c in Sources */, + 283423D81CF9C66D0088B634 /* MOUSEMDV.c in Sources */, + 283423E11CF9C66D0088B634 /* VIAEMDEV.c in Sources */, + 283423E01CF9C66D0088B634 /* VIA2EMDV.c in Sources */, + 283423D61CF9C66D0088B634 /* M68KITAB.c in Sources */, + 283423D41CF9C66D0088B634 /* GLOBGLUE.c in Sources */, + 283423DA1CF9C66D0088B634 /* ROMEMDEV.c in Sources */, + 283423D91CF9C66D0088B634 /* PROGMAIN.c in Sources */, + 283423D21CF9C66D0088B634 /* ADBEMDEV.c in Sources */, + 283423D31CF9C66D0088B634 /* ASCEMDEV.c in Sources */, + 283423DC1CF9C66D0088B634 /* SCCEMDEV.c in Sources */, + 283423D51CF9C66D0088B634 /* IWMEMDEV.c in Sources */, + 283423E21CF9C66D0088B634 /* VIDEMDEV.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 28F676B91CD15E0B00FC6FA6 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -845,6 +961,11 @@ target = 283422C91CF8EF8C0088B634 /* MacPlus4M */; targetProxy = 283422CF1CF8EF8C0088B634 /* PBXContainerItemProxy */; }; + 283423A11CF9C5730088B634 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2834237D1CF9C4CB0088B634 /* MacII */; + targetProxy = 283423A01CF9C5730088B634 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -917,6 +1038,56 @@ }; name = Release; }; + 283423941CF9C4CB0088B634 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "$(SRCROOT)/Mini vMac/$(PRODUCT_NAME)/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = net.namedfork.minivmac.macii; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + USER_HEADER_SEARCH_PATHS = "\"$(SRCROOT)/Mini vMac/$(PRODUCT_NAME)\" \"$(SRCROOT)/Mini vMac/mnvm_core\""; + USE_HEADERMAP = NO; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 283423951CF9C4CB0088B634 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "$(SRCROOT)/Mini vMac/$(PRODUCT_NAME)/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = net.namedfork.minivmac.macii; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + USER_HEADER_SEARCH_PATHS = "\"$(SRCROOT)/Mini vMac/$(PRODUCT_NAME)\" \"$(SRCROOT)/Mini vMac/mnvm_core\""; + USE_HEADERMAP = NO; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; 28F676D21CD15E0B00FC6FA6 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1110,6 +1281,15 @@ ); defaultConfigurationIsVisible = 0; }; + 283423931CF9C4CB0088B634 /* Build configuration list for PBXNativeTarget "MacII" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 283423941CF9C4CB0088B634 /* Debug */, + 283423951CF9C4CB0088B634 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 28F676B81CD15E0B00FC6FA6 /* Build configuration list for PBXProject "Mini vMac" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Mini vMac/AppDelegate.m b/Mini vMac/AppDelegate.m index 34a84bf..9ae834c 100644 --- a/Mini vMac/AppDelegate.m +++ b/Mini vMac/AppDelegate.m @@ -50,7 +50,7 @@ static NSObject *sharedEmulator = nil; NSDictionary *defaultValues = @{@"trackpad": @([UIDevice currentDevice].userInterfaceIdiom != UIUserInterfaceIdiomPad), @"frameskip": @(0), @"keyboardLayout": layoutForLanguage[firstLanguage], - @"machine": @"MacPlus4M" + @"machine": @"MacII" }; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; @@ -79,6 +79,7 @@ static NSObject *sharedEmulator = nil; } - (BOOL)loadEmulator:(NSString*)name { + NSLog(@"Loading %@", name); NSString *emulatorBundleName = [name stringByAppendingPathExtension:@"mnvm"]; NSString *emulatorBundlePath = [[NSBundle mainBundle].builtInPlugInsPath stringByAppendingPathComponent:emulatorBundleName]; NSBundle *emulatorBundle = [NSBundle bundleWithPath:emulatorBundlePath]; diff --git a/Mini vMac/MYOSGLUE.m b/Mini vMac/MYOSGLUE.m index bbe625f..6733246 100644 --- a/Mini vMac/MYOSGLUE.m +++ b/Mini vMac/MYOSGLUE.m @@ -119,14 +119,22 @@ LOCALFUNC blnr FindNamedChildFilePath(NSString *parentPath, char *ChildName, NSS } LOCALVAR CGDataProviderRef screenDataProvider = NULL; -LOCALVAR CGColorSpaceRef screenColorSpace = NULL; +LOCALVAR CGColorSpaceRef bwColorSpace = NULL; +LOCALVAR CGColorSpaceRef colorColorSpace = NULL; LOCALFUNC blnr Screen_Init(void) { screenDataProvider = CGDataProviderCreateWithData(NULL, screencomparebuff, vMacScreenNumBytes, NULL); CGColorSpaceRef baseColorSpace = CGColorSpaceCreateDeviceRGB(); uint8_t clut[] = {255, 255, 255, 0, 0, 0}; - screenColorSpace = CGColorSpaceCreateIndexed(baseColorSpace, 1, clut); + bwColorSpace = CGColorSpaceCreateIndexed(baseColorSpace, 1, clut); +#if 0 != vMacScreenDepth + ColorModeWorks = trueblnr; +#endif +#if vMacScreenDepth >= 4 + colorColorSpace = baseColorSpace; +#else CGColorSpaceRelease(baseColorSpace); +#endif return trueblnr; } @@ -135,9 +143,13 @@ LOCALPROC Screen_UnInit(void) { CGDataProviderRelease(screenDataProvider); screenDataProvider = NULL; } - if (screenColorSpace) { - CGColorSpaceRelease(screenColorSpace); - screenColorSpace = NULL; + if (bwColorSpace) { + CGColorSpaceRelease(bwColorSpace); + bwColorSpace = NULL; + } + if (colorColorSpace) { + CGColorSpaceRelease(colorColorSpace); + colorColorSpace = NULL; } } @@ -852,14 +864,56 @@ GLOBALPROC SetKeyState(int key, blnr down) { #pragma mark - Video Out -LOCALPROC HaveChangedScreenBuff(ui4r top, ui4r left, ui4r bottom, ui4r right) { - size_t bitsPerPixel = 1 << vMacScreenDepth; - size_t bitsPerComponent = vMacScreenDepth <= 4 ? 1 << vMacScreenDepth : vMacScreenDepth == 5 ? 5 : 8; - CGBitmapInfo options = 0; +#if 0 != vMacScreenDepth && vMacScreenDepth < 4 +LOCALPROC UpdateColorTable() { + unsigned char *colorTable = malloc(3 * CLUT_size); + for (int i=0; i < CLUT_size; i++) { + colorTable[3*i + 0] = CLUT_reds[i] >> 8; + colorTable[3*i + 1] = CLUT_greens[i] >> 8; + colorTable[3*i + 2] = CLUT_blues[i] >> 8; + } + CGColorSpaceRef baseColorSpace = CGColorSpaceCreateDeviceRGB(); + if (colorColorSpace != NULL) { + CGColorSpaceRelease(colorColorSpace); + } + colorColorSpace = CGColorSpaceCreateIndexed(baseColorSpace, CLUT_size-1, colorTable); + CGColorSpaceRelease(baseColorSpace); + free(colorTable); +} +#endif - CGImageRef screenImage = CGImageCreate(vMacScreenWidth, vMacScreenHeight, bitsPerComponent, bitsPerPixel, vMacScreenByteWidth, screenColorSpace, options, screenDataProvider, NULL, false, kCGRenderingIntentDefault); - [[Emulator sharedEmulator] updateScreen:screenImage]; - CGImageRelease(screenImage); +LOCALPROC HaveChangedScreenBuff(ui4r top, ui4r left, ui4r bottom, ui4r right) { + size_t bitsPerPixel = 1; + size_t bitsPerComponent = 1; + size_t bytesPerRow = vMacScreenMonoByteWidth; + CGBitmapInfo options = 0; + CGColorSpaceRef colorSpace = bwColorSpace; +#if vMacScreenDepth != 0 + if (UseColorMode) { + bitsPerPixel = 1 << vMacScreenDepth; + bytesPerRow = vMacScreenByteWidth; +#if vMacScreenDepth < 4 + bitsPerComponent = 1 << vMacScreenDepth; + if (!ColorTransValid) { + UpdateColorTable(); + ColorTransValid = trueblnr; + } +#elif vMacScreenDepth == 4 + bitsPerComponent = 5; + options = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder16Big; +#elif vMacScreenDepth == 5 + bitsPerComponent = 8; + options = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Big; +#endif + colorSpace = colorColorSpace; + } +#endif + + if (colorSpace) { + CGImageRef screenImage = CGImageCreate(vMacScreenWidth, vMacScreenHeight, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpace, options, screenDataProvider, NULL, false, kCGRenderingIntentDefault); + [[Emulator sharedEmulator] updateScreen:screenImage]; + CGImageRelease(screenImage); + } } LOCALPROC MyDrawChangesAndClear(void) { diff --git a/Mini vMac/MacII/CNFGGLOB.h b/Mini vMac/MacII/CNFGGLOB.h new file mode 100644 index 0000000..6dc2f89 --- /dev/null +++ b/Mini vMac/MacII/CNFGGLOB.h @@ -0,0 +1,98 @@ +/* + Configuration options used by both platform specific + and platform independent code. + + This file is automatically generated by the build system, + which tries to know what options are valid in what + combinations. Avoid changing this file manually unless + you know what you're doing. +*/ + +#include + +#define BigEndianUnaligned 0 +#define LittleEndianUnaligned 1 +#define MayInline inline +#define MayNotInline __attribute__((noinline)) +#define SmallGlobals 0 +#define cIncludeUnused 0 +#define UnusedParam(p) (void) p + +/* --- integer types ---- */ + +typedef uint8_t ui3b; +#define HaveRealui3b 1 + +typedef int8_t si3b; +#define HaveRealsi3b 1 + +typedef uint16_t ui4b; +#define HaveRealui4b 1 + +typedef int16_t si4b; +#define HaveRealsi4b 1 + +typedef uint32_t ui5b; +#define HaveRealui5b 1 + +typedef int32_t si5b; +#define HaveRealsi5b 1 + +#define HaveRealui6b 0 +#define HaveRealsi6b 0 + +/* --- integer representation types ---- */ + +typedef ui3b ui3r; +#define ui3beqr 1 + +typedef si3b si3r; +#define si3beqr 1 + +typedef ui4b ui4r; +#define ui4beqr 1 + +typedef si4b si4r; +#define si4beqr 1 + +typedef ui5b ui5r; +#define ui5beqr 1 + +typedef si5b si5r; +#define si5beqr 1 + +typedef int64_t si6r; +typedef int64_t si6b; +typedef uint64_t ui6r; +typedef uint64_t ui6b; +#define LIT64(a) a##ULL + +/* capabilities provided by platform specific code */ + +#define MySoundEnabled 0 + +#define MySoundRecenterSilence 0 +#define kLn2SoundSampSz 3 + +#define dbglog_HAVE 0 + +#define NumDrives 6 +#define IncludeSonyRawMode 1 +#define IncludeSonyGetName 1 +#define IncludeSonyNew 0 +#define IncludeSonyNameNew 0 + +#define vMacScreenHeight 768 +#define vMacScreenWidth 1024 +#define vMacScreenDepth 3 + +#define kROM_Size 0x00040000 + +#define IncludePbufs 1 +#define NumPbufs 4 + +#define EnableMouseMotion 1 + +#define IncludeHostTextClipExchange 1 +#define EnableAutoSlow 1 +#define EmLocalTalk 0 diff --git a/Mini vMac/MacII/CNFGRAPI.h b/Mini vMac/MacII/CNFGRAPI.h new file mode 100644 index 0000000..7d980d6 --- /dev/null +++ b/Mini vMac/MacII/CNFGRAPI.h @@ -0,0 +1,33 @@ +#include + +#define MyAppIsBundle 1 +#define kMacCreatorSig 'MnvM' + +#define RomFileName "MacII.ROM" +#define EnableDragDrop 1 +#define EnableAltKeysMode 0 +#define SwapCommandControl 0 +#define VarFullScreen 1 +#define WantInitFullScreen 0 +#define MayFullScreen 1 +#define MayNotFullScreen 1 +#define WantInitMagnify 0 +#define EnableMagnify 0 +#define WantInitRunInBackground 0 +#define WantInitNotAutoSlow 1 +#define WantInitSpeedValue 2 +#define NeedRequestInsertDisk 0 +#define NeedDoMoreCommandsMsg 0 +#define NeedDoAboutMsg 0 +#define UseControlKeys 0 +#define UseActvCode 0 +#define EnableDemoMsg 0 + +/* version and other info to display to user */ + +#define NeedIntlChars 1 +#define kStrAppName "Mini vMac" +#define kAppVariationStr "minivmac-3.4.0-ios" +#define kStrCopyrightYear "2016" +#define kMaintainerName "Jesús A. Álvarez" +#define kStrHomePage "https://namedfork.net/minivmac" diff --git a/Mini vMac/MacII/EMCONFIG.h b/Mini vMac/MacII/EMCONFIG.h new file mode 100644 index 0000000..ca37757 --- /dev/null +++ b/Mini vMac/MacII/EMCONFIG.h @@ -0,0 +1,232 @@ +/* + Configuration options used by platform independent code. + + This file is automatically generated by the build system, + which tries to know what options are valid in what + combinations. Avoid changing this file manually unless + you know what you're doing. +*/ + +#define EmClassicKbrd 0 +#define EmADB 1 +#define EmRTC 1 +#define EmPMU 0 +#define EmVIA2 1 +#define Use68020 1 +#define EmFPU 1 +#define EmMMU 0 +#define EmASC 1 + +#define CurEmMd kEmMd_II + +#define kMyClockMult 2 + +#define WantCycByPriOp 1 +#define WantCloserCyc 0 + +#define kRAMa_Size 0x00400000 +#define kRAMb_Size 0x00400000 + +#define IncludeVidMem 1 +#define kVidMemRAM_Size 0x00100000 + +#define EmVidCard 1 +#define kVidROM_Size 0x000800 + +#define MaxATTListN 20 +#define IncludeExtnPbufs 1 +#define IncludeExtnHostTextClipExchange 1 + +#define Sony_SupportDC42 1 +#define Sony_SupportTags 0 +#define Sony_WantChecksumsUpdated 0 +#define Sony_VerifyChecksums 0 +#define CaretBlinkTime 0x08 +#define SpeakerVol 0x00 +#define DoubleClickTime 0x08 +#define MenuBlink 0x03 +#define AutoKeyThresh 0x06 +#define AutoKeyRate 0x03 + + +/* the Wire variables are 1/0, not true/false */ + +enum { + + Wire_unknown_SoundDisable, +#define SoundDisable (Wires[Wire_unknown_SoundDisable]) + + Wire_unknown_SoundVolb0, +#define SoundVolb0 (Wires[Wire_unknown_SoundVolb0]) + + Wire_unknown_SoundVolb1, +#define SoundVolb1 (Wires[Wire_unknown_SoundVolb1]) + + Wire_unknown_SoundVolb2, +#define SoundVolb2 (Wires[Wire_unknown_SoundVolb2]) + + Wire_VIA1_iA0_unknown, +#define VIA1_iA0 (Wires[Wire_VIA1_iA0_unknown]) + + Wire_VIA1_iA1_unknown, +#define VIA1_iA1 (Wires[Wire_VIA1_iA1_unknown]) + + Wire_VIA1_iA2_unknown, +#define VIA1_iA2 (Wires[Wire_VIA1_iA2_unknown]) + + Wire_VIA1_iB7_unknown, /* for compatibility with SoundDisable */ +#define VIA1_iB7 (Wires[Wire_VIA1_iB7_unknown]) + + Wire_VIA2_InterruptRequest, +#define VIA2_InterruptRequest (Wires[Wire_VIA2_InterruptRequest]) +#define VIA2_interruptChngNtfy VIAorSCCinterruptChngNtfy + + Wire_VIA2_iA7_unknown, +#define VIA2_iA7 (Wires[Wire_VIA2_iA7_unknown]) +#define VIA2_iA7_ChangeNtfy Addr32_ChangeNtfy + + Wire_VIA2_iA6_unknown, +#define VIA2_iA6 (Wires[Wire_VIA2_iA6_unknown]) +#define VIA2_iA6_ChangeNtfy Addr32_ChangeNtfy + + Wire_VIA2_iB7_unknown, +#define VIA2_iB7 (Wires[Wire_VIA2_iB7_unknown]) + + Wire_VIA2_iCB2_unknown, +#define VIA2_iCB2 (Wires[Wire_VIA2_iCB2_unknown]) + + Wire_VIA2_iB2_PowerOff, +#define VIA2_iB2 (Wires[Wire_VIA2_iB2_PowerOff]) +#define VIA2_iB2_ChangeNtfy PowerOff_ChangeNtfy + + Wire_VIA2_iB3_Addr32, +#define VIA2_iB3 (Wires[Wire_VIA2_iB3_Addr32]) +#define Addr32 (Wires[Wire_VIA2_iB3_Addr32]) +#define VIA2_iB3_ChangeNtfy Addr32_ChangeNtfy + + Wire_VIA1_iA4_MemOverlay, +#define MemOverlay (Wires[Wire_VIA1_iA4_MemOverlay]) +#define VIA1_iA4 (Wires[Wire_VIA1_iA4_MemOverlay]) +#define VIA1_iA4_ChangeNtfy MemOverlay_ChangeNtfy + + Wire_VIA1_iA5_IWMvSel, +#define IWMvSel (Wires[Wire_VIA1_iA5_IWMvSel]) +#define VIA1_iA5 (Wires[Wire_VIA1_iA5_IWMvSel]) + + Wire_VIA1_iA7_SCCwaitrq, +#define SCCwaitrq (Wires[Wire_VIA1_iA7_SCCwaitrq]) +#define VIA1_iA7 (Wires[Wire_VIA1_iA7_SCCwaitrq]) + + Wire_VIA1_iB0_RTCdataLine, +#define RTCdataLine (Wires[Wire_VIA1_iB0_RTCdataLine]) +#define VIA1_iB0 (Wires[Wire_VIA1_iB0_RTCdataLine]) +#define VIA1_iB0_ChangeNtfy RTCdataLine_ChangeNtfy + + Wire_VIA1_iB1_RTCclock, +#define RTCclock (Wires[Wire_VIA1_iB1_RTCclock]) +#define VIA1_iB1 (Wires[Wire_VIA1_iB1_RTCclock]) +#define VIA1_iB1_ChangeNtfy RTCclock_ChangeNtfy + + Wire_VIA1_iB2_RTCunEnabled, +#define RTCunEnabled (Wires[Wire_VIA1_iB2_RTCunEnabled]) +#define VIA1_iB2 (Wires[Wire_VIA1_iB2_RTCunEnabled]) +#define VIA1_iB2_ChangeNtfy RTCunEnabled_ChangeNtfy + + Wire_VIA1_iA3_SCCvSync, +#define VIA1_iA3 (Wires[Wire_VIA1_iA3_SCCvSync]) + + Wire_VIA1_iB3_ADB_Int, +#define ADB_Int (Wires[Wire_VIA1_iB3_ADB_Int]) +#define VIA1_iB3 (Wires[Wire_VIA1_iB3_ADB_Int]) + + Wire_VIA1_iB4_ADB_st0, +#define ADB_st0 (Wires[Wire_VIA1_iB4_ADB_st0]) +#define VIA1_iB4 (Wires[Wire_VIA1_iB4_ADB_st0]) +#define VIA1_iB4_ChangeNtfy ADBstate_ChangeNtfy + + Wire_VIA1_iB5_ADB_st1, +#define ADB_st1 (Wires[Wire_VIA1_iB5_ADB_st1]) +#define VIA1_iB5 (Wires[Wire_VIA1_iB5_ADB_st1]) +#define VIA1_iB5_ChangeNtfy ADBstate_ChangeNtfy + + Wire_VIA1_iCB2_ADB_Data, +#define ADB_Data (Wires[Wire_VIA1_iCB2_ADB_Data]) +#define VIA1_iCB2 (Wires[Wire_VIA1_iCB2_ADB_Data]) +#define VIA1_iCB2_ChangeNtfy ADB_DataLineChngNtfy + + Wire_VIA1_InterruptRequest, +#define VIA1_InterruptRequest (Wires[Wire_VIA1_InterruptRequest]) +#define VIA1_interruptChngNtfy VIAorSCCinterruptChngNtfy + + Wire_SCCInterruptRequest, +#define SCCInterruptRequest (Wires[Wire_SCCInterruptRequest]) +#define SCCinterruptChngNtfy VIAorSCCinterruptChngNtfy + + Wire_ADBMouseDisabled, +#define ADBMouseDisabled (Wires[Wire_ADBMouseDisabled]) + + Wire_VBLinterrupt, +#define Vid_VBLinterrupt (Wires[Wire_VBLinterrupt]) +#define VIA2_iA0 (Wires[Wire_VBLinterrupt]) + + Wire_VBLintunenbl, +#define Vid_VBLintunenbl (Wires[Wire_VBLintunenbl]) + + kNumWires +}; + + +/* VIA configuration */ +#define VIA1_ORA_FloatVal 0xBF + /* bit 6 used to check version of hardware */ +#define VIA1_ORB_FloatVal 0xFF +#define VIA1_ORA_CanIn 0x80 +#define VIA1_ORA_CanOut 0x3F +#define VIA1_ORB_CanIn 0x09 +#define VIA1_ORB_CanOut 0xB7 +#define VIA1_IER_Never0 0x00 +#define VIA1_IER_Never1 0x58 +#define VIA1_CB2modesAllowed 0x01 +#define VIA1_CA2modesAllowed 0x01 + +/* VIA 2 configuration */ +#define VIA2_ORA_FloatVal 0xFF +#define VIA2_ORB_FloatVal 0xFF +#define VIA2_ORA_CanIn 0x01 +#define VIA2_ORA_CanOut 0xC0 +#define VIA2_ORB_CanIn 0x00 +#define VIA2_ORB_CanOut 0x8C +#define VIA2_IER_Never0 0x00 +#define VIA2_IER_Never1 0xED +#define VIA2_CB2modesAllowed 0x01 +#define VIA2_CA2modesAllowed 0x01 + +#define Mouse_Enabled() (! ADBMouseDisabled) + +#define VIA1_iCA1_PulseNtfy VIA1_iCA1_Sixtieth_PulseNtfy +#define Sixtieth_PulseNtfy VIA1_iCA1_Sixtieth_PulseNtfy + +#define VIA1_iCA2_PulseNtfy VIA1_iCA2_RTC_OneSecond_PulseNtfy +#define RTC_OneSecond_PulseNtfy VIA1_iCA2_RTC_OneSecond_PulseNtfy + +#define VIA2_iCA1_PulseNtfy VIA2_iCA1_Vid_VBLinterrupt_PulseNtfy +#define Vid_VBLinterrupt_PulseNotify VIA2_iCA1_Vid_VBLinterrupt_PulseNtfy + +#define VIA2_iCB1_PulseNtfy VIA2_iCB1_ASC_interrupt_PulseNtfy +#define ASC_interrupt_PulseNtfy VIA2_iCB1_ASC_interrupt_PulseNtfy + +#define GetSoundInvertTime VIA1_GetT1InvertTime + +#define ADB_ShiftInData VIA1_ShiftOutData +#define ADB_ShiftOutData VIA1_ShiftInData + +#define kCheckSumRom_Size kROM_Size + +#define kExtn_Block_Base 0x50F0C000 +#define kExtn_ln2Spc 5 + +#define kROM_Base 0x00800000 +#define kROM_ln2Spc 20 + +#define WantDisasm 0 +#define ExtraAbnormalReports 0 diff --git a/Mini vMac/MacII/Info.plist b/Mini vMac/MacII/Info.plist new file mode 100644 index 0000000..ae9fbc8 --- /dev/null +++ b/Mini vMac/MacII/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDisplayName + Mac II + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + MnvM + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + Emulator + +