Changeset 5 for trunk/UInterpreterForm.pas
- Timestamp:
- Feb 9, 2012, 2:51:41 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UInterpreterForm.pas
r2 r5 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ExtCtrls; 9 ExtCtrls, ComCtrls; 10 11 const 12 RowSize = 16; 10 13 11 14 type … … 16 19 Label1: TLabel; 17 20 Label2: TLabel; 21 Label3: TLabel; 22 Label4: TLabel; 23 Label6: TLabel; 24 LabelStepCounter: TLabel; 25 LabelProgramPointer: TLabel; 26 Label5: TLabel; 27 LabelMemoryPointer: TLabel; 28 ListViewMemory: TListView; 18 29 MemoInput: TMemo; 19 30 MemoOutput: TMemo; 20 31 Panel1: TPanel; 21 32 Panel2: TPanel; 33 Panel3: TPanel; 34 Panel4: TPanel; 35 Splitter1: TSplitter; 36 Splitter2: TSplitter; 37 Timer1: TTimer; 38 procedure ListViewMemoryData(Sender: TObject; Item: TListItem); 39 procedure Timer1Timer(Sender: TObject); 22 40 private 23 41 { private declarations } 24 42 public 25 { public declarations }43 procedure RefreshListViewMemory; 26 44 end; 27 45 … … 31 49 implementation 32 50 51 uses 52 UMainForm; 53 33 54 {$R *.lfm} 55 56 { TInterpreterForm } 57 58 procedure TInterpreterForm.Timer1Timer(Sender: TObject); 59 begin 60 LabelProgramPointer.Caption := IntToStr(MainForm.BrainFuckInterpreter.SourcePosition); 61 LabelMemoryPointer.Caption := IntToStr(MainForm.BrainFuckInterpreter.MemoryPosition); 62 LabelStepCounter.Caption := IntToStr(MainForm.BrainFuckInterpreter.StepCount); 63 RefreshListViewMemory; 64 MemoOutput.Lines.Text := MainForm.BrainFuckInterpreter.Output; 65 end; 66 67 procedure TInterpreterForm.RefreshListViewMemory; 68 begin 69 ListViewMemory.Items.Count := Trunc(Length(MainForm.BrainFuckInterpreter.Memory) / RowSize); 70 ListViewMemory.Refresh; 71 end; 72 73 procedure TInterpreterForm.ListViewMemoryData(Sender: TObject; Item: TListItem); 74 var 75 Row: string; 76 I: Integer; 77 begin 78 with MainForm.BrainFuckInterpreter do 79 if (Item.Index >= 0) and (Item.Index < Trunc(Length(Memory) / RowSize)) then begin 80 Item.Caption := IntToHex(Item.Index * RowSize, 8); 81 Row := ''; 82 for I := 0 to RowSize - 1 do 83 Row := Row + ' ' + IntToHex(Memory[Item.Index * RowSize + I], 2); 84 Item.SubItems.Add(Row); 85 end; 86 end; 34 87 35 88 end.
Note:
See TracChangeset
for help on using the changeset viewer.