DOS Command Line Operation

> | II.1.3 DOS Command Line Operation ASEM-51 provides full support of command line operation and batch capability as the best commercial development tools. Nevertheless, it can be integrated into foreign development environments, if desired. The assembler is invoked by typing:
>     ASEM <source> [<object> [<listing>]] [<options>]
where <source> is the 8051 assembler source, <object> is the output file, and <listing> is the assembler list file. The parameters <object> and <listing> are optional. When omitted, the file names are derived from the <source> file name, but with extensions HEX (or OMF) and LST. All file names may be specified without extensions. In these cases, the assembler adds default extensions as shown below:
file | extension
--- | ---
<source> | .A51
<object> | .HEX (with /OMF-51 option: .OMF)
<listing> | .LST
> If you want a file name to have no extension, terminate it with a '.'! Instead of file names you may also specify device names to redirect the output to character I/O ports. Device names may be terminated with a ':'! It is not checked, whether the device is existing or suitable for the task. Although it is possible to read the source file from a character device (e.g. CON:) instead of a file, this cannot be recommended: Since ASEM-51 is a two-pass assembler, it always reads the source file twice! ASEM recognizes the following options:
>      /INCLUDES:path1[;path2[; ... ;pathn]]
>      /DEFINE:symbol[:value[:type]]
>      /OMF-51
>      /COLUMNS
>      /QUIET
> When the /INCLUDES option is used, the assembler searches the specified path for include files that cannot be found in the working directory. The path may be any number of directories separated by ';' characters. The directories will be searched from left to right. The path, specified with the /INCLUDES option, is searched before the path, defined with the (optional) DOS environment variable ASEM51INC! The /DEFINE option is useful for selecting particular program variants from the command line that have been implemented with conditional assembly. It allows to define a symbol with a value and a segment type in the command line. Value and type are optional. The segment type of the symbol defaults to NUMBER, if omitted. The symbol value defaults to 0, if omitted. The symbol value may be any numerical constant. The symbol type must be one of the following characters:
>         C   =   CODE
>         D   =   DATA
>         I   =   IDATA
>         X   =   XDATA
>         B   =   BIT
>         N   =   NUMBER    (default)
By default, ASEM-51 generates an object file in Intel-HEX format. When the /OMF-51 option is specified, an absolute OMF-51 module is generated. Options may be abbreviated as long as they remain unique! Examples:
        0.)    ASEM
When invoked without parameters, the assembler displays a help screen:
               MCS-51 Family Macro Assembler ASEM-51 V1.3

               usage:   ASEM <source> [<object> [<listing>]] [options]

               options:      /INCLUDES:path1;path2;path3
                             /DEFINE:symbol[:value[:type]]
                             /OMF-51
                             /COLUMNS
                             /QUIET
        1.)    ASEM PROGRAM
will assemble the 8051 assembly language program PROGRAM.A51 and produce an Intel-HEX file PROGRAM.HEX and a listing PROGRAM.LST.
        2.)    ASEM TARZAN.ASM JANE JUNGLE.PRN
will assemble the 8051 assembly language program TARZAN.ASM and produce an Intel-HEX file JANE.HEX and a listing JUNGLE.PRN.
        3.)    ASEM PROJECT EPROM.
will assemble the 8051 assembly language program PROJECT.A51 and produce an Intel-HEX file EPROM and a listing PROJECT.LST.
        4.)    ASEM ROVER /OMF
will assemble the 8051 assembly language program ROVER.A51 and produce an absolute OMF-51 object module ROVER.OMF and a listing ROVER.LST.
        5.)    ASEM sample COM2: NUL
will assemble the 8051 assembly language program SAMPLE.A51, send the HEX file output to the serial interface COM2 and suppress the list file output by sending it to the NUL device.
        6.)    ASEM APPLICAT /INC:C:\ASEM51\MCU;D:\MICROS\8051\HEADERS
will assemble the program APPLICAT.A51, while all required include files will be searched first in the default directory, then in C:\ASEM51\MCU, and finally in D:\MICROS\8051\HEADERS.
        7.)    ASEM UNIVERSL /D:Eva_Board:8000H:C
> will assemble the program UNIVERSL.A51, while the CODE symbol EVA_BOARD will be predefined with value 8000H during assembly. When program errors are detected, they are flagged on the console. This may look as follows:
>         MCS-51 Family Macro Assembler ASEM-51 V1.3

>         APPLICAT.A51(14): must be known on first pass
>         USERBITS.INC(6): attempt to divide by zero
>         DEFINES.INC(37): symbol not defined
>         APPLICAT.A51(20): symbol not defined
>         APPLICAT.A51(27): no END statement found

>              5 errors detected
> Every error is flagged with the name of the source or include file, the local line number where it was found, and the error message itself. This output format makes it easy to integrate ASEM-51 into existing foreign development environments or workbenches. A perfect fit for the Turbo C++ IDE (and perhaps others) can be reached with the /COLUMNS option. When specified, the column numbers of program errors are output additionally after the line numbers:
>         MCS-51 Family Macro Assembler ASEM-51 V1.3

>         APPLICAT.A51(14,12): must be known on first pass
>         USERBITS.INC(6,27): attempt to divide by zero
>         DEFINES.INC(37,18): symbol not defined
>         APPLICAT.A51(20,18): symbol not defined
>         APPLICAT.A51(27,1): no END statement found

>              5 errors detected
> If errors are detected in macro expansion lines, there is no corresponding location in the source file. Therefore, the error is flagged with the name of the source or include file, and the local line number from where the macro expansion has been invoked. (For callable macros this is the line with the macro call, and for repeat blocks this is the ENDM line.) To give the user a hint, the macro name and expansion line (and optionally column) number are inserted before the actual error message:
>         MCS-51 Family Macro Assembler ASEM-51 V1.3

>         UARTIO.A51(44,1): RECEIVE(3,22): segment type mismatch
>         UARTIO.A51(87,1): REPT(4,19): symbol not defined
>         UARTIO.A51(87,1): REPT(8,19): symbol not defined
>         UARTIO.A51(87,1): REPT(12,19): symbol not defined

>              4 errors detected
The expansion line number is the number of the expansion line within the corresponding macro expansion, starting with 1. If the error occurs during expansion of a repeat block, the keyword REPT replaces the macro name. The /QUIET option suppresses all console output except error messages. When terminating, ASEM-51 returns an exit code to the operating system:
situation | ERRORLEVEL
--- | ---
no errors | 0
program errors detected | 1
fatal runtime error | 2
Note: Warnings do not influence the exit code!