Ignore:
Timestamp:
Oct 14, 2020, 7:34:55 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved assembler parsing.
  • Modified: TParser moved to separate unit.
Location:
branches/CpuSingleSize
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/CpuSingleSize

    • Property svn:ignore set to
      heaptrclog.trc
      lib
      CpuSingleSize
      CpuSingleSize.lps
      CpuSingleSize.res
      CpuSingleSize.dbg
  • branches/CpuSingleSize/UMemory.pas

    r216 r217  
    2525    Position: Integer;
    2626    procedure Write(Value: TInteger);
     27    procedure WriteString(Value: string);
    2728    procedure WriteMemory(Memory: TMemory);
    2829    function Read: TInteger;
     
    8182procedure TMemory.Write(Value: TInteger);
    8283begin
    83   if Position >= FSize then Size := Position + 1;
     84  if Position + 1 > FSize then Size := Position + 1;
    8485  Data[Position] := Value;
    8586  Inc(Position);
     87end;
     88
     89procedure TMemory.WriteString(Value: string);
     90var
     91  I: Integer;
     92begin
     93  if Length(Value) > 0 then begin
     94    if Position + Length(Value) > FSize then Size := Position + Length(Value);
     95    for I := 0 to Length(Value) - 1 do
     96      Data[Position + I] := Ord(Value[I + 1]);
     97    Inc(Position, Length(Value));
     98  end;
    8699end;
    87100
     
    91104    if Position + Memory.Size > FSize then Size := Position + Memory.Size;
    92105    Move(Memory.Data[0], Data[Position], Memory.Size * SizeOf(TInteger));
     106    Inc(Position, Memory.Size);
    93107  end;
    94108end;
Note: See TracChangeset for help on using the changeset viewer.