ECHO OFF
ECHO .
ECHO INSTALL PROCEDURE FOR MONITOR-51  V2.0
ECHO COPYRIGHT KEIL ELEKTRONIK GmbH 1988-1995
ECHO .
IF %4A == PROMCHECKA GOTO PROMCHECK
IF %4A == promcheckA GOTO PROMCHECK
IF NOT %4A == A GOTO USAGE
:PROMCHECK
IF %1A == A GOTO USAGE
IF %1 == 0 GOTO SERIAL0
IF %1 == 1 GOTO SERIAL1
IF %1 == 2 GOTO SERIAL2
IF %1 == 3 GOTO SERIAL3
IF %1 == 4 GOTO SERIAL4
IF %1 == 5 GOTO SERIAL5
GOTO USAGE
:SERIAL0
ECHO      USING TIMER1 FOR GENERATING SERIAL CLOCK 
ECHO      BAUDRATE: 9600 bps   at CPU CLOCK FREQUENCY 11.059 MHz
GOTO SERIALOK
:SERIAL1
ECHO      USING INTERNAL BAUDRATE GENERATOR (only valid for 80515, 80517)
ECHO      BAUDRATE: 9600 bps   at CPU CLOCK FREQUENCY 12.000 MHz
GOTO SERIALOK
:SERIAL2
ECHO      USING TIMER 2 FOR GENERATING SERIAL CLOCK (only valid for 8052)
ECHO      BAUDRATE: 9600 bps   at CPU CLOCK FREQUENCY 12.000 MHz
GOTO SERIALOK
:SERIAL3
ECHO      USING SERIAL INTERFACE 1 (only valid for 80517)
ECHO      BAUDRATE: 9600 bps   at CPU CLOCK FREQUENCY 12.000 MHz
GOTO SERIALOK
:SERIAL4
ECHO      USING TIMER 2 FOR GENERATING SERIAL CLOCK
ECHO      ONLY FOR DALLAS 80C320/520/530 AND AMD DERIVATIVES WITH 2 DPTR's
ECHO      BAUDRATE: 9600 bps   at CPU CLOCK FREQUENCY 12.000 MHz
GOTO SERIALOK
:SERIAL5
ECHO      USING SECOND SERIAL INTERFACE OF DALLAS 80C320/520/530 WITH 
ECHO      TIMER 2 FOR GENERATING SERIAL CLOCK
ECHO      ONLY FOR DALLAS 80C320/520/530
ECHO      BAUDRATE: 9600 bps   at CPU CLOCK FREQUENCY 12.000 MHz
:SERIALOK
IF %2A == A GOTO DEFXDATA
ECHO      XDATA START-ADDRESS: 0%200H  USING 256 BYTE
GOTO XDATASPEC
:DEFXDATA
ECHO      XDATA START-ADDRESS: 0FF00H  USING 256 BYTE (default)
:XDATASPEC
IF %3A == A GOTO DEFCODE
ECHO      CODE  START-ADDRESS: 0%3A0H  USING 5 KBYTE
GOTO CODESPEC
:DEFCODE
ECHO      CODE  START-ADDRESS: 000A0H  USING 5 KBYTE  (default)
:CODESPEC

ECHO .
ECHO TRANSLATE FILE: INSTALL.A51 ...
IF %4A == A A51     INSTALL.A51 SET (SERIAL = %1)
IF NOT %4A == A A51 INSTALL.A51 SET (SERIAL = %1) SET (%4)
ECHO .

ECHO LINKING MONITOR-51 ...
IF %1 == 4 GOTO DALLAS
IF %1 == 5 GOTO DALLAS
IF %2A == A GOTO DEFX
BL51 INSTALL.OBJ,MON51.LIB TO MON51 XDATA(XDATA_AREA(0%200H))CODE(INITSEG(0%300H)& <INSTALL.LNK
GOTO SPECX
:DEFX
BL51 INSTALL.OBJ,MON51.LIB TO MON51 XDATA(XDATA_AREA(0FF00H))CODE(INITSEG(00000H)& <INSTALL.LNK
GOTO SPECX
:DALLAS
IF %2A == A GOTO DEFX
BL51 INSTALL.OBJ,MON51DP2.LIB TO MON51 XDATA(XDATA_AREA(0%200H))CODE(INITSEG(0%300H)& <INSTALL.LNK
GOTO SPECX
:DEFX
BL51 INSTALL.OBJ,MON51DP2.LIB TO MON51 XDATA(XDATA_AREA(0FF00H))CODE(INITSEG(00000H)& <INSTALL.LNK
:SPECX
ECHO .

ECHO CONVERTING TO INTEL-HEX-FILE ...
OH51 MON51
ECHO .
ECHO USE FILE MON51.HEX FOR PROM PROGRAMMING
GOTO EXIT

:USAGE
ECHO ERROR *** WRONG INVOCATION, USAGE:
ECHO .
ECHO   INSTALL  serialtype  [xdatastart  [codestart  [PROMCHECK]]]
ECHO .
ECHO   serialtype := 0  using TIMER 1  9600 bps at 11.059 MHz CPU Clock
ECHO   serialtype := 1  using baudr. gen. 9600 bps at 12.000 MHz (80515/80517)
ECHO   serialtype := 2  using TIMER 2  9600 bps at 12.000 MHz CPU Clock
ECHO   serialtype := 3  using serial interface 1  9600 bps at 12.000 MHz (80517) 
ECHO   serialtype := 4  using T2 9600 bps at 12 MHz for DALLAS 80C320/520/530
ECHO   serialtype := 5  using Ser.Ch.1 9600 bps at 12 MHz (DALLAS 80C320/520/530)
ECHO .
ECHO   xdatastart must be a page-no.  between 0 and  0FFH inclusive.
ECHO .
ECHO   codestart  must be a block-no. between 0 and  0ECH inclusive.
ECHO .
ECHO   PROMCHECK  
ECHO .
ECHO EXAMPLE:   INSTALL 0 7F 80
:EXIT
