Changeset 35 for branches/UltimatOS/Forms
- Timestamp:
- Jul 14, 2022, 11:29:01 PM (2 years ago)
- Location:
- branches/UltimatOS/Forms
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/UltimatOS/Forms/UFormMain.lfm
r34 r35 90 90 ParentColor = False 91 91 end 92 object ButtonCpu: TButton 93 Left = 512 94 Height = 38 95 Top = 571 96 Width = 113 97 Caption = 'CPU' 98 OnClick = ButtonCpuClick 99 TabOrder = 6 100 end 92 101 object Timer1: TTimer 93 102 Interval = 20 -
branches/UltimatOS/Forms/UFormMain.pas
r34 r35 5 5 uses 6 6 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, 7 UMachine ;7 UMachine, Math; 8 8 9 9 type … … 14 14 ButtonMemory: TButton; 15 15 ButtonCompile: TButton; 16 ButtonCpu: TButton; 16 17 ButtonStart: TButton; 17 18 ButtonStop: TButton; … … 24 25 Timer2: TTimer; 25 26 procedure ButtonCompileClick(Sender: TObject); 27 procedure ButtonCpuClick(Sender: TObject); 26 28 procedure ButtonMemoryClick(Sender: TObject); 27 29 procedure ButtonRestartClick(Sender: TObject); … … 54 56 55 57 uses 56 UAssembler, UFormMemory ;58 UAssembler, UFormMemory, UFormCpu; 57 59 58 60 { TFormMain } … … 80 82 procedure TFormMain.ButtonMemoryClick(Sender: TObject); 81 83 begin 84 if not Assigned(FormMemory) then FormMemory := TFormMemory.Create(nil); 82 85 FormMemory.Memory := Machine.Memory; 83 86 FormMemory.Show; … … 93 96 Free; 94 97 end; 98 end; 99 100 procedure TFormMain.ButtonCpuClick(Sender: TObject); 101 begin 102 if not Assigned(FormCpu) then FormCpu := TFormCpu.Create(nil); 103 FormCpu.Cpu := Machine.Cpu; 104 FormCpu.Show; 95 105 end; 96 106 … … 143 153 PaintBox1.Repaint; 144 154 end; 145 Label1.Caption := 'Executed instructions: ' + IntToStr(Machine.Cpu. ExecutedCount) + LineEnding +155 Label1.Caption := 'Executed instructions: ' + IntToStr(Machine.Cpu.Ticks) + LineEnding + 146 156 'Interrupts: ' + IntToStr(Machine.Cpu.InterruptCount); 147 157 end; 148 158 149 159 procedure TFormMain.Timer2Timer(Sender: TObject); 160 var 161 TicksPerSecond: Int64; 150 162 begin 151 Label2.Caption := 'Ticks/s: ' + IntToStr(Machine.Cpu.ExecutedCount - LastTicks); 152 LastTicks := Machine.Cpu.ExecutedCount; 163 if Machine.Cpu.Ticks > LastTicks then TicksPerSecond := Machine.Cpu.Ticks - LastTicks 164 else TicksPerSecond := Machine.Cpu.Ticks; 165 Label2.Caption := 'Ticks/s: ' + IntToStr(TicksPerSecond); 166 LastTicks := Machine.Cpu.Ticks; 153 167 end; 154 168
Note:
See TracChangeset
for help on using the changeset viewer.