Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Unit 2

ASSEMBLY LANGUAGE PROGRAM DEVELOPMENT TOOLS

These tools are pre-developed program software that comes to the aid of
developer/programmer for writing, assembling/linking, running, testing and debugging the
program at the various stages in the Program Development Life Cycle.

Editor : An editor is a program which allows you to create a file containing the Assembly
language statements for your program. With the Editor tool, we are able to create, edit,
modify, list, print, save or update and delete the Assembly language source code files of the
program. Examples of the Editor are - EDIT from the DOS, NOTEPAD and WORDPAD of the
Microsoft Windows, are the well known editors.

Assembler : An assembler is a program used to translate or convert the assembly language


mnemonics of the source code program for instructions to the corresponding binary codes.
It uses the source file with ASM extension, as an input.. Assembler finds the syntax errors.
These errors can be corrected by re-editing the program using editor and then assembled
again. This process is repeated to get syntax error-free source code of the program
Examples of Assembler are - MASM, TASM etc.

Linker: Linker is a program used to join several object files into one large object file and
converts the machine language object code of the program into Executable code of the
program. TASM or MASM assemblers use Tlink.exe and Link.exe as the linker tools,
respectively. The output of the linker is executable code of the developed program, which is
stored as EXE file.

Debugger: Debugger is the tool that helps us test and examine the program for its desired
specified functionality; as it is executing. By executing instructions stepwise, you can check
the contents of registers and memory locations and check the problems or software bugs at
the various steps or stages in the program. Debugger optionally generates DBG files, which
can be of help to the developer/programmer in checking/testing program variables and
logic.

Program development steps

The programming in assembly language follows a specific sequence of steps which is called
as program development steps or program development life cycle.

These steps are listed below:

1. Defining the problem


2. Algorithm
3. Flowchart
4. Initialization checklist
5. Choosing instructions
6. Converting algorithm to assembly language program
Defining the problem The first step in writing a program is to think very carefully about the
problem that you want the program. At this point you do not write down program
statements, you just write the operations you want in general terms. It involves finalizing
the functionality (What the program is supposed to do) as well as the Input and Output
Specifications (What the program receives from the user and what the program delivers a
result, to the user)

Algorithms Once the problem is defined, it is analyzed for the solution. Algorithm is defined
as the textual mode representation of the specific program logic designed; in the form of
sequence of steps. All operational details are in the form of step by step sequence and it
makes easy for the programmer to understand the flow of the program.

Flowcharts: Flowchart is defined as the graphical mode or diagrammatic representation of


the specific program logic designed; in the form of sequence of set of standard symbols.

Initialization Checklist: In this steps we initiate various parts of the system, such as segment
registers, Flags and Programmable ports. This initialization is necessary as un-initialized
registers, ports, flags and variables may cause problem with the program output and
adversely affect the functionality of the program. The program may not function as desired.
Choosing Instructions : We should choose instructions or group of instructions to implement
the given step correctly. If many alternatives are available, we should choose those
instructions that make program smaller in size and more importantly efficient in execution.
Choice of correct instructions makes the program function correctly and optimally.

Converting Algorithms To Assembly Language: Every step in the algorithm is converted into
program statement using correct and efficient instructions or group of instructions. When
all steps are converted in this way, it forms the assembly language program for given
problem. The program is now ready. At the start of program, required initialization
instructions are written.

Assembler directive: Assembler directive helps to structure your program, allocate


memory, and define constants. These directives do not get assembled into equivalent object
code or executable code of the program. As they provide directions to the Assembler tool,
they are called as Assembler Directives. These instructions are also known as pseudo-
instructions or pseudo-opcode

 Data definition and storage allocation directives.: DB, DW, DD, DQ, DT.
 Program organization directives: SEGMENT, ENDS, ASSUME.
 Program end directive: END
 Procedure definition directives : PROC, ENDP
 Macro definition directive. :MACRO, ENDM

DB: Define byte. It is used to declare a byte variable (8 bits of data) or set aside one or more
storage locations of type byte in memory.
For example,
CURRENT_VALUE DB 36H
Above directive tells the assembler to reserve 1 byte of memory for a variable named
CURRENT_ VALUE and to put the value 36 H in that memory location when the program is
loaded into RAM .

