UNIT OvrUnit;

INTERFACE

IMPLEMENTATION

USES Overlay,
     Dos,
     Ramon;

{--------------------------------------------------------------------------}
{ Unit Initialization                                                      }
{                                                                          }
{ Deze unit wordt als eerste mee-gelinkt en zorgt ervoor dat het overlay   }
{ systeem geinitialiseerd is voordat overlayed units hun init code         }
{ aangeroepen wordt.                                                       }
{                                                                          }

VAR Path : STRING[80];
    Lp   : BYTE;

BEGIN
     Path:=UNC_FExpand (ParamStr (0));
     Path:=Copy (Path,1,Length (Path)-3)+'OVR';

     OvrInit (Path);
     IF (OvrResult <> ovrOk) THEN
     BEGIN
          IF (OvrResult = ovrNotFound) THEN
             WriteLn ('Cannot find '+Path)
          ELSE
              WriteLn ('Error ',OvrResult,' while loading '+Path);
          WriteLn ('Aborting');
          Halt;
     END;

     OvrInitEMS;
     OvrSetBuf (OvrGetBuf+50000);

     FOR Lp:=1 TO ParamCount DO
     BEGIN
          Path:=UpCaseString (ParamStr (Lp));

          IF (Path = '-OVR25K') THEN
             OvrSetBuf (OvrGetBuf+25*1024);

          IF (Path = '-OVR50K') THEN
             OvrSetBuf (OvrGetBuf+50*1024);
     END;
END.
