Changeset 58 for branches/ByteArray/Core.pas
- Timestamp:
- Nov 23, 2023, 11:18:42 PM (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ByteArray/Core.pas
r57 r58 4 4 5 5 uses 6 Classes, SysUtils, Machine, Common.PersistentForm, Common.ApplicationInfo, 7 Common.RegistryEx, Common.Translator, Common.Theme; 6 Classes, SysUtils, Machine, ActnList, Forms, Common.PersistentForm, 7 Common.ApplicationInfo, Common.RegistryEx, Common.Translator, Common.Theme, 8 FormConsole, FormScreen, FormSourceEditor, FormMemory, FormDisassembler, 9 FormStorage, FormDebugger; 8 10 9 11 type … … 12 14 13 15 TCore = class(TDataModule) 16 AAbout: TAction; 17 AConsole: TAction; 18 ActionList1: TActionList; 19 ADebugger: TAction; 20 ADevices: TAction; 21 ADisassembler: TAction; 22 AExit: TAction; 23 AFullscreen: TAction; 24 AMemory: TAction; 14 25 ApplicationInfo1: TApplicationInfo; 26 AScreen: TAction; 27 ASettings: TAction; 28 ASourceEditor: TAction; 29 AStorage: TAction; 15 30 PersistentForm1: TPersistentForm; 16 31 ThemeManager1: TThemeManager; 17 32 Translator1: TTranslator; 33 procedure AAboutExecute(Sender: TObject); 34 procedure AConsoleExecute(Sender: TObject); 35 procedure ADebuggerExecute(Sender: TObject); 36 procedure ADisassemblerExecute(Sender: TObject); 37 procedure AExitExecute(Sender: TObject); 38 procedure AFullscreenExecute(Sender: TObject); 39 procedure AMemoryExecute(Sender: TObject); 40 procedure AScreenExecute(Sender: TObject); 41 procedure ASettingsExecute(Sender: TObject); 42 procedure ASourceEditorExecute(Sender: TObject); 43 procedure AStorageExecute(Sender: TObject); 18 44 procedure DataModuleCreate(Sender: TObject); 19 45 procedure DataModuleDestroy(Sender: TObject); … … 23 49 procedure SaveConfig; 24 50 public 51 MainForm: TForm; 52 FormScreen: TFormScreen; 53 FormConsole: TFormConsole; 54 FormMemory: TFormMemory; 55 FormSourceEditor: TFormSourceEditor; 56 FormDisassembler: TFormDisassembler; 57 FormStorage: TFormStorage; 58 FormDebugger: TFormDebugger; 25 59 StartUpForm: string; 26 60 AutoStartMachine: Boolean; … … 37 71 38 72 uses 39 BigInt, Cpu, Common.FormEx ;73 BigInt, Cpu, Common.FormEx, FormSettings, Common.FormAbout; 40 74 41 75 { TCore } … … 50 84 TFormEx.ThemeManager := ThemeManager1; 51 85 TFormEx.PersistentForm := PersistentForm1; 86 87 if StartUpForm = 'Screen' then begin 88 AScreen.Execute; 89 end; 90 if StartUpForm = 'Source editor' then begin 91 ASourceEditor.Execute; 92 end; 93 if StartUpForm = 'Debugger' then begin 94 ADebugger.Execute; 95 end; 96 if AutoStartMachine then 97 Machine.PowerOn; 98 end; 99 100 procedure TCore.AExitExecute(Sender: TObject); 101 begin 102 Application.Terminate; 103 end; 104 105 procedure TCore.ADebuggerExecute(Sender: TObject); 106 begin 107 if not Assigned(FormDebugger) then begin 108 FormDebugger := TFormDebugger.Create(nil); 109 end; 110 FormDebugger.Show; 111 end; 112 113 procedure TCore.ADisassemblerExecute(Sender: TObject); 114 begin 115 if not Assigned(FormDisassembler) then begin 116 FormDisassembler := TFormDisassembler.Create(nil); 117 if not Assigned(MainForm) then MainForm := FormDisassembler; 118 end; 119 FormDisassembler.Disassembler.Memory := Machine.Memory; 120 FormDisassembler.Show; 121 end; 122 123 procedure TCore.AConsoleExecute(Sender: TObject); 124 begin 125 if not Assigned(FormConsole) then begin 126 FormConsole := TFormConsole.Create(nil); 127 Machine.Serial.OnWrite := FormConsole.ConsoleWrite; 128 end; 129 FormConsole.Show; 130 end; 131 132 procedure TCore.AAboutExecute(Sender: TObject); 133 var 134 FormAbout: TFormAbout; 135 begin 136 FormAbout := TFormAbout.Create(nil); 137 try 138 FormAbout.ApplicationInfo := ApplicationInfo1; 139 FormAbout.ShowModal; 140 finally 141 FreeAndNil(FormAbout); 142 end; 143 end; 144 145 procedure TCore.AFullscreenExecute(Sender: TObject); 146 begin 147 PersistentForm1.SetFullScreen(not PersistentForm1.FormFullScreen); 148 end; 149 150 procedure TCore.AMemoryExecute(Sender: TObject); 151 begin 152 if not Assigned(FormMemory) then begin 153 FormMemory := TFormMemory.Create(nil); 154 FormMemory.Memory := Machine.Memory; 155 end; 156 FormMemory.Show; 157 end; 158 159 procedure TCore.AScreenExecute(Sender: TObject); 160 begin 161 if not Assigned(FormScreen) then begin 162 FormScreen := TFormScreen.Create(nil); 163 if not Assigned(MainForm) then MainForm := FormScreen; 164 FormScreen.FrameBuffer := Machine.FrameBuffer; 165 Machine.FrameBuffer.OnChange := FormScreen.ScreenChange; 166 end; 167 FormScreen.Show; 168 end; 169 170 procedure TCore.ASettingsExecute(Sender: TObject); 171 var 172 FormSettings: TFormSettings; 173 begin 174 FormSettings := TFormSettings.Create(nil); 175 try 176 FormSettings.ShowModal; 177 finally 178 FormSettings.Free; 179 end; 180 end; 181 182 procedure TCore.ASourceEditorExecute(Sender: TObject); 183 begin 184 if not Assigned(FormSourceEditor) then begin 185 FormSourceEditor := TFormSourceEditor.Create(nil); 186 if not Assigned(MainForm) then MainForm := FormSourceEditor; 187 FormSourceEditor.Machine := Machine; 188 end; 189 FormSourceEditor.Show; 190 end; 191 192 procedure TCore.AStorageExecute(Sender: TObject); 193 begin 194 if not Assigned(FormStorage) then begin 195 FormStorage := TFormStorage.Create(nil); 196 FormStorage.Storage := Machine.Storage; 197 end; 198 FormStorage.Show; 52 199 end; 53 200 … … 55 202 begin 56 203 SaveConfig; 204 if Assigned(FormSourceEditor) then FreeAndNil(FormSourceEditor); 205 if Assigned(FormScreen) then FreeAndNil(FormScreen); 206 if Assigned(FormConsole) then FreeAndNil(FormConsole); 207 if Assigned(FormMemory) then FreeAndNil(FormMemory); 208 if Assigned(FormDisassembler) then FreeAndNil(FormDisassembler); 209 if Assigned(FormStorage) then FreeAndNil(FormStorage); 210 if Assigned(FormDebugger) then FreeAndNil(FormDebugger); 211 57 212 FreeAndNil(Machine); 58 213 end;
Note:
See TracChangeset
for help on using the changeset viewer.