diff --git a/LEGv8-Simulator-CLI/LEGv8_Simulator_CLI.swift b/LEGv8-Simulator-CLI/LEGv8_Simulator_CLI.swift index 7ebc140..b10d2f4 100644 --- a/LEGv8-Simulator-CLI/LEGv8_Simulator_CLI.swift +++ b/LEGv8-Simulator-CLI/LEGv8_Simulator_CLI.swift @@ -33,10 +33,9 @@ struct LEGv8SimulatorCLI: ParsableCommand { if interpreter.assembled { interpreter.start(text) + interpreter.goToEntryPoint() - while interpreter.running { - interpreter.step(mode: .running) - } + interpreter.run() try "\(interpreter.cpu)".write(to: URL(fileURLWithPath: path_out), atomically: true, encoding: .utf8) } else { diff --git a/LEGv8-Simulator/Models/CPUModel.swift b/LEGv8-Simulator/Models/CPUModel.swift index 84c7d0f..1350666 100644 --- a/LEGv8-Simulator/Models/CPUModel.swift +++ b/LEGv8-Simulator/Models/CPUModel.swift @@ -14,23 +14,14 @@ enum CPUError: Error { case stackPointerMisaligned(_ address: Int64) } -class Memory: ObservableObject, Identifiable, Comparable { +struct Memory: Identifiable, Comparable { let id: Int64 - @Published var value: Int64 - @Published var displayMode: String = "H" + var value: Int64 + var displayMode: String = "H" static func < (lhs: Memory, rhs: Memory) -> Bool { return lhs.id < rhs.id } - - static func == (lhs: Memory, rhs: Memory) -> Bool { - return lhs.id == rhs.id - } - - init(id: Int64, value: Int64) { - self.id = id - self.value = value - } } class CPUModel: ObservableObject, CustomStringConvertible { diff --git a/LEGv8-Simulator/Views/Memory/MemoryValueColumnView.swift b/LEGv8-Simulator/Views/Memory/MemoryValueColumnView.swift index 8070b7f..3eab68b 100644 --- a/LEGv8-Simulator/Views/Memory/MemoryValueColumnView.swift +++ b/LEGv8-Simulator/Views/Memory/MemoryValueColumnView.swift @@ -9,17 +9,17 @@ import SwiftUI struct MemoryValueColumnView: View { @EnvironmentObject var interpreter: Interpreter - @EnvironmentObject var memory: Memory + let memory: Memory @State private var isPresented: Bool = false var body: some View { HStack { - Picker("", selection: $memory.displayMode) { - Text("H").tag("H") - Text("D").tag("D") - } - .pickerStyle(.segmented) - .frame(width: 50) +// Picker("", selection: $memory.displayMode) { +// Text("H").tag("H") +// Text("D").tag("D") +// } +// .pickerStyle(.segmented) +// .frame(width: 50) Button { isPresented.toggle() diff --git a/LEGv8-Simulator/Views/Memory/MemoryView.swift b/LEGv8-Simulator/Views/Memory/MemoryView.swift index 7ece1dc..950f078 100644 --- a/LEGv8-Simulator/Views/Memory/MemoryView.swift +++ b/LEGv8-Simulator/Views/Memory/MemoryView.swift @@ -57,9 +57,8 @@ struct MemoryView: View { } TableColumn("Value") { memory in - MemoryValueColumnView() + MemoryValueColumnView(memory: memory) .environmentObject(interpreter) - .environmentObject(memory) } } .contextMenu { diff --git a/LEGv8-Simulator/Views/Settings/AboutView.swift b/LEGv8-Simulator/Views/Settings/AboutView.swift index 0064370..c627b37 100644 --- a/LEGv8-Simulator/Views/Settings/AboutView.swift +++ b/LEGv8-Simulator/Views/Settings/AboutView.swift @@ -8,7 +8,7 @@ import SwiftUI struct AboutView: View { - let version: String = "1.1 (Release)" + let version: String = "1.2 (Release)" var body: some View { HStack {