DW: Define Word. It is used to declare a 2 bytes variable (16 bits of data) or set aside one or
more storage locations of type word in memory.
For example,
CURRENT_VALUE DW 3656H
Above directive tells the assembler to reserve 2 bytes of memory for a variable named
CURRENT_ VALUE and to put the value 3656 H in that memory location when the program is
loaded into RAM .

DD: Define Double Word. It is used to declare a 4 byte OR 2 word variable (32 bits of data) or
set aside one or more storage locations of type double word in memory.
For example,
BIG_NUM DD 3656 1245H
Above directive tells the assembler to reserve 4 byte OR 2 word of memory for a variable
named BIG_NUM and to put the value 3656 1245H in that memory location when the program
is loaded into RAM .

DQ: Define Quad Word. It is used to declare a 4 word variable (64 bits of data) or set aside
one or more storage locations of type quad word in memory.
For example,
LARGE_NUM DQ 3656 1245 3656 1245H
Above directive tells the assembler to reserve 4 word of memory for a variable named
LARGE _NUM and to put the value 3656 1245 3656 1245H in that memory location when the
program is loaded into RAM .

DT: Define Ten Bits. It is used to declare a 10 bytes variable (80 bits of data) or set aside one
or more storage locations of type 10 bytes in memory.

For example,
NUM_ARRY DT 3656 1245 3656 1245 2512H
Above directive tells the assembler to reserve 10 bytes of memory for a variable named
NUM_ARRY and to put the value 3656 1245 3656 1245 2512H in that memory location when
the program is loaded into RAM .

EQU: EQUATE Directive: EQU is used to give some value or symbol. Each time the assembler
finds the given name in the program, it replaces the name with the value or symbol you
equated with that name.Therefore, EQU directive is essentially used to define a Constant.

Suppose, for example, you write the statement FACTOR EQU 03H at the start of your
program, and later in the program you write the instruction statement ADD AL, FACTOR.
When the assembler codes this instruction statement, it loads 03H, constant value in Al
register.

DUP Duplicate: It is used to duplicate given variable. It is always used in conjunction with
data definition directive like DB, DW etc.
For example:
A DB 05H DUP (0)
In above example, DUP will Duplicate 0 five times. As per DB here, we duplicate 8 bits of
data five times.

PTR Pointer : The directive PTR is used to indicate the type of the memory access i.e. BYTE/
WORD. For instance, if the assembler encounters the instruction like INC [SI], it will not be
able to decide whether to code for byte increment or word increment. Here we can used
PTR directive to define data types with the instruction as INC BYTE PTR [SI] for byte
increment or INC WORD PTR [SI] for word increment.

PUBLIC Directive : The PUBLIC directive is used to tell the assembler that a specified name
or label will be accessed from other modules.
An example is the statement PUBLIC ABC, XYZ which makes the two variables ABC and XYZ
available to other assembly modules.

PROC (PROCEDURE) Directive : The PROC directive is used to identify the start of a
procedure. The PROC directive follows a name you give the procedure. After the PROC
directive, the term near or the term far is used to specify the type of the procedure.

ENDP (END PROCEDURE) Directive : The directive is used along with the name of the
procedure to indicate the end of a procedure to the assembler. The directive, together with
the procedure directive PROC, to declare logical start and end of a procedure.
MACRO Directive : The MACRO directive is used to identify the start of a Macro. The MACRO
directive follows a name you give the MACRO.

ENDM (END MACRO) Directive : The ENDM directive inform the assembler at the end of
macro. The directive, together with the macro directive MACRO, to declare logical start and
end of a procedure.

.CODE Directive: This directive declares the start or beginning of the Code segment, it also
automatically associates CS register with it and initializes it.
The subsequent statements should be code instructions
Syntax: .CODE

.DATA Directive: This directive declares the start or beginning of the Data segment, it also
automatically associates DS register with it and initializes it.
The subsequent statements should be Data declarations.
Syntax: .DATA

MODEL Directive
Syntax: MODEL <Memory_model_type>
Example: .MODEL Small
Types of model and its size
Tiny-Flat model, Single segment, creates .COM executable code.
Small- Single Code Segment and Single Data Segment.
Medium- Multiple Code Segment and Single Data Segments.
Compact- Single Code Segment and Multiple Data Segments.
Large - Multiple Code as well as Multiple Data segments, segments within 64KB size limit.

You might also like