0% found this document useful (0 votes)
29 views8 pages

MIC UNIT 2 The Art of Assembly Language Programming

Unit 2 of the Microprocessor Programming course covers the steps for assembly language program development, including defining problems, writing algorithms, and using tools like editors, assemblers, linkers, and debuggers. It also details assembler directives that guide the assembly process, such as defining data types and managing memory locations. The unit emphasizes the importance of proper initialization and instruction selection to achieve desired program outputs.

Uploaded by

AKHIL JAISWAL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views8 pages

MIC UNIT 2 The Art of Assembly Language Programming

Unit 2 of the Microprocessor Programming course covers the steps for assembly language program development, including defining problems, writing algorithms, and using tools like editors, assemblers, linkers, and debuggers. It also details assembler directives that guide the assembly process, such as defining data types and managing memory locations. The unit emphasizes the importance of proper initialization and instruction selection to achieve desired program outputs.

Uploaded by

AKHIL JAISWAL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

MSBTE Polytechnic- 4th Sem CO

Microprocessor Programming
Unit 2- The Art of Assembly Language Programming
Akhil M. Jaiswal
9028637523
UNIT-II The Art of Assembly Language Programming Total Marks-08

2.1 Program development steps: defining problem and constrains, writing

algorithms, flowchart, initialization checklist, choosing instructions,

converting algorithms to assembly language programs.

2.2 Assembly Language Programming Tools: Editor, Assembler, Linker

Debugger.

2.3 Assembler Directives


UNIT-II The Art of Assembly Language Programming

Program development steps:

1. Defining the problem:


 Define very carefully about the problem that you want the program to solve.
 You need not to write down program but you must know what you would like to do.

2. Algorithm:
 The formula or sequence of operations or task need to perform by your program can
be specified as a step in general English is called as algorithm.
 It is step by step method or statement written in general English language of solving
problem.

3. Flowchart:
 The flowchart is graphically representation of the program operation or task
 Flowchart is easy to understand.
 We write algorithm and flowchart before writing the actual program.

4. Initialization Checklist:
 In program there are many variables, constants and various part of the system such
as segment registers, flag, stack, programmable ports which must be initialize
properly

Microprocessor Prof. Akhil M. Jaiswal 2


UNIT-II The Art of Assembly Language Programming

5. Choosing Instructions:
 Next Step is to choose appropriate instruction that performs your problem’s
operations and task.

 You must know instruction set of microprocessors.

6. Converting Algorithms to Assembly Language Program:


 Once you have selected the instructions for the operations to be performed then
arrange these instructions in sequence as per algorithm.
 So that desired output must be obtaining after execution.

Microprocessor Prof. Akhil M. Jaiswal 3


UNIT-II The Art of Assembly Language Programming

Assembly Language Program Development Tools


 Editor
 Assembler
 Linker
 Debugger
1. Editor:
- An Editor is a program which helps you to construct your assembly language program in
right format.
- You can type your program using editor.
- Assembly language file extension is .asm file
- The DOS based editor such as EDIT, WordStar and Norton Editor is used.

2. Assembler:
- An assembler is a correct program that translate assembly language program to the
binary code for each instruction.
- File is generated called as object file with extension .obj
- We use TASM assembler.

3. Linker:
- A Linker is a program which combines if requested more one assembled module into
one executable program.
- It is a programming tool used to convert Object code (.OBJ) into executable (.EXE)
program.
- File is called as executable file with extension .exe
- We use TLINK Linker

4. Debugger:
- Debugger is a program that allows the execution of program in single step mode under
the control of the user.
- The process of locating and correcting errors using a debugger is known as debugging.
- We use Turbo Debugger (TD).

Microprocessor Prof. Akhil M. Jaiswal 4


UNIT-II The Art of Assembly Language Programming

ASSEMBLER DIRECTIVES:

- Assembler directives are the commands to the assembler that direct the assembly process.
- They indicate how an operand is treated by the assembler and how assembler handles the
program.
- They also direct the assembler how program and data should arrange in the memory.
- ALPs are composed of two types of statements.
 The instructions which are translated to machine codes by assembler.
 The directives that direct the assembler during assembly process, for which no machine
code is generated.

1) DB – Define byte (8 bits):

- It is used to declare a byte type variable of 8 bit. A BYTE is made up of 8 bits. It also can be used
to declare an array of bytes.

