Changeset 38 for trunk/Forms/UFormCPU.pas
- Timestamp:
- Feb 19, 2012, 10:29:55 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormCPU.pas
r37 r38 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ExtCtrls, ComCtrls; 10 11 const 12 RowSize = 16; 9 ExtCtrls; 13 10 14 11 type 15 12 16 { T InterpreterForm}13 { TFormCPU } 17 14 18 TInterpreterForm = class(TForm) 19 Label1: TLabel; 20 Label2: TLabel; 15 TFormCPU = class(TForm) 21 16 Label3: TLabel; 22 17 Label4: TLabel; 23 Label 6: TLabel;18 Label5: TLabel; 24 19 Label7: TLabel; 20 LabelMemoryPointer: TLabel; 21 LabelProgramPointer: TLabel; 25 22 LabelStepCounter: TLabel; 26 LabelProgramPointer: TLabel;27 Label5: TLabel;28 LabelMemoryPointer: TLabel;29 23 LabelStepSpeed: TLabel; 30 ListViewMemory: TListView;31 MemoInput: TMemo;32 MemoOutput: TMemo;33 Panel1: TPanel;34 Panel2: TPanel;35 Panel3: TPanel;36 Panel4: TPanel;37 Splitter1: TSplitter;38 Splitter2: TSplitter;39 Timer1: TTimer;40 ToolBar1: TToolBar;41 ToolButton1: TToolButton;42 ToolButton2: TToolButton;43 ToolButton3: TToolButton;44 ToolButton4: TToolButton;45 ToolButton5: TToolButton;46 ToolButton6: TToolButton;47 ToolButton7: TToolButton;48 procedure FormHide(Sender: TObject);49 procedure FormShow(Sender: TObject);50 procedure ListViewMemoryData(Sender: TObject; Item: TListItem);51 procedure MemoInputKeyPress(Sender: TObject; var Key: char);52 procedure Timer1Timer(Sender: TObject);53 24 private 54 25 public 55 26 LastStepCounter: Integer; 56 procedure RefreshListViewMemory; 57 procedure UpadateInterface; 27 procedure Reload; 58 28 end; 59 29 60 30 var 61 InterpreterForm: TInterpreterForm;31 FormCPU: TFormCPU; 62 32 63 33 implementation … … 71 41 SStepsPerSecond = ' steps/s'; 72 42 73 { T InterpreterForm}43 { TFormCPU } 74 44 75 procedure T InterpreterForm.Timer1Timer(Sender: TObject);45 procedure TFormCPU.Reload; 76 46 begin 77 47 if MainForm.CurrentTarget is TTargetInterpretter then … … 82 52 LabelStepSpeed.Caption := IntToStr(StepCount - LastStepCounter) + SStepsPerSecond; 83 53 LastStepCounter := StepCount; 84 MemoOutput.Lines.Text := Output;85 54 end; 86 RefreshListViewMemory;87 end;88 89 procedure TInterpreterForm.RefreshListViewMemory;90 begin91 if MainForm.CurrentTarget is TTargetInterpretter then92 with TTargetInterpretter(MainForm.CurrentTarget) do begin93 ListViewMemory.Items.Count := Trunc(Length(Memory) / RowSize);94 ListViewMemory.Refresh;95 end;96 end;97 98 procedure TInterpreterForm.UpadateInterface;99 begin100 MainForm.UpdateInterface;101 end;102 103 procedure TInterpreterForm.ListViewMemoryData(Sender: TObject; Item: TListItem);104 var105 Row: string;106 I: Integer;107 begin108 if MainForm.CurrentTarget is TTargetInterpretter then109 with TTargetInterpretter(MainForm.CurrentTarget) do110 if (Item.Index >= 0) and (Item.Index < Trunc(Length(Memory) / RowSize)) then begin111 Item.Caption := IntToHex(Item.Index * RowSize, 8);112 Row := '';113 for I := 0 to RowSize - 1 do114 Row := Row + ' ' + IntToHex(Memory[Item.Index * RowSize + I], 2);115 Item.SubItems.Add(Row);116 end;117 end;118 119 procedure TInterpreterForm.FormHide(Sender: TObject);120 begin121 Timer1.Enabled := False;122 end;123 124 procedure TInterpreterForm.FormShow(Sender: TObject);125 begin126 Timer1.Enabled := True;127 end;128 129 procedure TInterpreterForm.MemoInputKeyPress(Sender: TObject; var Key: char);130 begin131 if MainForm.CurrentTarget is TTargetInterpretter then132 with TTargetInterpretter(MainForm.CurrentTarget) do133 Input := Input + Key;134 55 end; 135 56
Note:
See TracChangeset
for help on using the changeset viewer.