Changeset 10 for branches/ByteArray/Assembler.pas
- Timestamp:
- Aug 7, 2024, 12:12:42 AM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ByteArray/Assembler.pas
r9 r10 29 29 function ParseOrg: Boolean; 30 30 function ParseInstruction: Boolean; 31 function ParseInstructionParameter(ParamType: TParamType; Memory: TMemory): Boolean; 31 function ParseInstructionParameter(ParamType: TParamType; Memory: TMemory; 32 Offset: Integer): Boolean; 32 33 function ParseLabel: Boolean; 33 34 procedure UpdateLabelRefs; 34 function ParseNumParam( out Number: TInt): Boolean;35 function ParseNumParam(Offset: Integer; out Number: TInt): Boolean; 35 36 function ParseReg(out RegIndex: TRegIndex): Boolean; 36 37 function ParseDataWidth(out Size: TIntSize): Boolean; … … 96 97 end; 97 98 98 function TAssembler.ParseNumParam( out Number: TInt): Boolean;99 function TAssembler.ParseNumParam(Offset: Integer; out Number: TInt): Boolean; 99 100 var 100 101 Token: TToken; … … 116 117 Result := True; 117 118 end else begin 118 LabelRefs.Add(TLabelRef.Create(Token.Value, Memory.Position + 1 , Parser.Pos.Pos));119 LabelRefs.Add(TLabelRef.Create(Token.Value, Memory.Position + 1 + Offset, Parser.Pos.Pos)); 119 120 Number := 0; 120 121 Result := True; … … 252 253 Result := True; 253 254 while True do begin 254 if ParseNumParam( Number) then begin255 if ParseNumParam(0, Number) then begin 255 256 Memory.WritePos(1, Number); 256 257 end else begin … … 333 334 LastMessagesCount := Messages.Count; 334 335 ParamMemory.Clear; 335 if ParseInstructionParameter(ParamType, ParamMemory ) and336 if ParseInstructionParameter(ParamType, ParamMemory, InstructionMemory.Position) and 336 337 (LastMessagesCount = Messages.Count) then begin 337 338 ParamOk := True; … … 379 380 end; 380 381 381 function TAssembler.ParseInstructionParameter(ParamType: TParamType; Memory: TMemory): Boolean; 382 function TAssembler.ParseInstructionParameter(ParamType: TParamType; Memory: TMemory; 383 Offset: Integer): Boolean; 382 384 var 383 385 LastPos: TParserPos; … … 391 393 case ParamType of 392 394 ptData: begin 393 if ParseNumParam(Number) then Memory.WritePos(InstDataWidth, Number) 395 if ParseNumParam(Offset, Number) then 396 Memory.WritePos(InstDataWidth, Number) 394 397 else begin 395 398 Error(SExpectedNumber, Parser.Pos.Pos); … … 398 401 end; 399 402 ptAddress: begin 400 if ParseNumParam(Number) then Memory.WritePos(InstAddressWidth, Number) 403 if ParseNumParam(Offset, Number) then 404 Memory.WritePos(InstAddressWidth, Number) 401 405 else begin 402 406 Error(SExpectedNumber, Parser.Pos.Pos); … … 425 429 Memory.WritePos(1, Byte(RegIndex)); 426 430 if not Parser.Expect(tkSpecialSymbol, '+') then Result := False; 427 if ParseNumParam( Number) then Memory.WritePos(InstAddressWidth, Number)431 if ParseNumParam(Offset, Number) then Memory.WritePos(InstAddressWidth, Number) 428 432 else begin 429 433 Error(SExpectedNumericIndex, Parser.Pos.Pos);
Note:
See TracChangeset
for help on using the changeset viewer.