Press enter to see results or esc to cancel.

System Procedures Halt, RunError, Fail and Randomize

This function processes system procedures Halt and RunError.

Function Proc_Halt_RunError: Word; Far;
Var ExitCode: TExpression;
begin
  If CheckAndGetNextToken (Token_LeftParenthesis) then
    begin
      ExitCode.ExpectIntegerExpression;
      ExitCode.CheckOrdinalRange (Ptr (SystemUnitSegment, Word_TypeOffset));
      ExpectTokenAndGetNext (Token_RightParenthesis);
      ExitCode.Calculate;
      ExitCode.LoadExpressionToRegisters (urAX);
    end else GenerateInstruction_Word (XOR_AX_AX);
  GenerateInstruction_CALL_FAR (ProcParameter);
  Proc_Halt_RunError := EndSubroutine;
end;

This function processes system procedure Fail.

Function Proc_Fail: Word; Far;
begin
  If pfConstructor in PProcedureIdentifierData (Ptr (SymbolTable [stMain].Segment, ProcedureIdentifierDataOffset))^.Flags then
    begin
      GenerateCodeForNearJump (LastJumpToFail, JMP_ShortDirect);
      Proc_Fail := EndSubroutine;
    end else Error (FailOnlyAllowedWithinConstructors);
end;

This function processes system procedure Randomize. It simply calls an appropriate compiler routine.

Function Proc_Randomize: Word; Far;
begin
  GenerateInstruction_CALL_FAR (SysProc_InitRand);
  Proc_Randomize := EndSubRoutine;
end;