- Timestamp:
- Jul 14, 2022, 11:29:01 PM (2 years ago)
- Location:
- branches/UltimatOS
- Files:
-
- 2 added
- 5 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 -
branches/UltimatOS/UCpu.pas
r34 r35 82 82 procedure InstructionDisableInt; 83 83 public 84 ExecutedCount: Integer;84 Ticks: Int64; 85 85 InterruptCount: Integer; 86 86 Terminated: Boolean; … … 159 159 if AValue and not Assigned(FCpuThread) then begin 160 160 FCpuThread := TCpuThread.Create(True); 161 FCpuThread.FreeOnTerminate := True;161 FCpuThread.FreeOnTerminate := False; 162 162 FCpuThread.Cpu := Self; 163 163 FCpuThread.Start; … … 488 488 FInstructionHandlers[Instruction] 489 489 else raise Exception.Create('Missing handler for instruction ' + IntToStr(Integer(Instruction))); 490 Inc( ExecutedCount);490 Inc(Ticks); 491 491 end; 492 492 … … 496 496 IP := 0; 497 497 SP := 0; 498 ExecutedCount:= 0;498 Ticks := 0; 499 499 InterruptEnabled := True; 500 500 InterruptPending := False; -
branches/UltimatOS/UltimatOS.lpi
r32 r35 107 107 <ResourceBaseClass Value="Form"/> 108 108 </Unit> 109 <Unit> 110 <Filename Value="Forms/UFormCpu.pas"/> 111 <IsPartOfProject Value="True"/> 112 <ComponentName Value="FormCpu"/> 113 <ResourceBaseClass Value="Form"/> 114 </Unit> 109 115 </Units> 110 116 </ProjectOptions> -
branches/UltimatOS/UltimatOS.lpr
r32 r35 11 11 {$ENDIF} 12 12 Interfaces, // this includes the LCL widgetset 13 Forms, UFormMain, UMachine, UCpu, UMemory, UAssembler, UFormMemory 14 { you can add units after this }; 13 Forms, UFormMain, UMachine, UCpu, UMemory, UAssembler, UFormMemory, UFormCpu; 15 14 16 15 {$R *.res} … … 21 20 Application.Initialize; 22 21 Application.CreateForm(TFormMain, FormMain); 23 Application.CreateForm(TFormMemory, FormMemory);24 22 Application.Run; 25 23 end.
Note:
See TracChangeset
for help on using the changeset viewer.