Unit 1 MPMC Notes
Unit 1 MPMC Notes
UNIT-I
THE 8086 MICROPROCESSOR
INTRODUCTION TO MICROPROCESSOR:
OVERVIEW OF A SIMPLE MICRO COMPUTER:
The major parts are the central processing unit or CPU, memory, and the input and output circuitry or I/O.
Connecting these parts together are three sets of parallel lines called buses. The three buses are the address
bus, the data bus, and the control bus.
i) MEMORY: The memory section usually consists of a mixture of RAM and ROM. It may also have
magnetic floppy disks, magnetic hard disks, or laser optical disks. Memory has two purposes. The first purpose
is to store the binary codes for the sequence of instructions you want the computer to carry out. When you
write a computer program, what you are really doing is just writing a sequential list of instructions for the
computer. The second purpose of the memory is to store the binary-coded data with which the computer is
going to be working.
ii) INPUT/OUTPUT: The input/output or I/O section allows the computer to take in data from the outside
world or send data to the outside world. These allow the user and the computer to communicate with each
other. The actual physical devices used to interface the computer buses to external systems are often called
ports.
iii) CPU: The central processing unit or CPU controls the operation of the computer. It fetches binary-
coded instruction of the computer. It fetches binary-coded instructions from memory, decodes the
instructions into a series of simple actions, and carries out these actions. The CPU contains an arithmetic logic
unit, or ALU. Which can perform add, subtract, OR, AND, invert, or exclusive-OR operations on binary words
when instructed to do so. The CPU also contains an address counter which is used to hold the address of the
next instruction or data to be fetched from memory, general-purpose registers which are used for temporary
storage of binary data, and circuitry which generates the control bus signals.
1
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
iv) ADDRESS BUS: The address bus consists of 16, 20, 24, or more parallel signal lines. On these lines the
CPU sends out the address of the memory location that is to be written to or read from. The number of address
lines determines the number of memory locations that the CPU can address. If the CPU has N address lines
then it can directly address 2N memory locations.
v) DATA BUS: The data bus consists of 8, 16, 32 or more parallel signal lines. As indicated by the double-
ended arrows on the data bus line, the data bus lines are bi-directional. This means that the CPU can read
data in on these lines from memory or from a port as well as send data out on these lines to memory location
or to a port. Many devices in a system will have their outputs connected to the data bus, but the outputs of
only one device at a time will be enabled.
vi) CONTROL BUS: The control bus consists of 4-10 parallel signal lines. The CPU sends out signals on the
control bus to enable the outputs of addressed memory devices or port devices. Typical control bus signals
are memory read, memory write, I/O read, and I/O writer. To read a byte of data from a memory location, for
example, the CPU sends out the address of the desired byte on the address bus and then sends out a memory
read signal on the control bus.
What is a Microprocessor?
• The word comes from the combination micro and processor.
– Processor means a device that processes numbers, specifically binary numbers, 0’s and 1’s.
– Micro is a new addition.
– In the late 1960’s, processors were built using discrete elements.
– These devices performed the required operation, but were too large and too slow.
– In the early 1970’s the microchip was invented. All of the components that made up the
processor were now placed on a single piece of silicon. The size became several thousand
times smaller and the speed became several hundred times faster.
– The “Micro” Processor was born.
Definition of Microprocessor:
Microprocessor is a multipurpose, programmable device that accepts digital data as input, processes
it according to instructions stored in its memory, and provides results as output.
or
2
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
MICROCONTROLLER:
A microcontroller (sometimes abbreviated µC, uC or MCU) is a small computer on a single integrated
circuit containing a processor core, memory, and programmable input/output peripherals.
or
History of Microprocessors:
8080 8 2M 1974
8085 8 3M 1976
8086 16 5, 8 or 10M 1978
8088 16 5, 8 or 10M 1979
80186 16 6M 1982
80286 16 8M 1982
80386 32 16 to 33M 1986
80486 32 16 to 100M 1989
Pentium 32 66M 1993
Pentium II 32 233 to 500M 1997
Pentium III 32 500M to 1.4G 1999
Pentium IV 32 1.3 to 3.8G 2000
Dual core 32 1.2 to 3 G 2006
Core 2 Duo 64 1.2 to 3G 2006
i3, i5 and i7 64 2.4G to 3.6G 2010
3
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
o 8086 → 5MHz
o 8086-2 → 8MHz
o 8086-1 → 10 MHz
8086 supports 2 modes of operation
Minimum mode
Maximum mode
4
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
o Execution Unit(EU)
5
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
The Execution Unit (EU):
Execution unit gives instructions to BIU stating from where to fetch the data and then decode
and execute those instructions.
Its function is to control operations on data using the instruction decoder & ALU.
EU has no direct connection with system buses as shown in the above figure, it performs
operations over data through BIU.
The EU contains control circuitry, which directs internal operations.
The main functions of EU are:
o Decoding of Instructions
o Execution of instructions
ALU:
The EU has a 16-bit arithmetic logic unit (ALU) which can add, subtract, AND, OR, XOR,
increment, decrement, complement or shift binary numbers.
Flag Register:
It is a 16-bit register that behaves like a flip-flop, i.e. it changes its status according to the
result stored in the accumulator.
It has 9 flags and they are divided into 2 groups
o Conditional Flags
o Control Flags
Conditional Flags
It represents the result of the last arithmetic or logical instruction executed. Following is
the list of conditional flags –
Carry flag − This flag indicates an overflow condition for arithmetic operations.
Auxiliary flag − When an operation is performed at ALU, it results in a carry/barrow from lower nibble
(i.e. D0 – D3) to upper nibble (i.e. D4 – D7), then this flag is set, i.e. carry given by D3 bit to D4 is AF flag.
The processor uses this flag to perform binary to BCD conversion.
6
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
Parity flag − This flag is used to indicate the parity of the result, i.e. when the lower order 8-bits of the
result contains even number of 1’s, then the Parity Flag is set. For odd number of 1’s, the Parity Flag is
reset.
Zero flag − This flag is set to 1 when the result of arithmetic or logical operation is zero else it is set to
0.
Sign flag − This flag holds the sign of the result, i.e. when the result of the operation is negative, then
the sign flag is set to 1 else set to 0.
Overflow flag − This flag represents the result when the system capacity is exceeded.
Control Flags
Control flags controls the operations of the execution unit. Following is the list of control
flags –
Trap flag − It is used for single step control and allows the user to execute one instruction at a time for
debugging. If it is set, then the program can be run in a single step mode.
Interrupt flag − It is an interrupt enable/disable flag, i.e. used to allow/prohibit the interruption of a
program. It is set to 1 for interrupt enabled condition and set to 0 for interrupt disabled condition.
Direction flag − It is used in string operation. As the name suggests when it is set then string bytes are
accessed from the higher memory address to the lower memory address and vice-a-versa.
There are 8 general purpose registers, i.e., AH, AL, BH, BL, CH, CL, DH, and DL.
These registers can be used individually to store 8-bit data and can be used in pairs to
store 16 bit data.
The valid register pairs are AH and AL, BH and BL, CH and CL, and DH and DL. It is referred
to the AX, BX, CX, and DX respectively.
AX register − It is also known as accumulator register. It is used to store operands for arithmetic
operations.
BX register − It is used as a base register. It is used to store the starting base address of the memory
area within the data segment.
CX register − It is referred to as counter. It is used in loop instruction to store the loop counter.
7
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
DX register − This register is used to hold I/O port address for I/O instruction. Stack pointer register It is
a 16-bit register, which holds the address from the start of the segment to the memory location, where a
word was most recently stored on the stack.
The BIU sends out addresses, fetches instructions from memory, reads data from ports
and memory, and writes data to ports and memory.
In simple words, the BIU handles all transfers of data and addresses on the buses for the
execution unit.
Instruction queue
BIU contains the instruction queue. BIU gets upto 6 bytes of next instructions and stores them
in the instruction queue. When EU xecutes instructions and is ready for its next instruction,
then it simply reads the instruction from this instruction queue resulting in increased
execution speed.
Fetching the next instruction while the current instruction executes is called pipelining.
8
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
Segment Registers:
Instruction pointer(IP)
It store memory location of next instruction to be executed.
Addressing modes of 8086:
Addressing mode indicates a way of locating data or operands.
The addressing modes describe the types of operands and the way they are accessed for executing an
instruction.
1. Immediate: In this type of addressing, immediate data is a part of instruction and appears in the
form of successive byte or bytes.
Ex: MOV AX, 0005H
In the above example, 0005H is the immediate data. The immediate data may be 8-bit or 16-bit in
size.
9
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
2. Direct: In the direct addressing mode a 16-bit memory address (offset) is directly specified in the
instruction as a part of it.
Ex: MOV AX, [5000H]
Here, data resides in a memory location in the data segment, whose effective address may be
completed using 5000H as the offset address and content of DS as segment address. The effective
address here, is 10H * DS + 5000H.
3. Register: In register addressing mode, the data is stored in a register and is referred using the
particular register. All the registers, except IP, may be used in this mode.
Ex: MOV BX, AX
4. Register Indirect: Sometimes, the address of the memory location, which contains data or
operand, is determined in an indirect way, using the offset register. This mode of addressing is
known as register indirect mode. In this addressing mode, the offset address of data is in either
BX or SI or DI register. The default segment is either DS or ES. The data is supposed to be available
at the address pointed to by the content of any of the above registers in the default data
segment.
Ex: MOV AX, [BX]
Here, data is present in a memory location in DS whose offset address is in BX. The effective
address of the data is given as 10H * DS+[BX].
5. Indexed: In this addressing mode, offset of the operand is stored in one of the index registers. DS
and ES are the default segments for index registers, SI and DI respectively. This is a special case of
register indirect addressing mode.
Ex: MOV AX, [SI]
Here, data is available at an offset address stored in SI in DS. The effective address, in this case, is
computed as 10*DS+[SI].
6. Register Relative: In this addressing mode, the data is available at an effective address formed by
adding an 8-bit or 16-bit displacement with the content of any one of the registers BX, BP, SI and
DI in the default (either DS or ES) segment.
Ex: MOV AX, 50H[BX]
Here, the effective address is given as 10H *DS+50H+[BX]
10
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
7. Based Indexed: The effective address of data is formed, in this addressing mode, by adding
content of a base register (any one of BX or BP) to the content of an index register (any one of SI
or DI). The default segment register may be ES or DS.
Ex: MOV AX, [BX][SI]
Here, BX is the base register and SI is the index register the effective address is computed as 10H
* DS + [BX] + [SI].
8. Relative Based Indexed: The effective address is formed by adding an 8 or 16-bit displacement
with the sum of the contents of any one of the base register (BX or BP) and any one of the index
register, in a default segment.
Ex: MOV AX, 50H [BX] [SI]
Here, 50H is an immediate displacement, BX is base register and SI is an index register the
effective address of data is computed as 10H * DS + [BX] + [SI]
The 8086 instructions are categorized into the following main types.
11
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
Data Transfer Instructions:
These instructions are used to transfer the data from the source operand to the destination
operand. Following are the list of instructions under this group −
MOV − Used to copy the byte or word from the provided source to the provided destination. The
destination can be a register or a memory location. The source can be a register, a memory location, or an
immediate number.
Eg: PUSH BX
POP − Used to get a word from the top of the stack to the provided location.
Eg: POP AX
IN − Used to read a byte or word from the provided port to the accumulator.
12
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
OUT − Used to send out a byte or word from the accumulator to the provided port.
LEA − Used to load the address of operand into the provided register.
LDS − Used to load DS register and other provided register from the memory.
LES − Used to load ES register and other provided register from the memory.
LAHF − Used to load AH with the low byte of the flag register.
PUSHF − Used to copy the flag register at the top of the stack.
POPF − Used to copy a word at the top of the stack to the flag register.
13
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
Arithmetic Instructions
These instructions are used to perform arithmetic operations like addition, subtraction,
multiplication, division, etc.
ADD − Used to add the provided byte to byte/word to word. It effects AF, CF, OF, PF, SF, ZF flags.
ADC − Used to add with carry. It effects AF, CF, OF, PF, SF, ZF flags.
INC − Used to increment the provided byte/word by 1. It effects AF, OF, PF, SF, ZF flags.
Eg: INC AX
AAA (ASCII ADJUST FOR ADDITION) − Used to adjust ASCII after addition.
DAA (DECIMAL ADJUST AFTER BCD ADDITION) − Used to adjust the decimal after the addition/subtraction
operation.
14
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
DEC − Used to decrement the provided byte/word by 1.
Eg: DEC CL
NEG − Used to negate each bit of the provided byte/word and add 1/2’s complement.
Eg: NEG AL
AAS (ASCII ADJUST FOR SUBTRACTION) − Used to adjust ASCII codes after subtraction.
DAS (DECIMAL ADJUST AFTER BCD SUBTRACTION) − Used to adjust decimal after subtraction.
MUL − This instruction multiplies an unsigned byte in some source with an unsigned byte in AL register or
an unsigned word in some source with an unsigned word in AX register.
Eg: MUL BH
IMUL − This instruction multiplies a signed byte from source with a signed byte in AL or a signed word from
some source with a signed word in AX.
Eg: IMUL BH
AAM (BCD ADJUST AFTER MULTIPLY) - Used to adjust ASCII codes after multiplication.
DIV − Used to divide the unsigned word by byte or unsigned double word by word.
Eg: DIV BL
15
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
IDIV − Used to divide the signed word by byte or signed double word by word.
Eg: IDIV BL
CBW (Convert Byte to Word) − Used to fill the upper byte of the word with the copies of sign bit of the
lower byte.
CWD (Convert Word to Double Word) − Used to fill the upper word of the double word with the sign bit of
the lower word.
These instructions are used to perform operations where data bits are involved, i.e. operations like
logical, shift, etc.
Eg: NOT BX
AND − Used for adding each bit in a byte/word with the corresponding bit in another byte/word.
OR − Used to multiply each bit in a byte/word with the corresponding bit in another byte/word.
Eg: OR AH, CL
XOR − Used to perform Exclusive-OR operation over each bit in a byte/word with the corresponding bit in
another byte/word.
16
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
TEST − Used to add operands to update flags, without affecting operands.
SHL/SAL − Used to shift bits of a byte/word towards left and put zero(S) in LSBs.
Syntax: SAL Destination, Count
SHL Destination, Count
SHR − Used to shift bits of a byte/word towards the right and put zero(S) in MSBs.
Syntax: SHR Destination, Count
SAR − Used to shift bits of a byte/word towards the right and copy the old MSB into the new MSB.
Syntax: SAR Destination, Count
ROL − Used to rotate bits of byte/word towards the left, i.e. MSB to LSB and to Carry Flag [CF].
17
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
ROR − Used to rotate bits of byte/word towards the right, i.e. LSB to MSB and to Carry Flag [CF].
RCR − Used to rotate bits of byte/word towards the right, i.e. LSB to CF and CF to MSB.
RCL − Used to rotate bits of byte/word towards the left, i.e. MSB to CF and CF to LSB.
String Instructions
String is a group of bytes/words and their memory is always allocated in a sequential order.
COMS/COMPSB/COMPSW (COMPARE STRING BYTES OR STRING WORDS) − Used to compare two string
bytes/words.
18
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
MOVS/MOVSB/MOVSW − Used to move the byte/word from one string to another.
INS/INSB/INSW − Used as an input string/byte/word from the I/O port to the provided memory location.
OUTS/OUTSB/OUTSW − Used as an output string/byte/word from the provided memory location to the I/O
port.
SCAS/SCASB/SCASW (SCAN A STRING BYTE OR A STRING WORD) − Used to scan a string and compare its
byte with a byte in AL or string word with a word in AX.
LODS/LODSB/LODSW (LOAD STRING BYTE INTO AL OR STRING WORD INTO AX) − Used to store the string
byte into AL or string word into AX.
These instructions are used to transfer/branch the instructions during an execution. Instructions to transfer
the instruction during an execution without any condition
CALL (CALL A PROCEDURE) − Used to call a procedure and save their return address to the stack.
JMP (UNCONDITIONAL JUMP TO SPECIFIED DESTINATION) − Used to jump to the provided address to
proceed to the next instruction.
JA/JNBE (JUMP IF ABOVE / JUMP IF NOT BELOW OR EQUAL) − Used to jump if above/not below/equal
instruction satisfies.
JAE/JNB (JUMP IF ABOVE OR EQUAL / JUMP IF NOT BELOW) − Used to jump if above/not below instruction
satisfies.
JBE/JNA (JUMP IF BELOW OR EQUAL / JUMP IF NOT ABOVE) − Used to jump if below/equal/ not above
instruction satisfies.
19
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
JC (JUMP IF CARRY) − Used to jump if carry flag CF = 1
JG/JNLE (JUMP IF GREATER / JUMP IF NOT LESS THAN OR EQUAL) − Used to jump if greater/not less
than/equal instruction satisfies.
JGE/JNL (JUMP IF GREATER THAN OR EQUAL / JUMP IF NOT LESS THAN) − Used to jump if greater
than/equal/not less than instruction satisfies.
JL/JNGE (JUMP IF LESS THAN / JUMP IF NOT GREATER THAN OR EQUAL) − Used to jump if less than/not
greater than/equal instruction satisfies.
JLE/JNG (JUMP IF LESS THAN OR EQUAL / JUMP IF NOT GREATER) − Used to jump if less than/equal/if not
greater than instruction satisfies.
JNE/JNZ (JUMP NOT EQUAL / JUMP IF NOT ZERO) − Used to jump if not equal/zero flag ZF = 0
JNP/JPO (JUMP IF NO PARITY / JUMP IF PARITY ODD) − Used to jump if not parity/parity odd PF = 0
JP/JPE (JUMP IF PARITY / JUMP IF PARITY EVEN) − Used to jump if parity/parity even PF = 1
These instructions are used to control the processor action by setting/resetting the flag values.
20
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
STI − Used to set the interrupt enable flag to 1, i.e., enable INTR input.
CLI − Used to clear the interrupt enable flag to 0, i.e., disable INTR input.
These instructions are used to execute the given instructions for number of times.
LOOP − Used to loop a group of instructions until the condition satisfies, i.e., CX = 0
The Machine control Instructions control the bus usage and execution.
NOP - No operation
ASSEMBLER DIRECTIVES
Assembler directives help the assembler to correctly understand the assembly language programs
to prepare the codes. Another type of hint which helps the assembler to assign a particular constant with a
label or initialize particular memory locations or labels with constants is called an operator. Rather, the
operators perform the arithmetic and logical tasks unlike directives that just direct the assembler to correctly
interpret the program to code it appropriately. The following directives are commonly used in the assembly
language programming practice using Microsoft Macro Assembler (MASM) or Turbo Assembler (TASM).
21
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
DB: Define Byte
The DB directive is used to reserve byte or bytes of memorylocations in the available memory.
This statement directs the assembler to reserve four memory locations for a list named LIST andinitialize
them with the above specified four values.
It makes the assembler reserve the number of memory words (16-bit) instead of bytes. Some
examples are given to explain this directive.
This directive is used to direct the assembler to reset 4words (8 bytes) of memory for the
specified variable and may initialize it with the specified values.
The DT directive directs the assembler to define the specified variable requiring l -bytes for its storage
and initialize the 10bytes with the specified values.
The ASSUME directive is used to inform the assembler, the names of the logical segments to be
assumed for different segments used in the program. In the assembly language program, each segment is
given a name.
For example, the code segment may be given the name CODE, data segment may be given the
name DATA etc.
ASSUME CS:
CODE directs the assembler that the machine codes are available in a segment named CODE,
and hence the CS register is to be loaded with the Address(segment) allotted by the operating system for the
label CODE, while loading.
22
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
ASSUME DS:
DATA indicates to the assembler that the data items related to the program, are available in a
logical segment named DATA, and the DS register is to be initialized by the segment Address value decided by
the operating system for the data segment, while loading.
PROCEDURE STAR
.
.
STAR ENDP
23
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
ENDS: END of Segment
This directive marks the end of a logical segment.
DATA SEGMENT
.
.
.
DATA ENDS
ASSUME CS: CODE, DS:DATA CODE SEGMENT.
.
.
.C
O
D
E
E
N
D
S
E
N
D
The above structure represents a simple program containing two segments named DATA and
CODE. The data related to the program must lie between the DATA SEGMENT and DATA ENDS statements.
Similarly, all the executable instructions must lie between CODE SEGMENT and CODE ENDS statements.
The EVEN directive updates the location counter to the next even Address if the current location
counter contents are not even, and assigns the following routine or variable or constant to that Address.
24
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
EQU: Equate
The directive EQU is used to assign a label with a value or a symbol. Theuse of this directive is just to reduce
the recurrence of the numerical values or constants in a program code.
Example
LABEL
EQU
0500H
ADDITI
ON EQU
ADD
The first statement assigns the constant 500H with the label LABEL, while the second statement
assigns another label ADDITION with mnemonic ADD.
The directive EXTRN informs the assembler that the names, procedures and labels declared after
this directive have already been defined in some other assembly language modules.
The directive is used to form logical groups of segments with similar purpose or type. This
directive is used to inform the assembler to form a logical group of the following segment names.
The above statement directs the loader/linker to prepare an EXE file such that CODE, DATA and
STACK segment must lie within a 64kbyte memory segment that is named as PROGRAM. Now, for the
ASSUME statement, one can use the label PROGRAM rather than CODE, DATA and STACK as shown.
The Label directive is used to assign a name to the current content of the location counter. At the
start of the assembly process, the assembler initializes a location counter to keep track of memory locations
assigned to the program.
25
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
LENGTH: Byte Length of a Label
This directive is not available in MASM. This is used to refer to the length of a data array or a string.
LOCAL:
The labels, variables, constants or procedures declared LOCAL in a module are to be used only by that
module.
The NAME directive is used to assign a name to an assembly language program module. The
module may now be referred to by its declared name.
When the assembler comes across the OFFSET operator along with a label, it first computes the
16-bit displacement (also called as offset interchangeably) of the particular label, and replaces the string
'OFFSET LABEL' by the computed displacement.
ORG: Origin
The ORG directive directs the assembler to start the memory allotment for the particular segment,
block or code from the declared Addressing. The ORG statement while starting the assembly process for a
module, the assembler initializes a location counter to keep track of the allotted addresses for the module. If
the ORG statement is not written in the program, the location counter is initialized to 0000. If an ORG 200H
statement is present at the starting of the code segment of that module, then the code will start from 200H
Addressing code segment.
PROC: Procedure
The PROC directive marks the start of a named procedure in the statement
26
UNIT-1 THE 8086 MICROPROCESSOR ECE DEPARTMENT
PTR: Pointer
The pointer operator is used to declare the type of a label, variable or memory operand. The operator
PTR is prefixed by either BYTE or WORD. If the prefix is BYTE, then the particular label, variable or memory
operand is treated as an 8-bit quantity while if WORD is the prefix, then it is treated as a 16- bit quantity.
Example:
The SEG operator is used to decide the segment Address of the label, variable, or procedure
and substitutes the segment base Address in place of ‘SEG label’. The example given below explains the use
of SEG operator.
Example
MOV AX, SEG ARRAY; This statement moves the segment address
The SEGMENT directive marks the starting of a logical segment. The started segment is also
assigned a name, i.e. label, by this statement. The SEGMENT and ENDS directive must bracket each logical
segment of a program.
TYPE:
The TYPE operator directs the assembler to decide the data type of the specified label and replaces
the 'TYPE label' by the decided data type. For the word type variable, the data type is 2, for double word
type, it is 4, and for byte type, it is 1.
GLOBAL:
The labels, variables, constants or procedures declared GLOBAL may be used by other modules of
the program. Once a variable is declared GLOBAL, it can be used by any module in the program. The following
statement declares the procedure ROUTINE as a global label.
27