Generation of .HEX file using a linker


The file MULT.ASM which is created by using an editor is simply a text file. We cannot execute this file directly. At first we have to assemble the file, and then we have to link it. The step of assembly the translation of the program of assembly language to machine code requires the generation of a .OBJ file.

Now a .HEX file is generated by using a linker. We have seen previously that how the naming of the input and output file is done.

Input filename

The source name of the file must be responded by the user. In the given example the user must respond to ‘MULT.ASM’. MULT is also sufficient to carry out the task. After that the user is prompted by the assembler for the name of the output file which is as follows:

Output filename

The user responding with the change of address ‘<cr>’, the resulting name of the output file in the given example must be ‘MULT.OBJ’. While responding with ‘DIV’ by the user, the name of the output file must be ‘DIV.OBJ’. In general, the name of the output file is responded by the user by the change of address i.e ‘<cr>’. If we choose the file MULT.LST to get generated on the disk, so by using a text editor the errors can be identified and the contents of MULT.LST can be seen. Thereafter by the help of the editor, any corrections can be corrected with the help of the editor in the MULT.ASM file. Now the next step is the linking of the object module MULT.OBJ containing the machine code. A linker called 2500 A.D. is used which enables the writing of assembly language programs of many modules of object. The relocation of the address as well as the external references are performed by the linker. The generation of all the formats of the file are done by the linker. Hence the elimination of all the additional conversion of formats are done. The linker is invoked in the following modes −

  • Prompt mode − In this mode we just change the address. Moreover, it is beneficial for us to respond by typing “T” which results only on terminal listing.

  • Data file mode

  • Command line mode

Following diagram depicts the steps required to execute .ASM program execution –

Updated on: 30-Jun-2020

324 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements