Ignore:
Timestamp:
Feb 18, 2012, 8:44:10 PM (12 years ago)
Author:
chronos
Message:
  • Modified: Target specific options is maintained by target class in registry.
  • Modified: Integer index TargetIndex replaced by object reference CurrentTarget.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UInterpretterForm.pas

    r24 r32  
    6464
    6565uses
    66   UMainForm;
     66  UMainForm, UTargetInterpretter;
    6767
    6868{$R *.lfm}
     
    7575procedure TInterpreterForm.Timer1Timer(Sender: TObject);
    7676begin
    77   LabelProgramPointer.Caption := IntToStr(MainForm.BrainFuckInterpreter.SourcePosition);
    78   LabelMemoryPointer.Caption := IntToStr(MainForm.BrainFuckInterpreter.MemoryPosition);
    79   LabelStepCounter.Caption := IntToStr(MainForm.BrainFuckInterpreter.StepCount);
    80   LabelStepSpeed.Caption := IntToStr(MainForm.BrainFuckInterpreter.StepCount - LastStepCounter) + SStepsPerSecond;
    81   LastStepCounter := MainForm.BrainFuckInterpreter.StepCount;
     77  if MainForm.CurrentTarget is TTargetInterpretter then
     78  with TTargetInterpretter(MainForm.CurrentTarget) do begin
     79    LabelProgramPointer.Caption := IntToStr(SourcePosition);
     80    LabelMemoryPointer.Caption := IntToStr(MemoryPosition);
     81    LabelStepCounter.Caption := IntToStr(StepCount);
     82    LabelStepSpeed.Caption := IntToStr(StepCount - LastStepCounter) + SStepsPerSecond;
     83    LastStepCounter := StepCount;
     84    MemoOutput.Lines.Text := Output;
     85  end;
    8286  RefreshListViewMemory;
    83   MemoOutput.Lines.Text := MainForm.BrainFuckInterpreter.Output;
    8487end;
    8588
    8689procedure TInterpreterForm.RefreshListViewMemory;
    8790begin
    88   ListViewMemory.Items.Count := Trunc(Length(MainForm.BrainFuckInterpreter.Memory) / RowSize);
    89   ListViewMemory.Refresh;
     91  if MainForm.CurrentTarget is TTargetInterpretter then
     92  with TTargetInterpretter(MainForm.CurrentTarget) do begin
     93    ListViewMemory.Items.Count := Trunc(Length(Memory) / RowSize);
     94    ListViewMemory.Refresh;
     95  end;
    9096end;
    9197
     
    100106  I: Integer;
    101107begin
    102   with MainForm.BrainFuckInterpreter do
     108  if MainForm.CurrentTarget is TTargetInterpretter then
     109  with TTargetInterpretter(MainForm.CurrentTarget) do
    103110  if (Item.Index >= 0) and (Item.Index < Trunc(Length(Memory) / RowSize)) then begin
    104111    Item.Caption := IntToHex(Item.Index * RowSize, 8);
     
    122129procedure TInterpreterForm.MemoInputKeyPress(Sender: TObject; var Key: char);
    123130begin
    124   with MainForm.BrainFuckInterpreter do Input := Input + Key;
     131  if MainForm.CurrentTarget is TTargetInterpretter then
     132  with TTargetInterpretter(MainForm.CurrentTarget) do
     133    Input := Input + Key;
    125134end;
    126135
Note: See TracChangeset for help on using the changeset viewer.