Changeset 46 for branches/ByteArray/Devices/Memory.pas
- Timestamp:
- Oct 23, 2023, 11:34:54 PM (7 months ago)
- 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
-
Property svn:ignore
set to
-
branches/ByteArray/Devices/Memory.pas
r45 r46 16 16 procedure SetSize(AValue: Integer); 17 17 public 18 Position: Integer; 18 19 function Read(Address: TBigInt; Size: Byte): TBigInt; 20 function ReadPos(Size: Byte): TBigInt; 19 21 procedure Write(Address: TBigInt; Size: Byte; Value: TBigInt); 22 procedure WritePos(Size: Byte; Value: TBigInt); 23 procedure WriteStringPos(Value: string); 20 24 function GetAddressCount: Integer; override; 21 25 procedure SetChannel(Channel: TChannel); override; … … 49 53 end; 50 54 55 function TMemory.ReadPos(Size: Byte): TBigInt; 56 begin 57 Result := Read(Position, Size); 58 end; 59 51 60 procedure TMemory.Write(Address: TBigInt; Size: Byte; Value: TBigInt); 52 61 begin … … 56 65 4: PDWord(FData + Integer(Address))^ := Value; 57 66 8: PQWord(FData + Integer(Address))^ := Value; 67 end; 68 end; 69 70 procedure TMemory.WritePos(Size: Byte; Value: TBigInt); 71 begin 72 Write(Position, Size, Value); 73 end; 74 75 procedure TMemory.WriteStringPos(Value: string); 76 var 77 I: Integer; 78 begin 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)); 58 84 end; 59 85 end;
Note:
See TracChangeset
for help on using the changeset viewer.