What Is The Job Of an Assembler in C Programming?


An assembler converts assembly language instructions into a sequence of bits that can be used to obtain desired output. Instructions written in sequence of bits are termed assembly language.

An assembler processes instructions written in assembly language and produces output in machine instructions. Processing of assembly instruction includes converting assembly language into machine language, allocating appropriate amount of memory and processing of auxiliary functions used in the assembly language program. 

After processing, an object program is obtained which is in the form of machine language. An assembler processes source program statements to produce machine language instructions  and error messages. Error messages are used to debug the program. The object program consists of machine instructions.  The object program is generated on the guidelines of the binder.

Assembler Files

Assemblers produce data files having data related to source code files. These data files contains information about the type of data sets used, macros used by assembler, number and type of symbols used in the source program, and number and type of error messages produced etc The information produced by assembler is consumed by configuration managers-debuggers-librarians-collectors-of-metric and others.  

Information produced by the assembler in C language can be controlled by using assembler options. Assembler options can be given by using *PROCESS statement. C language assemblers use assembly language instruction such as DC instructions to produce object code. Different types of Instructions are used by assembler such as instructions that produce associated data, instructions that are used to assign base registers, instructions that define data constants, instructions that redefine operation codes, instructions that define symbols used etc.,

C language assemblers use macro instructions to define macros, when these macros are expanded they produce a series of instructions for a single instruction.

Conditional Assembly instructions are used for arithmetic and logical computations. Conditional assembly instruction includes SET symbols such as LCLA, LCLB, LCLC, SETA, SETB etcBranching such as AIF, ANOP and function calling instruction such as SETAF, SETCF etc.

C language assembler processing

Assembler process machine instructions and assembly language instructions as and when required and follow a particular processing sequence. Assemblers perform two passes, first, at the time of conditional assembly and second, at the time of assembly. It is also possible that only conditional assembly will be done and no further processing will be required.

Macro instructions are processed at the time of conditional assembly. At the time of conditional assembly arithmetic-logical-character  assembly expressions are evaluated by assembler.  Macro definitions generated by macro instructions are processed by C language assembler.

Object code is produced by C language assembler at assembly time after processing machine instructions. C language assemblers also work on absolute and relocatable expressions. Instructions such as XATTR, DC, PUNCH, DS etc., are generated to be consumed by binder programs for further processing.

The assembler generates information for other processes as well. The binder program uses such information at link-edit time to club object modules into load modules. This load module is loaded into virtual storage at fetch time of the program. This load module is then executed to produce output.

C language assembler processing

Operating system provide following services to assembler:

  • Source module assembling
  • Executing assembled module

If the C language program needs operating system services to obtain desired output it must be specified in the source program instructions. Operating system works in association with the assembler to control the program. Operating systems provide data sets to assembler to retain source code. These data sets are sequential. In addition to this operating system provides libraries to generate macro definitions and other utilities.

C language assembler takes the help of the operating system to produce input and output for the source module. Operating system also conducts memory management for the C language assembler.

Operating systems further facilitate C language assemblers to execute the program by providing services to linker and loader.


A computer processor can process only binary language in the form of 0 or 1. But understanding, reading and writing binary language is difficult. With the help of assembler, programmers can code using symbols instead of coding in the machine language.   

Assemblers use meaningful symbols generated using alphabets and numerals. Thus assembler codes are easier to read, understand and modify. To execute the program it is required to convert assembly language symbols to its corresponding machine language instructions having  0 or 1. This process of conversion is platform dependent and operating system dependent.

Compiler processes source code and produces assembly language programs. This assembly language program is then processed by the assembler to produce object code. The object code is then accessed by linker and binder. The linker and binder then generates a load module to get executed and produces output.