I/O System Functions

These procedures process system functions IOResult, ParamStr and ParamCount.
Procedure Func_IOResult_ParamCount; Far;
begin
  GenerateInstruction_CALL_FAR (FuncParameter);
  With Expression^ do
    begin
      Expression^.EndIntermediateCodeSubroutine;
      Location := elRegister;
      DataType := [itSigned, it16Bit];
      Case FuncParameter of
        SysProc_GetIORes: UsedRegisters := [                  urAX];
        else              UsedRegisters := [urBX, urDX, urCX, urAX];
      end;
      LocationData.Register := rDX_AX;
      TypeDefPtr := Ptr (SystemUnitSegment, LongInt_TypeOffset);
    end;
end;
Procedure Func_ParamStr; Far;
begin
  Expression^.ExpectIntegerExpressionInParentheses;
  Expression^.CheckOrdinalRange (Ptr (SystemUnitSegment, Integer_TypeOffset));
  Expression^.PushExpression;
  Expression^.CreateSpaceInStackFrameAndPushAddressToIt ($0100);
  Expression^.Calculate;
  GenerateInstruction_CALL_FAR (SysProc_GetParStr);
  With Expression^ do
    begin
      Expression^.EndIntermediateCodeSubroutine;
      UsedRegisters := [urSP, urDX, urAX];
      TypeDefPtr := Ptr (SystemUnitSegment, String_TypeOffset);
    end;
end;
 
 
 
© 2017 Turbo Pascal | Privacy Policy