SlideShare a Scribd company logo
1 of 80
Download to read offline
THE ART OF
ASSEMBLY
LANGAUGE
PROGRAMMING
BY – Bornare
R.R
Sanjivani K. B. P. Polytechnic College, Kopargaon
Program Development Step
🞇 List the program development steps for
assembly language programming:-
1. Defining the problem
2. Algorithm
3. Flowchart
4. Initialization checklist
5. Choosing instructions
6.Converting algorithms to assembly language program
1. Defining the problem
The first step in writing program is to think very
carefully about the problem that you want to solve.
At this point you need to write down program
but you must know what you would like to do.
2. Algorithm
The formula or sequence of operation or tasks need
to perform by your program.
Can be specified as a step in general English and
is often called as algorithm.
3. Flowchart
The flowchart is a graphically representation of
the program operation or task.
Connector
Process
Decision
Input
/Output
Subroutine
Termination
4. Initialization checklist
In program there are many Variables, Constants and
various Segment Registers, Flags, Stack,
Programmable ports etc. which must be initialize
properly.
The best way to initialization of task is to make
the checklist of the entire Variables, Constants and
various Segment Registers, Flags, Stack,
Programmable ports etc.
5. Choosing instructions
your
Choose proper instruction that performs
problems or task.
This is an important step, so you must know
entire instruction set of the Microprocessor.
6. Converting algorithms to
assembly language program
Select the instruction for the operation to be
performed.
In assembly language program, a first step is to
set up and declare the data structure.
Then write down the instruction required for
initialization at the start of the code screen.
Next determine the instructions required to
implement the major action in the algorithm.
Assembly Language Program
Development tools
1. Editor
2. Assembler
3. Linker
4. Debugger
1.Editor
An editor is a program which helps to construct
ALP in right format so that the assembler will
translate it correctly to machine language.
So type program using Editor.
This form of program is called as source
program.
2.Assembler
Assembler is a program that translates assembly
language program to the correct binary code.
It also generates the file called as object file with
extension .obj.
It also displays syntax errors in the program, if any.
Example ofAssembler are MASM (Microsoft Macro
Assembler.
3.Linker
It is a programming tool used to convert Object
code into executable program called .EXE module.
It combines, if requested, more than one separated
assembled modules into one executable module
such as two or more assembly programs or an
assembly language with C program.
4.Debugger
Debugger is a program that allows the execution
of program in single step mode under the control
of the user.
The errors in program can be located and corrected
using a debugger.
Debugger generates .exe file.
Program Development Process
1. Source file creation
2. Object code generation
3. Executable file creation
4. Program Running
5. Program Testing
6. Program Debugging
1 Source file creation:-
The source file is created and edited using
text editor and must have extension .ASM.
2 Object code generation:-
The assembler is used to translate assembly
language source code to re-locatable object
code.
3 Executable file creation:-
Linker is used to create an executable file.
4 Program Running:-
The executable file can be run by entering the
name of executable file on the prompt and by
passing ENTER key on the keyboard.
5 Program Testing:-
The result or output generated by the program has
to be tested for their validity.
If any error occurs in the result, then program
should be debug.
6 Program Debugging:-
The errors in the program can be located using
debugger.
The executable file of the program to be
debugged must be created with the program
debug option.
Assembler Directives and
Operator
Assembly language program supports a number of
reserve word i.e. key words that enable control of
program assembler and lists.
These words are called as aAssembler Directives,
acts only during the assembly of the program.
So, directives are the statement that gives direction
to the assembler.
Directives are divided into various categories.
Data Definition Directives
DB : Define Bytes
DW : Define Words
DD : Define Double Word
DQ : Define Quad Word
DT : Define Ten Byte
STRUCT : Structure Declaration
RECORD
EQU : Equate to
ORG : Originate
ALIGN : Alignment of memory addresses.
EVEN : Align as even memory location
LABEL
DB:Define Bytes
DB - Define byte (8 bits)
It is used to declare a byte type variable of 8 bit. 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 +128 for
signed numbers.
General form:-
🞇 Name_Of_Variable DB → Initialization _Value(,s)
DW:Define Words
The DW directive is used to define word type (16bit)
instead of bytes.
The range of values that can be stored in a word is 0
to 655535 for unsigned numbers and -32768 to
+32768 for signed numbers.
General form:-
🞇 Name _ Of_Variable DW→ Initialization _ Value(,s)
Define Double Word
The DD directive is used to define a double
word type i.e. 4byte (32 bits)type variable.
The range of the values that can be stored in a
double word is 0 to 232-1 for unsigned no. and
signed integer no is -232-1 to +232-1
General form:-
🞇 Name _ Of_Variable DD → Initialization _ Value(,s)
DQ( Define Quad Word)
This is used to define a quad word (64-bit)or 8
byte type variable.
The range of the values that can be stored in a
double word is 0 to 264-1 for unsigned no. and
signed integer no is -264-1 to +264-1
General form:-
🞇 Name _ Of_Variable DQ → Initialization _ Value(,s)
DT:Define Ten Byte
The DT Directive is used to define a ten byte
type variable.
It can be used to define single or multiple
10 byte variables.
The range of the values that can be stored is 0
to 280-1 for unsigned no. and signed integer no
is -280-1 to +280-1
General form:-
🞇 Name _ Of_Variable DT → Initialization _ Value(,s)
STRUCT: Structure Declaration
The directive STRUCT is used to declare the data
type which is a collection of primary data type
(DB,DW,DD).
The structure declaration allow the user to define a
variable which has more than one data type.
General form:-
STRUCT
Structure variable definition
The general form of a structure definition is as
follows:
🞇 Variable Structure _ Name<Initializations>
🞇 Example
🞇 EMPLOYEE STRUCT
🞇 EMP_N
🞇
DW ?
EMP_NAME DB 25DUP
🞇 EMP_AGE DB
🞇 EMP_DEPT DB ?
🞇 EMPLOYEE ENDS
RECORD
The directive RECORD is used to define a bit
pattern within a byte or a word.
It is similar to the bit-wise access in C
language.
The RECORD definition helps in encoding or
decoding of bit for which some meaning is
assigned.
RECORD
Generalform
Record_nameRECORD
Field_Specification_1….Field_Specificationn_N
Examples
Bit7,6,5:BaudRate
Bit4,3
Bit2
:Parity
:StopBits
Bit1,0 :W
orld
EQU: Equate to
The EQU directive is used to declare the
symbols to which some constant value is
assigned.
Such symbols are called as macro symbols , so
macro assembler will replace every occurrences
of the symbol in a program by its value.
EQU: Equate to
Generalform
Symbol_Name EQU Expression
Examples
Num EQU 100
INCREAMENT EQU INC
START_STR EQU [SI]
ORG: Originate
The directives ORG assigns the location
counter with the value specified in the directive.
General form
ORG [$+] Numeric_value
Examples
ORG 100H
ORG $
ORG $+100
ALIGN: Alignment of memory
addresses.
The directive ALIGN is used to force the
assembler to align the next data item or
instruction according to given value.
General form
Examples
ALIGN Numeric_Value
ALIGN 4 Align 4 means : align next data and
division by 4.
EVEN: Align as even memory
location
The directive EVEN is used to inform the assembler
to increment the location counter to the next even
memory address.
If it is location counter is already pointing to even
memory address, it should not be incremented.
The 8086 processor read a word from the memory
in one bus cycle while accessing an even memory
address word.
EVEN:
General form
EVEN
Examples
‘VIJAY$’
30
DATA SEGMENT
Name db
EVEN
AGE db
DATA ENDS
LABEL
The directive LABEL enables you to redefine
the attribute of a data variable or instruction
label.
General form
Variable_Name LABEL Type_Specifier
Examples
TEMP LABEL BYTE
NUMLABEL WORD
DUP:Duplicate memory
location
The DUP directive can be used to generate
multiple bytes or words with known as well as
un-initialized values.
Example General form : DUP?
Table dw
Stars db
ARRAY3
100DUP(0)
50 dup(’*’)
DB30 DUP(?)
Program Organization
Directive
ASSUME
SEGMENT
ENDS: END OF THE SEGMENT
END: END OF THE PROGRAM
CODE: Simplified CODE Segment directive
DATA: Simplified DA
TA Segment directive
STACK: Simplified Stack Segment directive
MODEL: Memory model declaration for
segments.
Program Organization
Directive :ASSUME
The directive ASSUME informs the
assembler the name of the logical segments
that should be used for a specified segment.
When program is loaded, the processor segment
register should point to the respective logical
segments.
ASSUME
General form:
ASSUME
Seg _ Reg: Seg _ Name
Where,ASSUME is a assembler directive.
Seg _ Reg is any of the segment register
i.e. CS,DS,SS,ES.
Seg _ Name is the name of an user defined segment.
Example
ASSUME CS:CODE,DS:DATA.
Program Organization
Directive : SEGMENT
The directive SEGMENT is used to indicate the
beginning of the logical segment.
The directive SEGMENT follows the name of
the segment.
SEGMENT
General form:
SEGMENT
SEGMENT _ Name SEGMENT
Example
DATASEGMENT ………
Program Data definition here
DATAENDS
CODE SEGMENT ………
Program Code definition here
CODE ENDS
Program Organization
Directive :ENDS
ENDS: END OFTHE SEGMENT
The directive ENDS informs the assembler the end
of the segment.
The directive ENDS and SEGMENT must
enclosed the segment data or code of the program.
ENDS
General form:
ENDS
SEGMENT _ Name ENDS
Example
DATASEGMENT ………
Program Data definition here
DATAENDS
CODE SEGMENT ………
Program Code definition here
CODE ENDS
Program Organization
Directive : END
END:END OFTHE PROGRAM
The directive END is used to inform assembler
the end of the program.
General form: END
END [Start_Address]
The optional start _ address specifies the
location in the code segment where execution is
to be start.
Program Organization
Directive : CODE
CODE: Simplified CODE Segment directive
This simplified segment directive defines the
code segment.
All executable code must be placed in this
segment.
General form: CODE
.CODE[NAME]
Program Organization
Directive : DATA
DATA: Simplified DATASegment directive
This simplified segment directive defines the data
segment for initialized near data.
All data define and declaration must be placed in
this segment.
General form: DATA
.DATA
Program Organization
Directive : STACK
STACK: Simplified Stack Segment directive
This simplified segment directive define the
stack segment
Default size of the stack is 1024 bytes.
General form: STACK
. STACK 100
Program Organization
Directive: MODEL
MODEL: Memory model declaration for segments.
This simplified segment directive creates default
segments.
General form: MODEL
.MODEL memory _ small
WHERE,
Memory model can be…
TINY: MASM 6.0, used for .COM program.
SMALL: all data in one segment and all code in one
segment.
Value Returning Attribute
Directive
LENGTH
SIZE
OFFSET
SEG: SEGMENT
TYPE
Value Returning Attribute
Directive :LENGTH
The directive LENGTH informs the assembler
about the number of the elements in a data
items such as array.
If the array is defined with DB, then it returns
number of bytes allocated to a variable.
LENGTH
General form:-
LENGTH Variable _ Name
EXAMPLE:-
MOV CX, LENGTH NAME
Value Returning Attribute
Directive :SIZE
The directive SIZE is same as Length except
that it returns number of bytes allocated to a
variable or data item instead of the number of
elements in it.
General form:-
SIZE Variable _ Name
EXAMPLE:-
MOV CX, SIZE NAME
Value Returning Attribute
Directive :OFFSET
The directive OFFSET informs the assembler to
determine the displacement of the specified
variable w.r.to the base of the segment.
It usually used to load a offset of a variable
into the register.
Using OFFSET value, a variable can be
referred indexed addressing mode.
OFFSET
General form:-
OFFSET Variable _ Name
EXAMPLE:-
MOV SI, OFFSETARRAY
MOV DX, OFFSET MSG
Value Returning Attribute
Directive :SEG
The directive SEG is used to determine the
segment in which the specified data items
is defined.
General form:-
SEG Variable _ Name
EXAMPLE:-
MOV DS, SEG MSG
Value Returning Attribute
Directive :TYPE
The directive TYPE is used to determine the
type of the data items.
General form:-
TYPE Variable _ Name
EXAMPLE:-
ADD BX, TYPE NUM
Procedure Definition Directive
PROC : PROCEDURE
ENDP: END OF PROCEDURE
Procedure Definition Directive
: PROC
PROC - The PROC directive is used to identify
the start of a procedure.
The term near or far is used to specify the type of
the procedure if the term is not specified , then
assembler assumes NEAR as a type Specifies.
General Form:
🞇 Procedure _ name PROC [NEAR/FAR]
PROC
EXAMPLE:
ADD PROC NEAR
PROCEDURE CODES
ADD ENDP
Procedure Definition Directive
: ENDP
ENDP: END OF PROCEDURE
ENDP The directive is used along with the
name of the procedure to indicate the end of a
procedure to the assembler.
General Form : Procedure _ name ENDP
EXAMPLE: FACTORIAL ENDP
MACRO Definition Directive
MACRO
ENDM: END OF MACRO
MACRO Definition Directive:-
MACRO
MACRO:
The directive MACRO informs the assembler
the beginning of a MACRO.
It consists of name of a MACRO followed by
keyword MACRO and MACROARGUMENT.
General Form :
MACRO_ NAME MACRO [ARGUMENT 1
….,…..ARGUMENT N]
MACRO
Example :-
DISPMACRO MSG … whose name is display by MACRO
PUSHAX
PUSH DX
MOVAH, 09H
LEADX ,MSG
INT 21H
POPDX
POPAX
ENDM
…… open subroutine
…… open subroutine
…… Read the string, 09h is function
to display string
…… Load effective address
……Termination of program with
a return code
…… Avoiding overhead of writing the
repeat pattern of the code.
…… End of MACRO
MACRO Definition Directive
:ENDM
ENDM: END OF MACRO
The directive ENDM informs the assembler
the end of the MACRO.
The directive MACRO and ENDM must
enclose the definition, declaration.
General Form :
ENDM
ENDM
Example :-
DISPMACRO MSG …whose name is display by MACRO
PUSHAX
PUSH DX
MOVAH, 09H
LEADX ,MSG
INT 21H
POPDX
POPAX
ENDM
…… open subroutine
…… open subroutine
…… Read the string, 09h is function
to display string
…… Load effective address
……Termination of program with
a return code
……Avoiding overhead of writing the
repeat pattern of the code.
…… End of MACRO
Data Control Directive
PUBLIC
EXTRN: EXTERNAL
PTR: POINTER
Data Control Directive :
PUBLIC
PUBLIC: the directive PUBLIC informs the
assembler that specified variable or segment can be
accessed from other program module.
It helps in managing the multiple program module
by sharing global variables.
General Form :
PUBLIC VARIABLE 1,……. VARIABLE N
PUBLIC
EXAMPLE:
PUBLIC MSG, NAME , NUM
PUBLICARRAY
Data Control Directive
: EXTRN
EXTRN: EXTERNAL
The directive EXTRN informs the assembler that
the data items or label following the directive will be
used in a program module.
General Form :
EXTRN VARIABLE_NAME1,…….
VARIABLE _NAME N
EXTRN:
EXAMPLE
EXTRN DISPLAY : NEAR
EXTRN DISPLAY : FAR
Data Control Directive : PTR
PTR: POINTER
The directive PTR is used to indicate the type of
the memory access i.e. BYTE/WORD/DWORD.
General Form :
PTR
EXAMPLE
INC BYTE PTR[DI]…..Increment byte pointer
Branch Displacement Directive
SHORT
LABEL
Branch Displacement Directive
: SHORT
SHORT
One byte displacement is required to code to
jump instruction.
General Form :
JKPSHORT NEXT
Branch Displacement Directive
: LABEL
LABEL:
Assign a name to the current value in the
location counter.
General Form :
LABLE
EXAMPLE
LABLE_NAME
File Inclusion Directive
INCLUDE
This INCLUDE directive is used to insert a block
of source code from the named file into the current
source module.
The directive INCLUDE informs the assembler to
include the statement defined in the include file.
General Form :
INCLUDE<FILE PATH>
EXAMPLE
INCLUDEC:MASMMACRO.LI
B
Describe model of assembly
language programming
Note :Any one model can be considered.
Model 1 :
1) Using SEGMENT,ASSUME and ENDS directives
2) In this Data _ Seg is the name of the data segment where
data are declared.
3) Code _ Seg is the name of the code segment where code
is written.
4) Start is the label name used to initialize the CSregister.
5) ENDS to indicate the ends of code and data segment
6) END marks the end of the program.
Model 2 :
a. Using .Data and .code directive
b. In this, .model small is used to indicate small
memory model is used in the program
c. Stack 100 to indicate 100 word memory locations
reserved for stack
d. Data indicates start of the data segment where
data declaration of the program is made.
e. Code indicates the beginning of the code
segment
f. END to indicate the termination of the program.
THANK YOU