- The range of values that can be stored in a byte is 0 to 255 for unsigned numbers and –128 to
+127 for signed numbers.
Syntax: Name_of_Variable DB Initialization_Value

Examples: NUM DB 80h

2. DW – The DW directive is used to declare a WORD type variable.:

- A WORD occupies 16 bits or (2 BYTE).

- The range of values : 0 – 65535 for unsigned numbers -32768 to 32767 for signed numbers
Syntax: Name_Of_Variable DW Initialisation_Value

Examples: NUM DW ‘78’


Word DW 1234h

Microprocessor Prof. Akhil M. Jaiswal 5


UNIT-II The Art of Assembly Language Programming

3. DD - (Define Double Word or Data Double Word):

- This is used to define a double word (32-bit) type variable.

- The range of values: 0 to 232-1 bits for unsigned numbers. -232-1to +232-1 for signed numbers.

- This can be used to define a single double word or multiple double word.

Syntax: Name_of_Variable DD Initialization_Value(,s)

Examples: NUMBER DD 1,2,3,4,9 ; Allocate 20 memory locations.


NUM DD? ; Allocate 4 memory locations

4. DQ - (Define Quad Word):

- This is used to define a quad word (64-bit) type variable.

- The range of values: 0 to 264-1 bits for unsigned numbers. -264-1to +264-1 for signed numbers.

- This can be used to define a single quad word or multiple quad word.

Syntax: Name_of_Variable DQ Initialization_Value(,s)

Examples: NUMBER DQ 1,2,3,4,9 ; Allocate 40 memory locations.


NUM DQ? ; Allocate 8 memory locations

5. EQU - Equate to:

- The EQU directive is used to declare the micro symbols to which some constant value is
assigned.

- Micro assembler will replace every occurrence of the symbol in a program by its value.

Syntax: Symbol_name EQU expression

Examples: SUM EQU 100


NUM EQU 50

Microprocessor Prof. Akhil M. Jaiswal 6


UNIT-II The Art of Assembly Language Programming

6. ORG:

- The directive ORG assigns the location counter with value specified in the directive. It helps in
placing the machine code in the specified location while translating instructions into machine
codes by the assembler. $ is used to indicate current value of location counter

Syntax: ORG [$+] Numeric_value

Examples: ORG 3000H ; set location counter to 3000H

7. DUP: Duplicate memory location:

- This directive can be used to generate multiple bytes or words with known as well as un-
initialized values.

8. ASSUME:

- Assume directive is used to tell Assembler the name of the logical segment it should use for the
specified segment.

Syntax: ASSUME

Seg_Reg: Seg_Name,.............. ,Seg_Reg: Seg_Name

where,
ASSUME is assembler directive
Seg_Reg is any o the segment register i.e CS,DS,SS,ES
Seg_Name is the user defined segment name

Examples: ASSUME CS: VJTECH_CODE, DS: VJTECH_DATA, SS:VJTECH_STACK

9. SEGMENT:

- It is used to indicate the start of a logical segment. It is the name given to the segment.

- The directive segment follows the name of Segment.

Syntax: Segment_Name SEGMENT [Word/Public]

Examples: CODE SEGMENT WORD the code segment is used to indicate to the
assembler the start of logical segment.

Microprocessor Prof. Akhil M. Jaiswal 7


UNIT-II The Art of Assembly Language Programming

10. END: End of the program

- The directive END is used to inform assembler the end of the program. END directive is placed
after the last statement of a program to tell the assembler that this is the end of the program
module. The assembler will ignore any statement after an END directive.

Syntax: END [Start_Address]

The optional start_address indicates the location in the code segment where execution is to begin.

11. PROC: (PROCEDURE)

- It is used to identify the start of a procedure. It follows a name we give the procedure.
- After the procedure the term NEAR and FAR is used to specify the procedure

Example: Addition PROC FAR

identifies the start of procedure named Addition and tells the assembler that the procedure is far.

12. INCLUDE-Include source code from file

- This directive used to tell the assembler to insert a block of source code from named file
into current source module.

Syntax: INCLUDE <file path specification with file name>


Example: INCLUDE C:\Tasm\abc.lib

MSBTE Polytechnic- 4th Sem CO


Microprocessor Programming
Unit 2- The Art of Assembly Language Programming
Akhil M. Jaiswal
9028637523

Microprocessor Prof. Akhil M. Jaiswal 8

You might also like