@echo off
rem -------------------------------------------------------------------------
rem wload - load the monitor in the foreground; 
rem usage: wload NN EMM
rem where: NN  = network { en, fd, tr }
rem        EMM = portion of memory to exclude { e:d800-dfff }
rem note:  wload.bat is needed to work around a memory fragmentation problem
rem        encountered during the batch file processing under DOS!
rem -------------------------------------------------------------------------

rem - check if the monitor driver is already loaded
if exist \config\%1mon.ins goto loaded

rem - load the monitor driver
echo Loading the monitor driver...
if "%1"=="fd" fixemm clear > nul
if "%1"=="fd" fixemm %2
%1mondrv
if errorlevel 1 goto load_error
:loaded

rem - update the monitor semaphore file
if exist \config\%1mon.rem del \config\%1mon.rem
echo installed > \config\%1mon.ins

rem - load the monitor front end
if not "%1"=="fd" fixemm clear > nul
if not "%1"=="fd" fixemm %2

rem - special case for FDDI monitor beam splitter
call c:\tools\autosetv %1 M START
echo Loading the monitor...
if "%1"=="fd" %1mon SPLIT %scr% %start% %5 %6 %7 %8 %9
if not "%1"=="fd" %1mon %scr% %start% %5 %6 %7 %8 %9
call c:\tools\autosetv %1 M END
if errorlevel 1 goto load_error
goto exit

rem - unable to load the monitor driver or monitor
:load_error
echo Fatal Error: Unable to load the monitor!
echo Re-boot the system and configure the monitor again.
echo If the problem persists, contact Technical Support.
pause
goto exit

rem - back to the menu
:exit
if not "%1"=="fd" fixemm clear > nul
cd \
menu

