Changeset 9 for branches/ByteArray/Assembler.pas
- Timestamp:
- Aug 6, 2024, 10:31:16 PM (2 months ago)
- 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
-
Property svn:ignore
set to
-
branches/ByteArray/Assembler.pas
r5 r9 4 4 5 5 uses 6 Classes, SysUtils, Instructions, Cpu, Generics.Collections, BigInt,6 Classes, SysUtils, Instructions, Cpu, Generics.Collections, Int, 7 7 Memory, Message, Parser; 8 8 … … 23 23 FOnError: TErrorEvent; 24 24 Parser: TParser; 25 InstDataWidth: T BigIntSize;26 InstAddressWidth: T BigIntSize;25 InstDataWidth: TIntSize; 26 InstAddressWidth: TIntSize; 27 27 function ParseVar: Boolean; 28 28 function ParseDb: Boolean; … … 32 32 function ParseLabel: Boolean; 33 33 procedure UpdateLabelRefs; 34 function ParseNumParam(out Number: T BigInt): Boolean;34 function ParseNumParam(out Number: TInt): Boolean; 35 35 function ParseReg(out RegIndex: TRegIndex): Boolean; 36 function ParseDataWidth(out Size: T BigIntSize): Boolean;37 function ParseAddressWidth(out Size: T BigIntSize): Boolean;36 function ParseDataWidth(out Size: TIntSize): Boolean; 37 function ParseAddressWidth(out Size: TIntSize): Boolean; 38 38 public 39 39 InstructionSet: TInstructionInfos; 40 40 Memory: TMemory; 41 Labels: TDictionary<string, T BigInt>;41 Labels: TDictionary<string, TInt>; 42 42 LabelRefs: TList<TLabelRef>; 43 Variables: TDictionary<string, T BigInt>;43 Variables: TDictionary<string, TInt>; 44 44 Messages: TMessages; 45 DataWidth: T BigIntSize;46 AddressWidth: T BigIntSize;45 DataWidth: TIntSize; 46 AddressWidth: TIntSize; 47 47 procedure Error(Text: string; Pos: TPoint); 48 48 procedure Compile(Source: string); … … 86 86 var 87 87 I: Integer; 88 Addr: T BigInt;88 Addr: TInt; 89 89 begin 90 90 for I := 0 to LabelRefs.Count - 1 do begin … … 96 96 end; 97 97 98 function TAssembler.ParseNumParam(out Number: T BigInt): Boolean;98 function TAssembler.ParseNumParam(out Number: TInt): Boolean; 99 99 var 100 100 Token: TToken; … … 105 105 Token := Parser.ReadNext; 106 106 if Token.Kind = tkNumber then begin 107 if TryStrTo BigInt(Token.Value, Number) then begin107 if TryStrToInt64(Token.Value, Number) then begin 108 108 Result := True; 109 109 end; … … 142 142 end; 143 143 144 function TAssembler.ParseDataWidth(out Size: T BigIntSize): Boolean;144 function TAssembler.ParseDataWidth(out Size: TIntSize): Boolean; 145 145 var 146 146 LastPos: TParserPos; … … 160 160 end; 161 161 162 function TAssembler.ParseAddressWidth(out Size: T BigIntSize): Boolean;162 function TAssembler.ParseAddressWidth(out Size: TIntSize): Boolean; 163 163 var 164 164 LastPos: TParserPos; … … 218 218 TokenName: TToken; 219 219 TokenValue: TToken; 220 Number: T BigInt;220 Number: TInt; 221 221 begin 222 222 Result := False; … … 229 229 if TokenValue.Kind = tkNumber then begin 230 230 if not Labels.ContainsKey(TokenName.Value) and not Variables.ContainsKey(TokenName.Value) then begin 231 if TryStrTo BigInt(TokenValue.Value, Number) then231 if TryStrToInt64(TokenValue.Value, Number) then 232 232 Variables.Add(TokenName.Value, Number) 233 233 else Error(SExpectedNumber, TokenValue.Pos); … … 246 246 var 247 247 Token: TToken; 248 Number: T BigInt;248 Number: TInt; 249 249 begin 250 250 Result := False; … … 384 384 I: Integer; 385 385 RegIndex: TRegIndex; 386 Number: T BigInt;386 Number: TInt; 387 387 Token: TToken; 388 388 begin … … 464 464 LastPos: TParserPos; 465 465 Token: TToken; 466 Addr: T BigInt;466 Addr: TInt; 467 467 begin 468 468 Result := False; … … 513 513 InstructionSet := TInstructionInfos.Create; 514 514 InstructionSet.Init; 515 Labels := TDictionary<string, T BigInt>.Create;515 Labels := TDictionary<string, TInt>.Create; 516 516 LabelRefs := TList<TLabelRef>.Create; 517 Variables := TDictionary<string, T BigInt>.Create;517 Variables := TDictionary<string, TInt>.Create; 518 518 end; 519 519
Note:
See TracChangeset
for help on using the changeset viewer.