More Related Content

Similar to unit 2.pptx

Chapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this pptChapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this pptANISHYAPIT
 
Chapter 2 Flutter Basics Lecture 1.pptx
Chapter 2 Flutter Basics Lecture 1.pptxChapter 2 Flutter Basics Lecture 1.pptx
Chapter 2 Flutter Basics Lecture 1.pptxfarxaanfarsamo
 
Programming concepts By ZAK
Programming concepts By ZAKProgramming concepts By ZAK
Programming concepts By ZAKTabsheer Hasan
 
Cobol programming language
Cobol programming languageCobol programming language
Cobol programming languageBurhan Ahmed
 
C programming languag for cse students
C programming languag for cse studentsC programming languag for cse students
C programming languag for cse studentsAbdur Rahim
 
Presentation 5th
Presentation 5thPresentation 5th
Presentation 5thConnex
 
C language by Dr. D. R. Gholkar
C language by Dr. D. R. GholkarC language by Dr. D. R. Gholkar
C language by Dr. D. R. GholkarPRAVIN GHOLKAR
 
Introduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdfIntroduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdfAbrehamKassa
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer muniryaseen
 
Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language BasicsEducation Front
 
Chapter 2 programming concepts - I
Chapter 2  programming concepts - IChapter 2  programming concepts - I
Chapter 2 programming concepts - ISHREEHARI WADAWADAGI
 
