Press enter to see results or esc to cancel.

Assembler Statement

This procedure processes Asmend blocks of assembler instructions. It creates a temporary symbol table for assembler identifiers, indirectly checks for end token and processes assembler instructions.

Procedure TStatement.Process_ASM_END_Block;
Var Saved_MainSymbolTableUsedSize: Word;
    CharPtr: PChar;
    AsmFlags: Word;
    Var List: PIdentifierList;
begin
  If Token <> Token_ASM then Error (ASM_Expected);
  TemporaryAssemblerStatementIdentifierTable := SymbolTable [stMain].UsedSize;
  CreateSymbolTable (4);
  Saved_MainSymbolTableUsedSize := SymbolTable [stMain].UsedSize;
  Repeat
    CheckStack;
    CharPtr := NextNonCommentCharacter;
    ErrorSourcePosition := CharPtr;
    If CharPtr [0] = ';' then
      begin
        CurrentSourceFile^.CurrentPosition := Ofs (CharPtr^) + 1;
        Continue;
      end;
    If (UpCase (CharPtr [0]) = 'E') and (UpCase (CharPtr [1]) = 'N') and (UpCase (CharPtr [2]) = 'D') then
      Case UpCase (CharPtr [3]) of
        '0'..'9',
        'A'..'Z', '_':
        else Break;
      end;
    MarkSourceLineNumber (GetCurrentProgramBlockSourceLineNumber);
    AsmFlags := $0000;
    If Instructions80286 in ModuleCompilerSwitches then AsmFlags := $0001;
    If (ProcedureIdentifierDataOffset <> 0) and
      (pfFar in  PProcedureIdentifierData (Ptr (SymbolTable [stMain].Segment, ProcedureIdentifierDataOffset))^.Flags)
        then AsmFlags := AsmFlags or $0100;
    ProcessAssemblerInstruction (CharPtr, 128, AsmFlags, ProcedureIdentifierDataOffset);
    CurrentSourceFile^.CurrentPosition := Ofs (CharPtr^);
  until False;
  CurrentSourceFile^.CurrentPosition := Ofs (CharPtr^) + 3;
  GetNextToken;
  If Saved_MainSymbolTableUsedSize = SymbolTable [stMain].UsedSize then SymbolTable [stMain].UsedSize :=
    TemporaryAssemblerStatementIdentifierTable;
  ES_DI_PointerDestroyed;
  StatementCode := EndSubroutine;
end;