Ignore:
Timestamp:
Aug 6, 2024, 10:31:16 PM (2 months ago)
Author:
chronos
Message:
  • Modified: Optimized DeviceMapper read/write handlers calls without case statement.
  • Modified: Use TInt as base data type which can be redefined to different higher integer type. For start it is Int64.
Location:
branches/ByteArray
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ByteArray

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

    r5 r9  
    44
    55uses
    6   Classes, SysUtils, Instructions, Cpu, Generics.Collections, BigInt,
     6  Classes, SysUtils, Instructions, Cpu, Generics.Collections, Int,
    77  Memory, Message, Parser;
    88
     
    2323    FOnError: TErrorEvent;
    2424    Parser: TParser;
    25     InstDataWidth: TBigIntSize;
    26     InstAddressWidth: TBigIntSize;
     25    InstDataWidth: TIntSize;
     26    InstAddressWidth: TIntSize;
    2727    function ParseVar: Boolean;
    2828    function ParseDb: Boolean;
     
    3232    function ParseLabel: Boolean;
    3333    procedure UpdateLabelRefs;
    34     function ParseNumParam(out Number: TBigInt): Boolean;
     34    function ParseNumParam(out Number: TInt): Boolean;
    3535    function ParseReg(out RegIndex: TRegIndex): Boolean;
    36     function ParseDataWidth(out Size: TBigIntSize): Boolean;
    37     function ParseAddressWidth(out Size: TBigIntSize): Boolean;
     36    function ParseDataWidth(out Size: TIntSize): Boolean;
     37    function ParseAddressWidth(out Size: TIntSize): Boolean;
    3838  public
    3939    InstructionSet: TInstructionInfos;
    4040    Memory: TMemory;
    41     Labels: TDictionary<string, TBigInt>;
     41    Labels: TDictionary<string, TInt>;
    4242    LabelRefs: TList<TLabelRef>;
    43     Variables: TDictionary<string, TBigInt>;
     43    Variables: TDictionary<string, TInt>;
    4444    Messages: TMessages;
    45     DataWidth: TBigIntSize;
    46     AddressWidth: TBigIntSize;
     45    DataWidth: TIntSize;
     46    AddressWidth: TIntSize;
    4747    procedure Error(Text: string; Pos: TPoint);
    4848    procedure Compile(Source: string);
     
    8686var
    8787  I: Integer;
    88   Addr: TBigInt;
     88  Addr: TInt;
    8989begin
    9090  for I := 0 to LabelRefs.Count - 1 do begin
     
    9696end;
    9797
    98 function TAssembler.ParseNumParam(out Number: TBigInt): Boolean;
     98function TAssembler.ParseNumParam(out Number: TInt): Boolean;
    9999var
    100100  Token: TToken;
     
    105105  Token := Parser.ReadNext;
    106106  if Token.Kind = tkNumber then begin
    107     if TryStrToBigInt(Token.Value, Number) then begin
     107    if TryStrToInt64(Token.Value, Number) then begin
    108108      Result := True;
    109109    end;
     
    142142end;
    143143
    144 function TAssembler.ParseDataWidth(out Size: TBigIntSize): Boolean;
     144function TAssembler.ParseDataWidth(out Size: TIntSize): Boolean;
    145145var
    146146  LastPos: TParserPos;
     
    160160end;
    161161
    162 function TAssembler.ParseAddressWidth(out Size: TBigIntSize): Boolean;
     162function TAssembler.ParseAddressWidth(out Size: TIntSize): Boolean;
    163163var
    164164  LastPos: TParserPos;
     
    218218  TokenName: TToken;
    219219  TokenValue: TToken;
    220   Number: TBigInt;
     220  Number: TInt;
    221221begin
    222222  Result := False;
     
    229229        if TokenValue.Kind = tkNumber then begin
    230230          if not Labels.ContainsKey(TokenName.Value) and not Variables.ContainsKey(TokenName.Value) then begin
    231             if TryStrToBigInt(TokenValue.Value, Number) then
     231            if TryStrToInt64(TokenValue.Value, Number) then
    232232              Variables.Add(TokenName.Value, Number)
    233233            else Error(SExpectedNumber, TokenValue.Pos);
     
    246246var
    247247  Token: TToken;
    248   Number: TBigInt;
     248  Number: TInt;
    249249begin
    250250  Result := False;
     
    384384  I: Integer;
    385385  RegIndex: TRegIndex;
    386   Number: TBigInt;
     386  Number: TInt;
    387387  Token: TToken;
    388388begin
     
    464464  LastPos: TParserPos;
    465465  Token: TToken;
    466   Addr: TBigInt;
     466  Addr: TInt;
    467467begin
    468468  Result := False;
     
    513513  InstructionSet := TInstructionInfos.Create;
    514514  InstructionSet.Init;
    515   Labels := TDictionary<string, TBigInt>.Create;
     515  Labels := TDictionary<string, TInt>.Create;
    516516  LabelRefs := TList<TLabelRef>.Create;
    517   Variables := TDictionary<string, TBigInt>.Create;
     517  Variables := TDictionary<string, TInt>.Create;
    518518end;
    519519
Note: See TracChangeset for help on using the changeset viewer.