Changeset 70 for trunk/Target


Ignore:
Timestamp:
Oct 11, 2015, 6:50:33 PM (9 years ago)
Author:
chronos
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Target/UTargetInterpretter.pas

    r68 r70  
    3030  TTargetInterpretter = class(TBFTarget)
    3131  private
    32     FCellSize: Integer;
    3332    FThreadState: Boolean;
    3433    FThread: TTargetInterpretterThread;
    3534    FStepCount: Integer;
    3635    FCommandTable: array[TMachineCommand] of TCommandHandler;
    37     function GetMemorySize: Integer;
    38     procedure SetMemorySize(AValue: Integer);
    3936    procedure SetThread(State: Boolean);
    4037    procedure PrepareJumpTable;
     
    7471    constructor Create; override;
    7572    destructor Destroy; override;
    76     procedure LoadFromRegistry(Root: HKEY; Key: string); override;
    77     procedure SaveToRegistry(Root: HKEY; Key: string); override;
    7873    property StepCount: Integer read FStepCount;
    79     property MemorySize: Integer read GetMemorySize write SetMemorySize;
    80     property CellSize: Integer read FCellSize write FCellSize;
    8174  end;
    8275
     
    146139end;
    147140
    148 function TTargetInterpretter.GetMemorySize: Integer;
    149 begin
    150   Result := Length(Memory);
    151 end;
    152 
    153 procedure TTargetInterpretter.SetMemorySize(AValue: Integer);
    154 begin
    155   SetLength(Memory, AValue);
    156 end;
    157 
    158141procedure TTargetInterpretter.SetThread(State: Boolean);
    159142begin
     
    175158  I: Integer;
    176159begin
     160  for I := 0 to Length(FProgram) - 1 do begin
     161    case FProgram[I].Command of
     162      cmLoopStart: FProgram[I].Parameter := 0;
     163      cmLoopEnd: FProgram[I].Parameter := 0;
     164    end;
     165  end;
     166
    177167  SetLength(Loop, 0);
    178168  for I := 0 to Length(FProgram) - 1 do begin
     
    259249begin
    260250  inherited;
     251  SetLength(Memory, MemorySize);
    261252  PrepareJumpTable;
    262253  FProgramIndex := 0;
     
    412403  Capabilities := [tcRun, tcPause, tcStop, tcCompile, tcStepOut, tcStepInto,
    413404    tcStepOver, tcRunToCursor];
    414   MemorySize := 30000;
    415   CellSize := 256;
    416405  // Base commands
    417406  FCommandTable[cmInc] := CommandInc;
     
    434423end;
    435424
    436 procedure TTargetInterpretter.LoadFromRegistry(Root: HKEY; Key: string);
    437 begin
    438   inherited LoadFromRegistry(Root, Key);
    439   with TRegistryEx.Create do
    440   try
    441     RootKey := Root;
    442     OpenKey(Key, True);
    443     CellSize := ReadIntegerWithDefault('CellSize', 256);
    444     MemorySize := ReadIntegerWithDefault('MemorySize', 30000);
    445   finally
    446     Free;
    447   end;
    448 end;
    449 
    450 procedure TTargetInterpretter.SaveToRegistry(Root: HKEY; Key: string);
    451 begin
    452   inherited SaveToRegistry(Root, Key);
    453   with TRegistryEx.Create do
    454   try
    455     RootKey := Root;
    456     OpenKey(Key, True);
    457     WriteInteger('CellSize', CellSize);
    458     WriteInteger('MemorySize', MemorySize);
    459   finally
    460     Free;
    461   end;
    462 end;
    463 
    464425end.
    465426
Note: See TracChangeset for help on using the changeset viewer.