@echo off
set DISK=%1
set FLOPPY=%2

if "%DISK%"=="" goto usage
if "%FLOPPY%"=="" goto usage
goto %DISK%

:D0
    if EXIST %FLOPPY%\*.EXE (
        echo Floppy in drive %FLOPPY% must be empty!
        goto end
    )
    echo ********** Disk 0/2
    copy/b INSTALL.EXE* %FLOPPY%
    if errorlevel 1 goto bad
    copy/b INSTALL.DAT* %FLOPPY%
    if errorlevel 1 goto bad
    copy/b FX???.LOP* %FLOPPY%
    if errorlevel 1 goto bad
    copy/b FX???.HLP* %FLOPPY%
    if errorlevel 1 goto bad

    echo D0>fxlabel
    label %FLOPPY%<fxlabel
    if errorlevel 1 goto bad
    del fxlabel

    echo.
    echo Remember to modify INSTALL.DAT on the language disk to
    echo remove the # on the three Language Disk lines and to
    echo include only the .adp lines for the adapters that are
    echo really included on Disk 1.

    goto OK

:D1
    if EXIST %FLOPPY%\*.EXE (
        echo Floppy in drive %FLOPPY% must be empty!
        goto end
    )
    echo ********** Disk 1/2
    copy/b INSTALL.EXE* %FLOPPY%
    if errorlevel 1 goto bad
    copy/b INSTALL.DAT* %FLOPPY%
    if errorlevel 1 goto bad
    copy/b FX001.LOP* %FLOPPY%
    if errorlevel 1 goto bad
    copy/b FX001.HLP* %FLOPPY%
    if errorlevel 1 goto bad
    if EXIST FX002.LOP copy/b FX002.LOP* %FLOPPY%
    if errorlevel 1 goto bad
    copy/b FAX??.ADP* %FLOPPY%
    if errorlevel 1 goto bad
    copy/b README.DOC* %FLOPPY%
    if errorlevel 1 goto bad
    copy/b FXRX.ADR* %FLOPPY%
    if errorlevel 1 goto bad
    if EXIST FMD.SYS copy/b FMD.SYS* %FLOPPY%
    if errorlevel 1 goto bad
    if EXIST MFEXE.EXE copy/b MFEXE.EXE* %FLOPPY%
    if errorlevel 1 goto bad
    if EXIST ADD.EXE copy/b ADD.EXE* %FLOPPY%
    if errorlevel 1 goto bad
    if EXIST FX.NOP copy/b FX.NOP* %FLOPPY%
    if errorlevel 1 goto bad
    if EXIST FX*.FOP copy/b FX*.FOP* %FLOPPY%
    if errorlevel 1 goto bad

    echo D1>fxlabel
    label %FLOPPY%<fxlabel
    if errorlevel 1 goto bad
    del fxlabel
    goto OK

:D2
    if EXIST %FLOPPY%\*.EXE (
        echo Floppy in drive %FLOPPY% must be empty!
        goto end
    )
    echo ********** Disk 2/2
    copy/b FAX.EXE* %FLOPPY%
    if errorlevel 1 goto bad
    copy/b FXFILE.SOM* %FLOPPY%
    if errorlevel 1 goto bad
    copy/b FXRCV.EXE* %FLOPPY%
    if errorlevel 1 goto bad
    copy/b FXPRINT.DRV* %FLOPPY%
    if errorlevel 1 goto bad
    copy/b FXPRINT.EA2* %FLOPPY%
    if errorlevel 1 goto bad
    if EXIST FX*.POP copy/b FX*.POP* %FLOPPY%
    if errorlevel 1 goto bad
    copy/b FAX.LOG* %FLOPPY%
    if errorlevel 1 goto bad
    copy/b FAX.IDX* %FLOPPY%
    if errorlevel 1 goto bad
    copy/b *.PBK* %FLOPPY%
    if errorlevel 1 goto bad
    if EXIST *.FAX copy/b *.FAX* %FLOPPY%
    if errorlevel 1 goto bad
    if EXIST *.MSG copy/b *.MSG* %FLOPPY%
    if errorlevel 1 goto bad
    if EXIST *.TXT copy/b *.TXT* %FLOPPY%
    if errorlevel 1 goto bad
    if EXIST *.WAV copy/b *.WAV* %FLOPPY%
    if errorlevel 1 goto bad
    if EXIST *.BMP copy/b *.BMP* %FLOPPY%
    if errorlevel 1 goto bad
    if EXIST *.TIF copy/b *.TIF* %FLOPPY%
    if errorlevel 1 goto bad
    if EXIST COVER*.CVR copy/b COVER*.CVR* %FLOPPY%
    if errorlevel 1 goto bad
    if EXIST COVER*.EA2 copy/b COVER*.EA2* %FLOPPY%
    if errorlevel 1 goto bad
    if EXIST LPT49.* copy/b LPT49.* %FLOPPY%
    if errorlevel 1 goto bad
    if EXIST FXDLR7.* copy/b FXDLR7.* %FLOPPY%
    if errorlevel 1 goto bad

    echo D2>fxlabel
    label %FLOPPY%<fxlabel
    if errorlevel 1 goto bad
    del fxlabel
    goto OK

:CRS
    if EXIST %FLOPPY%\*.EXE (
        echo Floppy in drive %FLOPPY% must be empty!
        goto end
    )
    echo ********** CRSzip OCR-engine disk
    copy/b CRSZIP.EXE* %FLOPPY%

    echo CRSZIP>fxlabel
    label %FLOPPY%<fxlabel
    if errorlevel 1 goto bad
    del fxlabel
    goto OK

:CGI
    if EXIST %FLOPPY%\*.EXE (
        echo Floppy in drive %FLOPPY% must be empty!
        goto end
    )
    echo ********** CGIzip PCL-engine disk
    copy/b CGIZIP.EXE* %FLOPPY%

    echo CGIZIP>fxlabel
    label %FLOPPY%<fxlabel
    if errorlevel 1 goto bad
    del fxlabel
    goto OK

:usage
    echo Usage:
    echo.
    echo   FxDisk D0 A:        -- makes Language Disk 0 (optional)
    echo.
    echo   FxDisk D1 A:        -- makes Disk 1
    echo   FxDisk D2 A:        -- makes Disk 2
    echo.
    echo   FxDisk CRS A:       -- makes CRSzip.exe disk (optional OCR engine)
    echo   FxDisk CGI A:       -- makes CGIzip.exe disk (optional PCL engine)
    echo.
    echo Notes:
    echo     Floppy disks must already be formatted.
    echo     Unpack Pro or Multiline into current directory.
    echo     Optionally unpack any upgrade files into current directory.
    echo     Optionally unpack any ISV/OEM file into current directory.
    echo     Then run FxDisk to make disks.
    goto end
:bad
    echo.
    echo Failed! Please check command arguments and files in current directory.
    goto end
:OK
    echo.
    echo OK!
:end
