Ignore:
Timestamp:
Oct 23, 2023, 11:34:54 PM (7 months ago)
Author:
chronos
Message:
  • Added: Various useful forms, assembler and disassembler classes.
Location:
branches/ByteArray
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ByteArray

    • Property svn:ignore set to
      heaptrclog.trc
      lib
      ByteArray
      ByteArray.exe
      ByteArray.lps
      ByteArray.res
      ByteArray.dbg
  • branches/ByteArray/Devices/Memory.pas

    r45 r46  
    1616    procedure SetSize(AValue: Integer);
    1717  public
     18    Position: Integer;
    1819    function Read(Address: TBigInt; Size: Byte): TBigInt;
     20    function ReadPos(Size: Byte): TBigInt;
    1921    procedure Write(Address: TBigInt; Size: Byte; Value: TBigInt);
     22    procedure WritePos(Size: Byte; Value: TBigInt);
     23    procedure WriteStringPos(Value: string);
    2024    function GetAddressCount: Integer; override;
    2125    procedure SetChannel(Channel: TChannel); override;
     
    4953end;
    5054
     55function TMemory.ReadPos(Size: Byte): TBigInt;
     56begin
     57  Result := Read(Position, Size);
     58end;
     59
    5160procedure TMemory.Write(Address: TBigInt; Size: Byte; Value: TBigInt);
    5261begin
     
    5665    4: PDWord(FData + Integer(Address))^ := Value;
    5766    8: PQWord(FData + Integer(Address))^ := Value;
     67  end;
     68end;
     69
     70procedure TMemory.WritePos(Size: Byte; Value: TBigInt);
     71begin
     72  Write(Position, Size, Value);
     73end;
     74
     75procedure TMemory.WriteStringPos(Value: string);
     76var
     77  I: Integer;
     78begin
     79  if Length(Value) > 0 then begin
     80    if Position + Length(Value) > Size then Size := Position + Length(Value);
     81    for I := 0 to Length(Value) - 1 do
     82      Write(Position + I, 1, Ord(Value[I + 1]));
     83    Inc(Position, Length(Value));
    5884  end;
    5985end;
Note: See TracChangeset for help on using the changeset viewer.