{ Демонстрация для темы на форуме http://forum.pascal.net.ru/index.php?showtopic=32274 } program Test21h; uses Dos; type TInterruptHandler = procedure(Flags: Word); var Int21hHandler: TInterruptHandler; Buffer: string; { должна быть глобальной переменной, чтоб быть в DS } { должна заканчиваться на $ перед вызовом прерывания } function ConstructInt21hCall: LongInt; var DX: Word; begin DX := Ofs(Buffer) + 1; ConstructInt21hCall := LongInt(Integer(DX)) shl 16 or $0900; end; {function GetFlags: Word; assembler; asm pushf pop ax end;} const NormalFlags = $7202; { получено при помощи GetFlags } begin {WriteLn(GetFlags); Halt(0);} Dos.GetIntVec($21, Pointer(@Int21hHandler)); Str(93, Buffer); Buffer := Buffer + #13#10'$'; ConstructInt21hCall; { АХ и DX инициализированы возвратом из функции } Int21hHandler(NormalFlags); end.