Press enter to see results or esc to cancel.

System Procedures Include and Exclude

This procedure processes system procedures Include and Exclude.

Function Proc_Include_Exclude: Word; Far;
Type TIncludeExcludeData = Record
                             Mask,
                             TestMemoryRegisterOpCode: Byte;
                             TestMemoryImmediateOpCode: Word;
                           end;
Const IncludeExcludeData: Array [Include..Exclude] of TIncludeExcludeData = (
        (Mask: $01; TestMemoryRegisterOpCode: $08; TestMemoryImmediateOpCode: $0880),
        (Mask: $FE; TestMemoryRegisterOpCode: $20; TestMemoryImmediateOpCode: $2080));
Var SetExpression, ElementExpression: TExpression;
begin
  ExpectTokenAndGetNext (Token_LeftParenthesis);
  SetExpression.ExpectAssignableVariableReferenceExceptProcedureOrFunction;
  ExpectTokenAndGetNext (Token_Comma);
  ElementExpression.CalculateExpression;
  CheckElementAndSetCompatibility (ElementExpression, SetExpression);
  ElementExpression.CheckOrdinalRange (PointerFromOffsets (PSetTypeDefinition (SetExpression.TypeDefPtr)^.BaseSetTypeOffset));
  With IncludeExcludeData [ProcParameter] do
    OperationWithSet (ElementExpression, SetExpression, Mask, TestMemoryRegisterOpCode, TestMemoryImmediateOpCode);
  ExpectTokenAndGetNext (Token_RightParenthesis);
  ElementExpression.Calculate;
  GenerateLabelAndSetJumpsToIt (ElementExpression.Value.LastJumpToFalse);
  Proc_Include_Exclude := EndSubroutine;
end;