PROGRAM Int29;

{$M 16384,0,10000}

{ test met redirecten van output van programmas via INT 29 }

USES Dos;

VAR Buffer   : ARRAY[1..4096] OF CHAR;
    BufCount : WORD;

{$F+}
PROCEDURE Int29Handler (Flags,CS,IP,AX,BX,CX,DX,SI,DI,DS,ES,BP: WORD); INTERRUPT;
BEGIN
     Inc (BufCount);
     Buffer[BufCount]:=Char (Lo (AX));
END;
{$F-}


VAR OldInt29Handler : POINTER;
    Lp              : WORD;

BEGIN
     GetIntVec ($29,OldInt29Handler);
     SetIntVec ($29,@Int29Handler);

     WriteLn ('Running program');

     BufCount:=0;
     Exec ('C:\DOS\UTILS\ARJ.EXE','-?');

     WriteLn (DosError);
     WriteLn (DosExitCode);

     SetIntVec ($29,OldInt29Handler);

     FOR Lp:=1 TO BufCount DO
         Write (Buffer[Lp]);
     WriteLn;
END.
