Ignore:
Timestamp:
Aug 1, 2024, 10:47:04 PM (3 months ago)
Author:
chronos
Message:
  • Added: Assembler to parse instructions from text string and produce binary code.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/bigint/Memory.pas

    r3 r4  
    2121    procedure WritePos(Data: TInt);
    2222    function ReadPos: TInt;
     23    procedure CopyFrom(Source: TMemory; Dst, Src, Count: TInt);
     24    procedure WriteStringPos(Value: string);
    2325    property Size: TInt read GetSize write SetSize;
    2426    property Position: TInt read FPosition write FPosition;
     27    property Items[Index: TInt]: TInt read Read write Write; default;
    2528  end;
    2629
     
    6265end;
    6366
     67procedure TMemory.CopyFrom(Source: TMemory; Dst, Src, Count: TInt);
     68var
     69  I: Integer;
     70begin
     71  for I := 0 to Count - 1 do begin
     72    Write(Dst, Source.Read(Src));
     73    Inc(Dst);
     74    Inc(Src);
     75  end;
     76end;
     77
     78procedure TMemory.WriteStringPos(Value: string);
     79var
     80  I: Integer;
     81begin
     82  if Length(Value) > 0 then begin
     83    if Position + Length(Value) > Size then Size := Position + Length(Value);
     84    for I := 0 to Length(Value) - 1 do
     85      Items[Position + I] := Ord(Value[I + 1]);
     86    Inc(FPosition, Length(Value));
     87  end;
     88end;
     89
    6490end.
    6591
Note: See TracChangeset for help on using the changeset viewer.