diff --git a/A2Mac.xcodeproj/project.pbxproj b/A2Mac.xcodeproj/project.pbxproj index 7361b0a..1ee7ff9 100644 --- a/A2Mac.xcodeproj/project.pbxproj +++ b/A2Mac.xcodeproj/project.pbxproj @@ -11,6 +11,10 @@ 320B3FC424AD88B0005EA133 /* power.png in Copy Image Files */ = {isa = PBXBuildFile; fileRef = 320B3FC324AD88B0005EA133 /* power.png */; }; 320B4FC124B182DE00070038 /* Apple Disk II.png in Copy Image Files */ = {isa = PBXBuildFile; fileRef = 320B4FC024B182DD00070038 /* Apple Disk II.png */; }; 320F2A8824CFD74100671B35 /* Steve2Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 320F2A8724CFD74000671B35 /* Steve2Icon.icns */; }; + 32100A8B2875387300D894EE /* CheatMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32100A8A2875387300D894EE /* CheatMenu.swift */; }; + 32100A9F28753AAA00D894EE /* SubMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32100A9E28753AAA00D894EE /* SubMenu.swift */; }; + 32100AB42877AB8600D894EE /* scsi.c in Sources */ = {isa = PBXBuildFile; fileRef = 32100AB32877AB8600D894EE /* scsi.c */; }; + 32100AB52877AB8600D894EE /* scsi.c in Sources */ = {isa = PBXBuildFile; fileRef = 32100AB32877AB8600D894EE /* scsi.c */; }; 321D9C3B287373D20036E22F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB6022EACC660003B53F /* Main.storyboard */; }; 321D9C45287373D30036E22F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB6022EACC660003B53F /* Main.storyboard */; }; 32326B0C2630A1910076F839 /* 6502.c in Sources */ = {isa = PBXBuildFile; fileRef = 32439F7422ECD8AD0077AAE0 /* 6502.c */; }; @@ -545,6 +549,10 @@ 320F2A8A24D0001600671B35 /* 6502_und.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 6502_und.h; sourceTree = ""; }; 320F2A8B24D0828600671B35 /* 6502_C.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 6502_C.h; sourceTree = ""; }; 320F2A9924D4DE8400671B35 /* 6502_C_Rockwell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 6502_C_Rockwell.h; sourceTree = ""; }; + 32100A8A2875387300D894EE /* CheatMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheatMenu.swift; sourceTree = ""; }; + 32100A9E28753AAA00D894EE /* SubMenu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubMenu.swift; sourceTree = ""; }; + 32100AB22877AB8600D894EE /* scsi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scsi.h; sourceTree = ""; }; + 32100AB32877AB8600D894EE /* scsi.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = scsi.c; sourceTree = ""; }; 321D9BDC287373000036E22F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = A2Mac/Base.lproj/Main_copy.storyboard; sourceTree = ""; }; 323D042D248980600086A901 /* Preferences.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Preferences.storyboard; sourceTree = ""; }; 323D042F24898AB70086A901 /* PreferencesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesViewController.swift; sourceTree = ""; }; @@ -932,6 +940,8 @@ 325EB63523F8F78300C6B4A4 /* disk.c */, 32E3126B24A9928F00E61891 /* dsk2woz.h */, 32E3126824A98B9300E61891 /* dsk2woz.c */, + 32100AB22877AB8600D894EE /* scsi.h */, + 32100AB32877AB8600D894EE /* scsi.c */, ); path = disk; sourceTree = ""; @@ -1127,6 +1137,8 @@ 32BFFB5E22EACC660003B53F /* Assets.xcassets */, 32B18438233FAB3900DBB4AB /* verticies.swift */, 32BFFB5A22EACC630003B53F /* AppDelegate.swift */, + 32100A8A2875387300D894EE /* CheatMenu.swift */, + 32100A9E28753AAA00D894EE /* SubMenu.swift */, 32BFFB5C22EACC630003B53F /* ViewController.swift */, 32C6995127C5439300D0F25D /* Debugger.swift */, 323D042F24898AB70086A901 /* PreferencesViewController.swift */, @@ -1595,6 +1607,7 @@ 32799F80264B1A5700255669 /* dsk2woz.c in Sources */, 32799F81264B1A5700255669 /* disk.c in Sources */, 3268B97B27DE7D6B003FBDCC /* disassembler.c in Sources */, + 32100AB52877AB8600D894EE /* scsi.c in Sources */, 32C6996727C548C900D0F25D /* Shaders.metal in Sources */, 32799F82264B1A5700255669 /* woz.c in Sources */, 32A6AB10266AF5160023257A /* paddle.c in Sources */, @@ -1620,13 +1633,16 @@ 32BFFB5B22EACC630003B53F /* AppDelegate.swift in Sources */, 32E3126D24AC033A00E61891 /* ToolBarController.swift in Sources */, 323D043024898AB70086A901 /* PreferencesViewController.swift in Sources */, + 32100A9F28753AAA00D894EE /* SubMenu.swift in Sources */, 32BCCCE9264DBDC8002151C5 /* 6502.c in Sources */, 323D04332489BFD80086A901 /* PreferencesWindowController.swift in Sources */, 32E3126924A98B9300E61891 /* dsk2woz.c in Sources */, 325EB63623F8F78300C6B4A4 /* disk.c in Sources */, + 32100A8B2875387300D894EE /* CheatMenu.swift in Sources */, 3268B97A27DE7D6A003FBDCC /* disassembler.c in Sources */, 32C6995D27C548C800D0F25D /* Shaders.metal in Sources */, 325EB62F23F8856F00C6B4A4 /* woz.c in Sources */, + 32100AB42877AB8600D894EE /* scsi.c in Sources */, 32A6AB0F266AF5160023257A /* paddle.c in Sources */, 32A9F74A2467B60B004902A1 /* speaker.c in Sources */, 325EB63923F9E48100C6B4A4 /* common.c in Sources */, diff --git a/A2Mac/AppDelegate.swift b/A2Mac/AppDelegate.swift index 0835b65..622dbf4 100644 --- a/A2Mac/AppDelegate.swift +++ b/A2Mac/AppDelegate.swift @@ -22,10 +22,12 @@ // import Cocoa +import Foundation @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { + static var current : AppDelegate? var preferencesController : PreferencesWindowController? func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { @@ -51,6 +53,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(_ aNotification: Notification) { // Insert code here to initialize your application + AppDelegate.current = self } func applicationWillTerminate(_ aNotification: Notification) { @@ -64,6 +67,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { func application(_ sender: NSApplication, openFile filename: String) -> Bool { ViewController.current?.openDiskImage(url: URL(fileURLWithPath: filename)) + return true; } @@ -95,8 +99,27 @@ class AppDelegate: NSObject, NSApplicationDelegate { menuItem.state = (ViewController.current?.Cheat_Wavy_Navy_Lose_To_Win())! } + @IBOutlet weak var MenuItem_Cheat: NSMenuItem! + @IBOutlet weak var MenuItem_Hard_Hat_Mack: NSMenuItem! + @IBOutlet weak var MenuItem_Hard_Hat_Mack_Add_3_Macks: NSMenuItem! + + func Cheat_Menu() { +// print("Cheat_Menu Menu") + let ships = ViewController.current?.Get_Hard_Hat_Mack() + MenuItem_Hard_Hat_Mack_Add_3_Macks.title = String(format: "Add 3 Macks (%d)", ships!) + } + @IBAction func Cheat_Hard_Hat_Mack(_ menuItem: NSMenuItem) { - menuItem.state = (ViewController.current?.Cheat_Hard_Hat_Mack())! + print("Cheat_Hard_Hat_Mack SubMenu") + let ships = ViewController.current?.Get_Hard_Hat_Mack() + MenuItem_Hard_Hat_Mack_Add_3_Macks.title = String(format: "Add 3 Macks (%d)", ships!) + } + @IBAction func Cheat_Hard_Hat_Mack_Add_3_Macks(_ menuItem: NSMenuItem) { + let _ = ViewController.current?.Cheat_Hard_Hat_Mack(add: 3) + } + + @IBAction func Cheat_Hard_Hat_Mack_Never_Lose(_ menuItem: NSMenuItem) { + menuItem.state = (ViewController.current?.Cheat_Hard_Hat_Mack_Never_Lose())! } @IBAction func showPreferences(_ sender: NSMenuItem) { diff --git a/A2Mac/Base.lproj/Main.storyboard b/A2Mac/Base.lproj/Main.storyboard index 408016b..9e69fea 100644 --- a/A2Mac/Base.lproj/Main.storyboard +++ b/A2Mac/Base.lproj/Main.storyboard @@ -832,7 +832,7 @@ - + @@ -842,9 +842,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -1292,7 +1311,13 @@ - + + + + + + + @@ -1718,7 +1743,7 @@ - + diff --git a/A2Mac/ViewController.swift b/A2Mac/ViewController.swift index b3c2a17..2fd2591 100644 --- a/A2Mac/ViewController.swift +++ b/A2Mac/ViewController.swift @@ -2000,7 +2000,22 @@ class ViewController: NSViewController { } } - func Cheat_Hard_Hat_Mack() -> NSControl.StateValue { + + func Get_Hard_Hat_Mack() -> UInt8 { + return getMEM( 0x4EDF ) + } + + func Cheat_Hard_Hat_Mack(add : UInt8) -> UInt8 { + let ships = min( getMEM( 0x4EDF ) + add, 9 ) + setMEM( 0x4EDF, ships ) +// CALL( 0x1219 ) // starts from the beginning + CALL( 0x1A2B ) // refresh Mack counter on screen + + return ships + } + + + func Cheat_Hard_Hat_Mack_Never_Lose() -> NSControl.StateValue { setMEM( 0x0503, 0x18 ) setMEM( 0x0504, 0x60 )