Changeset 70 for trunk/Target
- Timestamp:
- Oct 11, 2015, 6:50:33 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Target/UTargetInterpretter.pas
r68 r70 30 30 TTargetInterpretter = class(TBFTarget) 31 31 private 32 FCellSize: Integer;33 32 FThreadState: Boolean; 34 33 FThread: TTargetInterpretterThread; 35 34 FStepCount: Integer; 36 35 FCommandTable: array[TMachineCommand] of TCommandHandler; 37 function GetMemorySize: Integer;38 procedure SetMemorySize(AValue: Integer);39 36 procedure SetThread(State: Boolean); 40 37 procedure PrepareJumpTable; … … 74 71 constructor Create; override; 75 72 destructor Destroy; override; 76 procedure LoadFromRegistry(Root: HKEY; Key: string); override;77 procedure SaveToRegistry(Root: HKEY; Key: string); override;78 73 property StepCount: Integer read FStepCount; 79 property MemorySize: Integer read GetMemorySize write SetMemorySize;80 property CellSize: Integer read FCellSize write FCellSize;81 74 end; 82 75 … … 146 139 end; 147 140 148 function TTargetInterpretter.GetMemorySize: Integer;149 begin150 Result := Length(Memory);151 end;152 153 procedure TTargetInterpretter.SetMemorySize(AValue: Integer);154 begin155 SetLength(Memory, AValue);156 end;157 158 141 procedure TTargetInterpretter.SetThread(State: Boolean); 159 142 begin … … 175 158 I: Integer; 176 159 begin 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 177 167 SetLength(Loop, 0); 178 168 for I := 0 to Length(FProgram) - 1 do begin … … 259 249 begin 260 250 inherited; 251 SetLength(Memory, MemorySize); 261 252 PrepareJumpTable; 262 253 FProgramIndex := 0; … … 412 403 Capabilities := [tcRun, tcPause, tcStop, tcCompile, tcStepOut, tcStepInto, 413 404 tcStepOver, tcRunToCursor]; 414 MemorySize := 30000;415 CellSize := 256;416 405 // Base commands 417 406 FCommandTable[cmInc] := CommandInc; … … 434 423 end; 435 424 436 procedure TTargetInterpretter.LoadFromRegistry(Root: HKEY; Key: string);437 begin438 inherited LoadFromRegistry(Root, Key);439 with TRegistryEx.Create do440 try441 RootKey := Root;442 OpenKey(Key, True);443 CellSize := ReadIntegerWithDefault('CellSize', 256);444 MemorySize := ReadIntegerWithDefault('MemorySize', 30000);445 finally446 Free;447 end;448 end;449 450 procedure TTargetInterpretter.SaveToRegistry(Root: HKEY; Key: string);451 begin452 inherited SaveToRegistry(Root, Key);453 with TRegistryEx.Create do454 try455 RootKey := Root;456 OpenKey(Key, True);457 WriteInteger('CellSize', CellSize);458 WriteInteger('MemorySize', MemorySize);459 finally460 Free;461 end;462 end;463 464 425 end. 465 426
Note:
See TracChangeset
for help on using the changeset viewer.