System Procedures FillChar and Move

This function processes system procedure FillChar.
Function Proc_FillChar: Word; Far;
Var Destination, Count, Char: TExpression;
begin
  ExpectTokenAndGetNext (Token_LeftParenthesis);
  Destination.ExpectAssignableVariableReferenceExceptProcAndFuncAndPushPointerToMemory;
  ExpectTokenAndGetNext (Token_Comma);
  With Count do
    begin
      ExpectIntegerExpression;
      CheckOrdinalRange (Ptr (SystemUnitSegment, Word_TypeOffset));
      PushExpression
    end;
  ExpectTokenAndGetNext (Token_Comma);
  With Char do
    begin
      ExpectOrdinalExpression;
      CheckOrdinalRange (Ptr (SystemUnitSegment, Byte_TypeOffset));
      PushExpression;
    end;
  ExpectTokenAndGetNext (Token_RightParenthesis);
  StoreCode_icGoSub (Destination.IntermediateCodeOffset);
  StoreCode_icGoSub (Count.IntermediateCodeOffset);
  StoreCode_icGoSub (Char.IntermediateCodeOffset);
  GenerateInstruction_CALL_FAR (SysProc_FillMem);
  Proc_FillChar := EndSubroutine;
end;
This function processes system procedure Move.
Function Proc_Move: Word; Far;
Var Source, Destination, Count: TExpression;
begin
  ExpectTokenAndGetNext (Token_LeftParenthesis);
  With Source do
    begin
      ExpectVariableReferenceExceptProcedureOrFunction;
      ConvertToPointerAndPush
    end;
  ExpectTokenAndGetNext (Token_Comma);
  Destination.ExpectAssignableVariableReferenceExceptProcAndFuncAndPushPointerToMemory;
  ExpectTokenAndGetNext (Token_Comma);
  With Count do
    begin
      ExpectIntegerExpression;
      CheckOrdinalRange (Ptr (SystemUnitSegment, Word_TypeOffset));
      PushExpression
    end;
  ExpectTokenAndGetNext (Token_RightParenthesis);
  StoreCode_icGoSub (Source.IntermediateCodeOffset);
  StoreCode_icGoSub (Destination.IntermediateCodeOffset);
  StoreCode_icGoSub (Count.IntermediateCodeOffset);
  GenerateInstruction_CALL_FAR (SysProc_MoveMem);
  Proc_Move := EndSubroutine;
end;
 
 
 
© 2017 Turbo Pascal | Privacy Policy