C programming language tutorial for beginers.pdf
C programming language tutorial for beginers.pdfC programming language tutorial for beginers.pdf
C programming language tutorial for beginers.pdfComedyTechnology
 
Assembly level language
Assembly level languageAssembly level language
Assembly level languagePDFSHARE
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 

Similar to unit 2.pptx (20)

Chapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this pptChapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this ppt
 
Chapter 2 Flutter Basics Lecture 1.pptx
Chapter 2 Flutter Basics Lecture 1.pptxChapter 2 Flutter Basics Lecture 1.pptx
Chapter 2 Flutter Basics Lecture 1.pptx
 
Programming concepts By ZAK
Programming concepts By ZAKProgramming concepts By ZAK
Programming concepts By ZAK
 
7986-lect 7.pdf
7986-lect 7.pdf7986-lect 7.pdf
7986-lect 7.pdf
 
Cobol programming language
Cobol programming languageCobol programming language
Cobol programming language
 
Programming
ProgrammingProgramming
Programming
 
C programming languag for cse students
C programming languag for cse studentsC programming languag for cse students
C programming languag for cse students
 
Presentation 5th
Presentation 5thPresentation 5th
Presentation 5th
 
C language by Dr. D. R. Gholkar
C language by Dr. D. R. GholkarC language by Dr. D. R. Gholkar
C language by Dr. D. R. Gholkar
 
Introduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdfIntroduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdf
 
Data services-functions
Data services-functionsData services-functions
Data services-functions
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer
 
Technical Interview
Technical InterviewTechnical Interview
Technical Interview
 
Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language Basics
 
Chapter 2 programming concepts - I
Chapter 2  programming concepts - IChapter 2  programming concepts - I
Chapter 2 programming concepts - I
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
C programming language tutorial for beginers.pdf
C programming language tutorial for beginers.pdfC programming language tutorial for beginers.pdf
C programming language tutorial for beginers.pdf
 
Assembly level language
Assembly level languageAssembly level language
Assembly level language
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
Basics of c++
Basics of c++Basics of c++
Basics of c++
 

Recently uploaded

main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 

Recently uploaded (20)

main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 

unit 2.pptx

  • 1. THE ART OF ASSEMBLY LANGAUGE PROGRAMMING BY – Bornare R.R Sanjivani K. B. P. Polytechnic College, Kopargaon
  • 2. Program Development Step 🞇 List the program development steps for assembly language programming:- 1. Defining the problem 2. Algorithm 3. Flowchart 4. Initialization checklist 5. Choosing instructions 6.Converting algorithms to assembly language program
  • 3. 1. Defining the problem The first step in writing program is to think very carefully about the problem that you want to solve. At this point you need to write down program but you must know what you would like to do.
  • 4. 2. Algorithm The formula or sequence of operation or tasks need to perform by your program. Can be specified as a step in general English and is often called as algorithm.
  • 5. 3. Flowchart The flowchart is a graphically representation of the program operation or task. Connector Process Decision Input /Output Subroutine Termination
  • 6. 4. Initialization checklist In program there are many Variables, Constants and various Segment Registers, Flags, Stack, Programmable ports etc. which must be initialize properly. The best way to initialization of task is to make the checklist of the entire Variables, Constants and various Segment Registers, Flags, Stack, Programmable ports etc.
  • 7. 5. Choosing instructions your Choose proper instruction that performs problems or task. This is an important step, so you must know entire instruction set of the Microprocessor.
  • 8. 6. Converting algorithms to assembly language program Select the instruction for the operation to be performed. In assembly language program, a first step is to set up and declare the data structure. Then write down the instruction required for initialization at the start of the code screen. Next determine the instructions required to implement the major action in the algorithm.
  • 9. Assembly Language Program Development tools 1. Editor 2. Assembler 3. Linker 4. Debugger
  • 10. 1.Editor An editor is a program which helps to construct ALP in right format so that the assembler will translate it correctly to machine language. So type program using Editor. This form of program is called as source program.
  • 11. 2.Assembler Assembler is a program that translates assembly language program to the correct binary code. It also generates the file called as object file with extension .obj. It also displays syntax errors in the program, if any. Example ofAssembler are MASM (Microsoft Macro Assembler.
  • 12. 3.Linker It is a programming tool used to convert Object code into executable program called .EXE module. It combines, if requested, more than one separated assembled modules into one executable module such as two or more assembly programs or an assembly language with C program.
  • 13. 4.Debugger Debugger is a program that allows the execution of program in single step mode under the control of the user. The errors in program can be located and corrected using a debugger. Debugger generates .exe file.
  • 14. Program Development Process 1. Source file creation 2. Object code generation 3. Executable file creation 4. Program Running 5. Program Testing 6. Program Debugging
  • 15. 1 Source file creation:- The source file is created and edited using text editor and must have extension .ASM. 2 Object code generation:- The assembler is used to translate assembly language source code to re-locatable object code.
  • 16. 3 Executable file creation:- Linker is used to create an executable file. 4 Program Running:- The executable file can be run by entering the name of executable file on the prompt and by passing ENTER key on the keyboard.
  • 17. 5 Program Testing:- The result or output generated by the program has to be tested for their validity. If any error occurs in the result, then program should be debug. 6 Program Debugging:- The errors in the program can be located using debugger. The executable file of the program to be debugged must be created with the program debug option.
  • 18. Assembler Directives and Operator Assembly language program supports a number of reserve word i.e. key words that enable control of program assembler and lists. These words are called as aAssembler Directives, acts only during the assembly of the program. So, directives are the statement that gives direction to the assembler. Directives are divided into various categories.
  • 19. Data Definition Directives DB : Define Bytes DW : Define Words DD : Define Double Word DQ : Define Quad Word DT : Define Ten Byte STRUCT : Structure Declaration RECORD EQU : Equate to ORG : Originate ALIGN : Alignment of memory addresses. EVEN : Align as even memory location LABEL
  • 20. DB:Define Bytes DB - Define byte (8 bits) It is used to declare a byte type variable of 8 bit. 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 +128 for signed numbers. General form:- 🞇 Name_Of_Variable DB → Initialization _Value(,s)
  • 21. DW:Define Words The DW directive is used to define word type (16bit) instead of bytes. The range of values that can be stored in a word is 0 to 655535 for unsigned numbers and -32768 to +32768 for signed numbers. General form:- 🞇 Name _ Of_Variable DW→ Initialization _ Value(,s)
  • 22. Define Double Word The DD directive is used to define a double word type i.e. 4byte (32 bits)type variable. The range of the values that can be stored in a double word is 0 to 232-1 for unsigned no. and signed integer no is -232-1 to +232-1 General form:- 🞇 Name _ Of_Variable DD → Initialization _ Value(,s)
  • 23. DQ( Define Quad Word) This is used to define a quad word (64-bit)or 8 byte type variable. The range of the values that can be stored in a double word is 0 to 264-1 for unsigned no. and signed integer no is -264-1 to +264-1 General form:- 🞇 Name _ Of_Variable DQ → Initialization _ Value(,s)
  • 24. DT:Define Ten Byte The DT Directive is used to define a ten byte type variable. It can be used to define single or multiple 10 byte variables. The range of the values that can be stored is 0 to 280-1 for unsigned no. and signed integer no is -280-1 to +280-1 General form:- 🞇 Name _ Of_Variable DT → Initialization _ Value(,s)
  • 25. STRUCT: Structure Declaration The directive STRUCT is used to declare the data type which is a collection of primary data type (DB,DW,DD). The structure declaration allow the user to define a variable which has more than one data type. General form:-
  • 26. STRUCT Structure variable definition The general form of a structure definition is as follows: 🞇 Variable Structure _ Name<Initializations> 🞇 Example 🞇 EMPLOYEE STRUCT 🞇 EMP_N 🞇 DW ? EMP_NAME DB 25DUP 🞇 EMP_AGE DB 🞇 EMP_DEPT DB ? 🞇 EMPLOYEE ENDS
  • 27. RECORD The directive RECORD is used to define a bit pattern within a byte or a word. It is similar to the bit-wise access in C language. The RECORD definition helps in encoding or decoding of bit for which some meaning is assigned.
  • 29. EQU: Equate to The EQU directive is used to declare the symbols to which some constant value is assigned. Such symbols are called as macro symbols , so macro assembler will replace every occurrences of the symbol in a program by its value.
  • 30. EQU: Equate to Generalform Symbol_Name EQU Expression Examples Num EQU 100 INCREAMENT EQU INC START_STR EQU [SI]
  • 31. ORG: Originate The directives ORG assigns the location counter with the value specified in the directive. General form ORG [$+] Numeric_value Examples ORG 100H ORG $ ORG $+100
  • 32. ALIGN: Alignment of memory addresses. The directive ALIGN is used to force the assembler to align the next data item or instruction according to given value. General form Examples ALIGN Numeric_Value ALIGN 4 Align 4 means : align next data and division by 4.
  • 33. EVEN: Align as even memory location The directive EVEN is used to inform the assembler to increment the location counter to the next even memory address. If it is location counter is already pointing to even memory address, it should not be incremented. The 8086 processor read a word from the memory in one bus cycle while accessing an even memory address word.
  • 35. LABEL The directive LABEL enables you to redefine the attribute of a data variable or instruction label. General form Variable_Name LABEL Type_Specifier Examples TEMP LABEL BYTE NUMLABEL WORD
  • 36. DUP:Duplicate memory location The DUP directive can be used to generate multiple bytes or words with known as well as un-initialized values. Example General form : DUP? Table dw Stars db ARRAY3 100DUP(0) 50 dup(’*’) DB30 DUP(?)
  • 37. Program Organization Directive ASSUME SEGMENT ENDS: END OF THE SEGMENT END: END OF THE PROGRAM CODE: Simplified CODE Segment directive DATA: Simplified DA TA Segment directive STACK: Simplified Stack Segment directive MODEL: Memory model declaration for segments.
  • 38. Program Organization Directive :ASSUME The directive ASSUME informs the assembler the name of the logical segments that should be used for a specified segment. When program is loaded, the processor segment register should point to the respective logical segments.
  • 39. ASSUME General form: ASSUME Seg _ Reg: Seg _ Name Where,ASSUME is a assembler directive. Seg _ Reg is any of the segment register i.e. CS,DS,SS,ES. Seg _ Name is the name of an user defined segment. Example ASSUME CS:CODE,DS:DATA.
  • 40. Program Organization Directive : SEGMENT The directive SEGMENT is used to indicate the beginning of the logical segment. The directive SEGMENT follows the name of the segment.
  • 41. SEGMENT General form: SEGMENT SEGMENT _ Name SEGMENT Example DATASEGMENT ……… Program Data definition here DATAENDS CODE SEGMENT ……… Program Code definition here CODE ENDS
  • 42. Program Organization Directive :ENDS ENDS: END OFTHE SEGMENT The directive ENDS informs the assembler the end of the segment. The directive ENDS and SEGMENT must enclosed the segment data or code of the program.
  • 43. ENDS General form: ENDS SEGMENT _ Name ENDS Example DATASEGMENT ……… Program Data definition here DATAENDS CODE SEGMENT ……… Program Code definition here CODE ENDS
  • 44. Program Organization Directive : END END:END OFTHE PROGRAM The directive END is used to inform assembler the end of the program. General form: END END [Start_Address] The optional start _ address specifies the location in the code segment where execution is to be start.
  • 45. Program Organization Directive : CODE CODE: Simplified CODE Segment directive This simplified segment directive defines the code segment. All executable code must be placed in this segment. General form: CODE .CODE[NAME]
  • 46. Program Organization Directive : DATA DATA: Simplified DATASegment directive This simplified segment directive defines the data segment for initialized near data. All data define and declaration must be placed in this segment. General form: DATA .DATA
  • 47. Program Organization Directive : STACK STACK: Simplified Stack Segment directive This simplified segment directive define the stack segment Default size of the stack is 1024 bytes. General form: STACK . STACK 100
  • 48. Program Organization Directive: MODEL MODEL: Memory model declaration for segments. This simplified segment directive creates default segments. General form: MODEL .MODEL memory _ small WHERE, Memory model can be… TINY: MASM 6.0, used for .COM program. SMALL: all data in one segment and all code in one segment.
  • 50. Value Returning Attribute Directive :LENGTH The directive LENGTH informs the assembler about the number of the elements in a data items such as array. If the array is defined with DB, then it returns number of bytes allocated to a variable.
  • 51. LENGTH General form:- LENGTH Variable _ Name EXAMPLE:- MOV CX, LENGTH NAME
  • 52. Value Returning Attribute Directive :SIZE The directive SIZE is same as Length except that it returns number of bytes allocated to a variable or data item instead of the number of elements in it. General form:- SIZE Variable _ Name EXAMPLE:- MOV CX, SIZE NAME
  • 53. Value Returning Attribute Directive :OFFSET The directive OFFSET informs the assembler to determine the displacement of the specified variable w.r.to the base of the segment. It usually used to load a offset of a variable into the register. Using OFFSET value, a variable can be referred indexed addressing mode.
  • 54. OFFSET General form:- OFFSET Variable _ Name EXAMPLE:- MOV SI, OFFSETARRAY MOV DX, OFFSET MSG
  • 55. Value Returning Attribute Directive :SEG The directive SEG is used to determine the segment in which the specified data items is defined. General form:- SEG Variable _ Name EXAMPLE:- MOV DS, SEG MSG
  • 56. Value Returning Attribute Directive :TYPE The directive TYPE is used to determine the type of the data items. General form:- TYPE Variable _ Name EXAMPLE:- ADD BX, TYPE NUM
  • 57. Procedure Definition Directive PROC : PROCEDURE ENDP: END OF PROCEDURE
  • 58. Procedure Definition Directive : PROC PROC - The PROC directive is used to identify the start of a procedure. The term near or far is used to specify the type of the procedure if the term is not specified , then assembler assumes NEAR as a type Specifies. General Form: 🞇 Procedure _ name PROC [NEAR/FAR]
  • 60. Procedure Definition Directive : ENDP ENDP: END OF PROCEDURE ENDP The directive is used along with the name of the procedure to indicate the end of a procedure to the assembler. General Form : Procedure _ name ENDP EXAMPLE: FACTORIAL ENDP
  • 62. MACRO Definition Directive:- MACRO MACRO: The directive MACRO informs the assembler the beginning of a MACRO. It consists of name of a MACRO followed by keyword MACRO and MACROARGUMENT. General Form : MACRO_ NAME MACRO [ARGUMENT 1 ….,…..ARGUMENT N]
  • 63. MACRO Example :- DISPMACRO MSG … whose name is display by MACRO PUSHAX PUSH DX MOVAH, 09H LEADX ,MSG INT 21H POPDX POPAX ENDM …… open subroutine …… open subroutine …… Read the string, 09h is function to display string …… Load effective address ……Termination of program with a return code …… Avoiding overhead of writing the repeat pattern of the code. …… End of MACRO
  • 64. MACRO Definition Directive :ENDM ENDM: END OF MACRO The directive ENDM informs the assembler the end of the MACRO. The directive MACRO and ENDM must enclose the definition, declaration. General Form : ENDM
  • 65. ENDM Example :- DISPMACRO MSG …whose name is display by MACRO PUSHAX PUSH DX MOVAH, 09H LEADX ,MSG INT 21H POPDX POPAX ENDM …… open subroutine …… open subroutine …… Read the string, 09h is function to display string …… Load effective address ……Termination of program with a return code ……Avoiding overhead of writing the repeat pattern of the code. …… End of MACRO
  • 66. Data Control Directive PUBLIC EXTRN: EXTERNAL PTR: POINTER
  • 67. Data Control Directive : PUBLIC PUBLIC: the directive PUBLIC informs the assembler that specified variable or segment can be accessed from other program module. It helps in managing the multiple program module by sharing global variables. General Form : PUBLIC VARIABLE 1,……. VARIABLE N
  • 68. PUBLIC EXAMPLE: PUBLIC MSG, NAME , NUM PUBLICARRAY
  • 69. Data Control Directive : EXTRN EXTRN: EXTERNAL The directive EXTRN informs the assembler that the data items or label following the directive will be used in a program module. General Form : EXTRN VARIABLE_NAME1,……. VARIABLE _NAME N
  • 70. EXTRN: EXAMPLE EXTRN DISPLAY : NEAR EXTRN DISPLAY : FAR
  • 71. Data Control Directive : PTR PTR: POINTER The directive PTR is used to indicate the type of the memory access i.e. BYTE/WORD/DWORD. General Form : PTR EXAMPLE INC BYTE PTR[DI]…..Increment byte pointer
  • 73. Branch Displacement Directive : SHORT SHORT One byte displacement is required to code to jump instruction. General Form : JKPSHORT NEXT
  • 74. Branch Displacement Directive : LABEL LABEL: Assign a name to the current value in the location counter. General Form : LABLE EXAMPLE LABLE_NAME
  • 75. File Inclusion Directive INCLUDE This INCLUDE directive is used to insert a block of source code from the named file into the current source module. The directive INCLUDE informs the assembler to include the statement defined in the include file. General Form : INCLUDE<FILE PATH> EXAMPLE INCLUDEC:MASMMACRO.LI B
  • 76. Describe model of assembly language programming Note :Any one model can be considered. Model 1 : 1) Using SEGMENT,ASSUME and ENDS directives 2) In this Data _ Seg is the name of the data segment where data are declared. 3) Code _ Seg is the name of the code segment where code is written. 4) Start is the label name used to initialize the CSregister. 5) ENDS to indicate the ends of code and data segment 6) END marks the end of the program.
  • 77.
  • 78. Model 2 : a. Using .Data and .code directive b. In this, .model small is used to indicate small memory model is used in the program c. Stack 100 to indicate 100 word memory locations reserved for stack d. Data indicates start of the data segment where data declaration of the program is made. e. Code indicates the beginning of the code segment f. END to indicate the termination of the program.
  • 79.