Now that the basic form of an Assembly language program has been given, the next question is: How it is created, assembled, and made ready to run? The steps to create an executable Assembly language program are outlined as follows.

  1. First we use an editor to type in a program similar to Program 2-1.Many excellent editors or word processors are available that can be used to create and/or edit the program. A widely used editor is the MS-DOS EDIT program (or Notepad in Windows), which comes with all Microsoft operating systems.Notice that the editor must be able to produce an ASCII file. For many assemblers, the file names follow the usual DOS conventions, but the source file has the extension “asm” or “src”, depending on which assembler you are using. Check your assembler for the convention. The “asm” extension for the source file is used by an assembler in the next step.
  2. The “asm” source file containing the program code created in step 1 is fed to an 8051 assembler. The assembler converts the instructions into

Figure 2-2. Steps to Create a Program

machine code. The assembler will produce an object file and a list file. The extension for the object file is “obj” while the extension for the list file is “1st”.
  1. Assemblers require a third step called linking. The link program takes one or
    more object files and produces an absolute object file with the extension “abs”
    This abs file is used by 8051 trainers that have a monitor program.
  2. Next, the “abs” file is fed into a program called “OH” (object to hex convert
    er), which creates a file with extension “hex” that is ready to burn into ROM.
    This program comes with all 8051 assemblers. Recent Windows-based assem
    blers combine steps 2 through 4 into one step.
More about “asm” and “obj” files
The “asm” file is also called the source file and for this reason some assemblers require that this file have the “src” extension. Check your 8051 assembler to see which extension it requires. As mentioned earlier, this file is created with an editor such as DOS EDIT or Windows Notepad. The 8051 assembler converts the asm file’s Assembly language instructions into machine language and provides the obj (object) file. In addition to creating the object file, the assembler also produces the 1st file (list file).
1st file
The 1st (list) file, which is optional, is very useful to the programmer because it lists all the opcodes and addresses as well as errors that the assembler detected. Many assemblers assume that the list file is not wanted unless you indicate that you want to produce it. This file can be accessed by an editor such as DOS EDIT and displayed on the monitor or sent to the printer to produce a hard copy. The programmer uses the list file to find syntax errors. It is only after fixing all the errors indicated in the 1st file that the obj file is ready to be input to the linker program.

Program 2-1: List File

Next post:

Previous post: