The 8086 Essentials
The 8086 Essentials
The 8086 Essentials
8086 microprocessors
What is microprocessor ?
• A microprocessor is a computer processor that
incorporates the functions of a computer's
central processing unit (CPU) on a single
integrated circuit (IC).
• The microprocessor is a multipurpose,
programmabledevice that accepts digital data
as input, processes it according to instructions
stored in its memory, and provides results as
output
Terms related to Microprocessors
• Bit
A digit of the binary number or code
• Nibble
The 4-bit binary number or code
• Byte
The 8-bit binary number or code
• Word
The 16-bit binary number or code
• Double Word
The 32-bit binary number or code
Terms related to Microprocessors
• Data
The quantity operated by an instruction of a
program is called data. The size of the data is
specified as Bit, Byte,Word……..
• Address
The address is an identification number in binary
for Memory locations. The 8086 processor uses
20-bit address for memory.
• Bus
A bus is a group of conducting lines that carries
data,address and control signals.
Features of 8086
• Introduced in 1978 .
• Comes in Dual-In-Line Package(DIP) IC.
• 8086 1s a 16-bit microprocessor .
• Works on 5 volts power supply.
• It is built on single semiconductor chip and
packaged in an 40-pin IC.
• It has 20-bit address bus and 16-bit data bus.
• It can directly address upto 220 I.e., 1M bytes of
memory.
• The maximum internal clock for 8086 is 5MHz
8086 6
8086 Architecture
8086 8
8086 Architecture
EXECUTION UNIT
8086 9
8086 Architecture
Functions of EU
• Receives opcode of an instruction from the queue.
• decodes the instructions.
• Executes the instruction.
Functions of various parts of EU
• Control circuitry: Directs internal operations.
• Instruction Decoder: Translates instructions fetched from
memory into series of actions.
• ALU: Performs arithmetic and logical operations.
• FLAGS: Reflects the status of program.
• General purpose registers: Used to store Temporary data.
• Index and Pointer registers: Specifies/ informs about offset of
operand
8086
10
8086 Architecture
BUS INTERFACE UNIT
8086 11
8086 Architecture
Functions of BIU
• Handles transfer of data and address between processor
and memory / I/O devices.
• Compute physical address and send it to memory
interfaces.
• Fetches instruction codes and stores it in Queue.
8086 12
8086 Architecture
Functions of various parts of BIU
• Segment registers : Used to hold the starting address of
the segment .
• Queue register: Used to store prefetched instructions and
inputs it to EU. which is an 6-byte FIFO register set. When
the EU is ready for its next instruction,it simply reads the
instruction byte(s) for the instruction from the queue
which is present in BIU.
• Instruction Pointer: Used to point to the next instruction
to be executed by EU.
8086 13
Register organization of 8086
• The various registers available internal to 8086
microprocessors are :
1. Flag Register
2. General purpose registers
AX ( AH,AL)
BX (BH,BL)
CX (CH,CL)
DX (DH,DL)
3. Pointer and Index registers (IP,SP,BP & SI,DI)
4. Segment registers (ES, CS, DS,SS)
8086 14
The 8086 Registers
Accumulator AX AH AL
Base register BX BH BL
General Registers
Count registerCX CH CL
Data register DX DH DL
Source SI
Index Registers
Destination DI
Base BP
Stack SP Pointer Regsiters
Instruction IP
SF Status Flags
Code CS
Data DS
Segment Registers
Extra ES
Stack SS
Register organization of 8086
Flag Register
• Flag register is part of EU.
• 8086 microprocessor has a 16-bit flag register.
• The flag register contents indicate the result of compuitation
in the ALU.It is also known as PSW ( Program Status Word).
• The flag register/psw can be divided into 2-parts:
Conditional /status flags
Machine Control flags
• 8086 microprocessor has 9- active flags
6- conditional flags
3- control flags
• Conditional flags: The lower byte of the flag register along
with overflow flag, they reflect the status of program.
8086 17
Register organization of 8086
• Control Flags : Higher byte of the flag register , It has 3-
flags i.e., direction flag, interrupt flag and trap flag.
They control the working of machine(microprocessor)
BIT 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
X X X X O D I T S Z X AC X P X C
O Overflow flag, D Direction flag, I Interrupt flag,
T Trap flag, S Sign flag, Z Zero flag,
AC Auxiliary Carry flag, P Parity flag
CY Carry flag, X Not used / Undefined
8086 19
Register organization of 8086
Flag Register
Condition flags
• Bit – 6 : ZF (zero flag) — set to 1 if result is 0; to 0
if result is nonzero
• Bit – 7 : SF (sign flag) —set to 1 if equal to MSB of
result is 1.Thus this flag indicates whether the
result is positive or negative.
• Bit – 11 : OF (overflow flag) — set if overflow
occurs (that is, the result can not be included in
the available capacity)
8086 20
Register organization of 8086
Example – 1
• CF (carry flag) — carry out of 0011 0100 1101
MSB 1100
• PF (parity flag) — set to 1 if low-
order 8 bits (low order byte) +0000 0111 0010
contain even number of 1’s 1110
• AF (auxiliary carry flag) —carry 0011 1100 0000
out of bit 3 1010
• ZF (zero flag) — set to 1 if result
is 0; to 0 if result is nonzero CF = 0
• SF (sign flag) —MSB of result PF = 1
• OF (overflow flag) — set if carry AF = 1
in to MSB is not equal to carry
out from MSB) ZF = 0
SF = 0
8086
OF = 0 21
Register organization of 8086
Example – 2
• CF (carry flag) — carry out of 1111 1111
MSB 1110 0101
• PF (parity flag) — set to 1 if low- +1111 1111 1011
order 8 bits (low order byte) 0001
contain even ndfgdfgumber of 1 1111 1111 1001
1’s 0110
• AF (auxiliary carry flag) —carry CF = 1
out of bit 3 PF = 1
• ZF (zero flag) — set to 1 if result
is 0; to 0 if result is nonzero AF = 0
• SF (sign flag) —MSB of result ZF = 0
• OF (overflow flag) — set if carry SF = 1
in to MSB is not equal to carry
out from MSB) OF = 0
8086 22
Register organization of 8086
Flag Register
Control flags
• TF (trap flag) — if set, a trap is executed after
each instruction (single step execution).
• IF (interrupt enable flag) — if set, a maskable
interrupt can be recognized by the CPU;
otherwise, these interrupts are ignored.
• DF (direction flag) — used by string manipulation
instructions; if clear to 0, then process string from
low address to high; if set to 1, then process string
from high address to low.
8086 23
Register organization of 8086
General Purpose Register
• In 8086 there are 4- general purpose registers i.e.,
AX,BX,CX,DX.
• These registers are of 16-bit size and can be used either as
a whole 16-bit register ( the letter X used in the
representation of the register indicates that the complete
16 – bit register is being used) or the upper and lower
bytes can be accessed separately ( the letters H and L
indicates the higher order and lower order bytes
respectively in the representation of the registers )
• The general purpose registers can be used to store both
operands and temporary results and each of them can be
accessed as whole or as sub-registers.
8086 24
Register organization of 8086
General Purpose Register
• In addition to serving as general purpose registers
AX,BX,CX,DX have special uses as addressing, counting,
and I/O roles.
• The special uses of the general purpose registers is:
AX used as accumulator
BX used as a base register in address
calculation for some of the instructions
CX used as an counter by certain instructions
(ex : Loop)
DX used as a destination register in case of
multiplication and division instructions
8086 25
Register organization of 8086
•
8086 26
Register organization of 8086
• Code segment register :It is used to address
the code segment of memory, where the
executable program is stored.
• Data segment register: is points to data
segment of memory, where the data is resided.
• Extra segment register :It is another data
segment of memory. Thus extra segment also
contains data.
• Stack segment register:It is used to address
the stack segment of memory .which is used to
store stack data.
Register organization of 8086
Pointer and index registers
• The 8086 contains 3 pointer registers(IP,SP,BP) and 2 index
registers(SI,DI).All these registers are 16-bit registers.
• The pointer registers contain the offsets with in the
particular segments as follows:
IP Offset within the Code segment.
BP Offset within the Data segment.
SP Offset within the Stack segment.
• The SI register is used to store the offset of sourse data in
data segment, while DI register is used to store the offset
of destination in data in data or extra segment.
• The index registers are particularly useful for string
manipulations.
8086 28
Generation of 20-bit(physical) address
• To access any memory location from any
segment we need 20-bit physical address.
• The 8086 generates this address using contents
of segment registers & offset registers.
• For this, the contents of segment register also
called as segment address is shifted left bit-wise
by four times & to this result,contents of offset
register also called as offset adderss is added.
• The Bus Interface Unit(BIU) has a separate
adder to perform this procedure for obtaining
physical address.
Generation of 20-bit(physical) address
Example:
1 5 5 A 5
Unit -1
1. List Features of 8086
2. Explain about Registers of 8086
3. Mention Segment registers of 8086
4.Explain about Pointer and index Registers
5.Define flag, Explain different flags used in 8086
6.Explain about BIU and EU
7.Explain the architecture of 8086 with neat diagram
8. Calculate physical address for segment address
1006 H and offset address 7777 h
9.Explain Addressing modes of 8086
10.Explain about processor control (or) Machine control
instructions
Unit-2
1.Write and ALP for Addition of series of
numbers
2. Write an ALP for Average of Series of numbers
3.Write an ALP for SUM of SQUARES of series of
numbers
4.Write an ALP for SUM of CUBES of Series of
numbers
5.Write an ALP for Factorial of a Number
Addressing Modes Of 8086
Addressing modes:
addressing modes indicates a way of locating data
or operands.
Addressing modes of the instructions depending
upon their types.
According to the flow of instruction execution, the
instructions are classified as
(i) sequential control flow instructions
(ii) control transfer insructions
unit-2 33
Addressing modes for sequential control flow instructions
unit-2 34
Immediate Addressing Mode:
The data is part of instruction itself and it is available in
successive bytes . The immediate data may be 8 or 16 bit.
unit-2 35
Direct Addressing Mode:
In this addressing mode, address of memory is specified in the
instruction.
Example: MOV AX, [5000]
unit-2
36
Indexed Addressing Mode:
In this mode , offset of the operand is stored in one of the segment
registers.DS is the default segment for index registers SI and DI.
Example: MOV AX,[SI]
unit-2 37
Register Relative Addressing Mode:
The physical address is formed by adding 8-bit or 16-bit
displacement with the contents of any one of the registers
BX,BP,SI,DI in the default segments.
Example: MOV AX,50H[BX]
unit-2 38
Addressing modes for control transfer instructions
For the control transfer instructions, the addressing modes
depend upon whether the address location is within the
same segment or in different segment.
The various control transfer addressing modes are:
1. Intra-segment Direct mode
2. Intra-segment Indirect mode
3. Inter-segment Direct mode
4. Inter-segment Indirect mode
unit-2 39
Cont……..
Intra-Segment Direct Addressing Mode:
The address to which the control is to be transferred
lies in the same segment and appears directly in the
instruction as an immediate displacement value .
unit-2 40
Cont….
Intra-Segment Indirect Addressing Mode:
The address to which the control is to be transferred
is in the same segment but it is passed to the
instruction indirectly. The address is found as the
content of a register or a memory location .
unit-2 41
8 - bit Addition
Assume cs: code
code segment
start:
MOV AL, 05H
MOV BL, 07H
ADD AL,BL
INT 3H
Code ends
end start
8 - bit Addition using Data Segment
DEC CL
JNZ again
MOV od, DX
MOV eve , BX
INT 3H
code ends
Greatest number in list
assume cs: code ,ds: data
data segment
list db 10h,20h,30h,40h,50h
res db ?
data ends
code segment
start:
MOV AX, data
MOV DS,AX
XOR AX,AX
MOV Cl,04H
MOV SI, offset list
MOV AL,[SI]
again: CMP AL,[SI+1]
JNL next
MOV AL, [SI+1]
next: INC SI
DEC CL
JNZ again
MOV res,AL
INT 3h
code ends
end start
Instruction set of 8086
The instruction set of 8086 can be classified into
following groups
1.Data transfer instructions
2. Arithmetic instructions
3. Bit manipulation (or) logical instructions
4. String instructions
5.Control transfer (or) branch instructions
6. Processor control instructions
instruction set 54
Data transfer instructions
• General purpose byte or word transfer instructions:
1) MOV
2) PUSH
3) POP
4) XCHG
5) IN
6) OUT
7) XLAT
8) LEA
9) LDS/LES
10) LAHF
11) SAHF
12) PUSHF
13) POPF
instruction set 55
Data transfer instructions
instruction set 57
Data transfer instructions
Examples: 1.POP AX
2.POP [5000H]
instruction set 58
Data transfer instructions
instruction set 59
Arithmetic instructions
• ADD
• ADC
• INC
• DEC
• SUB
• SBB
• CMP
• AAA
• AAS
• AAM
Arithmetic instructions
• AAD
• DAA
• DAS
• NEG
• MUL
• IMUL
• CBW
• CBD
• DIV
• IDIV
Arithmetic instructions
• INC: Increment
• Increases the contents of register or memory
location by 1
• Ex: INC AX
INC [5000H]
Arithmetic instructions
• DEC: Decrement
• Subtracts 1 from the contents of specified
register or memory location.
• Ex: DEC AX
DEC [5000H]
Arithmetic instructions
• SUB:Subtract
• This instruction subtracts the source operand from the
destination operand and the result is stored in destination.
• The source operand may be a register or a memory location
or an immediate data and the destination operand may be a
register or a memory location.
• All the conditional flags are affected by SUB instruction.
Example: SUB AX,BX
SUB AX,1000H
SUB AX,[5000H]
Arithmetic instructions
After the addition the AAA instruction examines the lower 4-bits of AL to
check whether it contains a valid BCD between 0 to 9.
instruction set 68
ARITHMETIC INSTRUCTIONS
After the execution of AAA instruction AX = 0100 and after OR’ing the
contents of AX with 3030H then AX = 3130H which is equivalent to
ASCII equivalent of BCD number 10.
instruction set 69
Arithmetic instructions
EX:
MOV AL, 04 ; AL 04
MOV BL, 09 ; BL 09
MUL BL ; AH:AL 24 H (9 X 4)
AAM ; AH 03
AL 06
Arithmetic instructions
instruction set 74
ARITHMETIC INSTRUCTIONS
• Example:
• (1) AL = 75, BL = 46
SUB AL,BL ; AL 2F = (AL) – (BL)
; AF = 1
DAS ; AL 29 ( as F > 9, F-6 = 9)
(2) AL = 38 , DL = 61
SUB AL , DL ; AL D7 & CF = 1(borrow)
DAS ; AL 77 (as D > 9 , D-6 = 7)
; CF = 1 (borrow)
instruction set 75
Arithmetic instructions
o MUL : Multiplication
MUL Reg. / Mem.
This instruction multiplies byte or word by the contents of
AL & AX respectively.
For Byte multiplication the most significant byte will be
stored in AH register and least significant byte is stored in
AL register.
For Word multiplication the most significant word of the
result is stored in DX, while the least significant word of
the result is stored in AX register
Example: MUL BL
MUL BX
ARITHMETIC INSTRUNCTIONS
IMUL : Signed Multiplication.
This instruction multiplies a signed byte in source operand by a signed
byte in AL register or A signed word in AX register.
The source can be a general purpose register, memory operand,index
register or base register, but it cannot be an immediate data.
While using this instruction the content of accumulator and register
should be sign extended binary in 2’s complement form and the result
is also in sign extended binary.
In case of 32-bit results, the higher order word(MSW) is stored in DX
and lower order word is stored in AX
In case of 16-bit result it will be stored in AX register.
Example: IMUL BL
IMUL BX
instruction set 77
ARITHMETIC INSTRUCTIONS
EX:
1. If AL = 1000 0000(80h)
Then AH 1111 1111(FFh)
AX=FF80H
instruction set 78
Arithmetic instructions
o CWD : Convert signed word to double word
CWD instruction copies the sign bit of AX to all the
bits of DX register
This operation is to be done before signed division.
Bit-15 of AX is moved to all the bits of DX register.
EX:
1. If AX = 1000 0000 0000 0000(8000H)
then DX 1111 1111 1111 1111 (FFFFH)
Arithmetic instructions
o DIV : division
DIV <reg./Mem>
It divides an word or double word by a 16-bit or 8-bit
operand.
The dividend for 32-bit operation will be in DX:AX
register pair (Most significant word in DX and least
significant word in AX).
The result of division is for 16-bit number divided by 8-
bit number the Quotient will be in AL register and the
remainder will be in AH register similarly for 32-bit
number divided by 16-bit number the Quotient will be
in AX register and the remainder will be in DX register.
EX: DIV BL
DIV BX
instruction set 80
LOGICAL INSTRUCTIONS
• AND
• OR
• NOT
• XOR
• TEST
• SHL/SAL
• SHR
• SAR
• ROR
• ROL
• RCR
• RCL
LOGICAL INSTRUCTIONS
AND : Logical AND of corresponding bits of two operands
AND <Destination> , <Source>
This instruction ANDs each bit in a source byte or word (which might be a
register or a memory location or an immediate data) with the same
number bit in a destination (which might be a register or a memory
location) byte or word.
The result is stored in destination operand. At least one of the operands
should be a register or an memory location , but both the operands cannot
be memory locations or immediate operands and also immediate operand
cannot be a destination operand.
The AND operation gives output 1 only when both the inputs are high.
AND AX , 0008H (let [AX] = 4567H
4567 = 0100 0101 0110 0111 ; 0008 = 0000 0000 0000 1000
4567 AND 0008 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1
AND
00 00 00 00 0 000 10 00
00 00 0 0 0 0 0 0 0 0 0 0 0 0 = 0000H
instruction set 82
LOGICAL INSTRUCTIONS
• EX: AND AX,0008H
• AND AX,BX
• AND AX,[5000H]
LOGICAL INSTRUCTIONS
• EX: OR AX,0008H
• OR AX,BX
• OR AX,[5000H]
LOGICAL INSTRUCTIONS
NOT : Complement / Negation (Invert each bit of
operand)
NOT < Destination>
The NOT instruction inverts each bit (forms the 1’s
complement) of the byte or word at the specified
destination.
The destination can be a register or a memory
location .
instruction set 87
LOGICAL INSTRUCTIONS
CF MSB 0
These instructions shift the operand word or byte bit by bit to the left
and insert zeros in the newly introduced least significant bits.
The number of bits to be shifted if 1 will be specified in the instruction
itself if the count is more than 1 then the count will be in CL register.
The operand to be shifted can be either register or memory location
contents but cannot be immediate data.
instruction set 88
LOGICAL INSTRUCTIONS
0 MSD LSD CF
These instructions shift the operand word or byte bit by bit to the
right and insert zeros in the newly introduced Most significant bits.
The result of the shift operation will be stored in the register itself.
The number of bits to be shifted if 1 will be specified in the instruction
itself if the count is more than 1 then the count will be in CL register.
The operand to be shifted can be either register or memory location
contents but cannot be immediate data.
instruction set 89
LOGICAL INSTRUCTIONS
MSB LSB CF
These instructions shift the operand word or byte bit by bit to the
right.
SAR instruction inserts the most significant bit of the operand in the
newly inserted bit positions.
The result will be stored in the register or memory itself.
The number of bits to be shifted if 1 will be specified in the
instruction itself if the count is more than 1 then the count will be in
CL register.
The operand to be shifted can be either register or memory location
contents but cannot be immediate data.
instruction set 90
LOGICAL INSTRUCTIONS
CF
This instruction rotates all the bits in a specified word or byte to the left by
the specified count (bit-wise) excluding carry.
The MSB is pushed into the carry flag as well as into LSB at each operation.
The remaining bits are shifted left subsequently by the specified count
positions.
The operand can be a register or a memory location.
The count will be represented with CL register.
instruction set 91
LOGICAL INSTRUCTIONS
CF
This instruction rotates all the bits in a specified word or byte to the left by
the specified count (bit-wise) including carry.
The MSB is pushed into the CF and CF into LSB at each operation. The
remaining bits are shifted left subsequently by the specified count positions.
The operand can be a register or a memory location.
instruction set 92
LOGICAL INSTRUCTIONS
CF
This instruction rotates all the bits in a specified word or byte to the right by
the specified count (bit-wise) excluding carry.
The LSB is pushed into the carry flag as well as the MSB at each operation. The
remaining bits are shifted right subsequently by the specified count positions.
instruction set 93
LOGICAL INSTRUCTIONS
CF
This instruction rotates all the bits in a specified word or byte to the right by
the specified count (bit-wise) excluding carry.
The LSB is pushed into the carry flag as well as the MSB at each operation. The
remaining bits are shifted right subsequently by the specified count positions.
The operand can be a register or a memory location.
instruction set 94
String Instructions
A string is a sequence of bytes or words i.e., a series of
data bytes or words available in memory at consecutive
locations, to be referred to collectively or individually and
is known as byte strings or word strings.
For referring to a string, two parameters are required,
Starting or end address of the string.
Length of the string.
The length of the string is usually stored as count in the CX
register.
in the case of 8086, index registers are used as pointers for
the source and destination strings (SI and DI respectively).
The pointers are updated i.e., incrementing and
decrementing of the pointers depending on the status of
the DF flag.
instruction set 95
String Instructions
The string instructions are categorized as
1. Prefix instructions
2. String data manipulation instructions
instruction set 96
String Instructions
Prefix instructions
REP : It is prefix to the other instructions
The instruction with REP prefix will be executed repeatedly until the CX
register becomes zero( for each iteration CX is automatically
decremented by one).
When CX becomes zero , the execution proceeds to the next instruction
in the sequence.
REPE / REPZ : Repeat when equal or till ZF = 1.
instruction set 97
String Instructions
String data byte/word manipulation instructions
MOVS / MOVSB / MOVSW: Move string byte or word
instruction set 98
String Instructions
String data byte/word manipulation instructions
CMPS / CMPSB / CMPSW: Compare string byte or word
Compare one byte or word of a string data stored in data segment with
that stored in extra segment.
The SI register points to the source string and DI register points to the
destination string.
REPE prefix is used with CMPS instruction to repeat it by a value given
in CX register.
The CX register is decremented by one for each byte / word movement.
The SI and DI registers are automatically incremented or decremented
depending on the status of DF.
instruction set 99
String Instructions
String data byte/word manipulation instructions
SCAS / SCASB / SCASW: Scan string byte or String word
One byte or word of a string data stored in data segment is loaded into
AL / AX register.
The SI register points to the source string in the DS.
The SI register is automatically incremented or decremented depending
on the status of DF.
NOP: No operation
When NOP instruction is executed processor does not perform
any operation
Processor Control Instructions
LABEL
• Used to give the name to the current value in the location
counter.
• The LABEL directive must be followed by a term which
specifies the type you want associated with that name.
LENGTH
• Used to determine the number of items in some data
such as string or array.
• EX:MOV CX,LENGTH ARRAY
Assembler Directives(contd.)
OFFSET
• It is an operator which tells the assembler to determine
the offset or displacement of named data item or
procedure from the start of the segment which contains it.
• EX: MOV SI,OFFSET LIST
ORG – Originate
• Tells the assembler to set the location value.
• Example, ORG 7000H sets the location counter value to
point to 7000H location in memory.
Assembler Directives(contd.)
PROC – Procedure
• Used to identify the start of the procedure.
PTR – Pointer (BYTE OR WORD)
• Used to assign a specific type to a variable or a
label.
• EX:MOV AL, BYTE PTR [SI]
MOV AX,WORD PTR [SI]
Assembler Directives(contd.)
• + & - operators:
• These operators represents arithmetic
addition & subtraction.
• EX:MOV AX,[SI+2]
MOV DX,[BX-3]
• SEGMENT: logical segment
• Ex:CODE SEGMENT
Assembler Directives(contd.)
SHORT
• Used to tell the assembler that only a 1-byte displacement is
needed to code a jump instruction.
• If the jump destination is after the jump instruction in the
program, the assembler will automatically reserve 2 bytes for the
displacement.
TYPE
• Tells the assembler to determine the type of a specified variable.
• The TYPE operator can be used in instruction such as ADD BX,
TYPE WORD_ARRAY, where we want to increment BX to point to
the next word in an array of words.
Procedures & Macros
• The procedure is a group of repetitive instructions
stored as a separate program in the memory and it is
called from the main program whenever required.
• Type of procedure depends on where the procedure is
stored in the memory.
• If it is in the same code segment where the main
program is stored then It is called near procedure
otherwise it is referred to as far procedure.
• This procedures are used by CALL and RET
instructions.
Procedures & Macros
• The CALL instruction is used to transfer execution to
procedure or subprogram. there are two types of
CALLs, near & far.
• Near call is a call to a procedure which is in the same
code segment as the call instruction.
• Far call is a call to a procedure which is in the different
code segment from that which contains the call
instruction.
• RET instruction will return the execution from a
procedure to the next instruction after call instruction.
Procedures & Macros
• Macro is a group of repetitive instructions.
• The macro assembler generates the code in
the program each time where the macro is
called, such that it takes ore memory.
• Macros can be defined by MACRO and ENDM.
Differencec b/w Procedures & Macros
Procedures Macros
Accessed by CALL & RET Accessed during assembly with
instuctions during program name given to macro when
execution. defined.
Machine code for instructions Machine code is generated for
is put only once in the memory. instructions each time when
macro is called.
With procedures less memory With macros more memory is
is required. required.