Page 1
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 1
MICRO PROCESSOR & INTERFACING LAB MANUAL
DEPARTMENT OF ELECTRONICS & COMMUNICATION
ENGINEERING
III B.Tech II Semester
(FOR ECE)
V.K.R., V.N.B. & A.G.K. COLLEGE OF ENGINEERING Gudivada-521301, Ph-08674-242189
www.gudivadaenggcollege.co.in
Page 2
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 2
1. Students are required to attend all labs. 2. Students will work in a group of two in hardware laboratories and
individually in computer laboratories.
3. While coming to the lab bring the lab manual cum observation book, record etc.
4. Take only the lab manual, calculator (if needed) and a pen or pencil to the
work area.
5. Before coming to the lab, prepare the prelab questions. Read through the lab experiment to familiarize yourself with the components and assembly sequence.
6. Utilize 3 hours time properly to perform the experiment and noting down
the readings. Do the calculations, draw the graph and take signature from the instructor.
7. If the experiment is not completed in the prescribed time, the pending work
has to be done in the leisure hour or extended hours.
8. You will be expected to submit the completed record book according to the
deadlines set up by your instructor.
9. For practical subjects there shall be a continuous evaluation during the semester for 25 sessional marks and 50 end examination marks.
10. Of the 25 marks for internal, 15 marks shall be awarded for day-to-day work and 10 marks to be awarded by conducting an internal laboratory test.
INSTRUCTIONS TO THE STUDENTS
Page 3
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 3
S.No CONTENTS Page No
1 OVERVIEW OF THE 80X86 FAMILY 6-8
2 INTRODUCTION TO TASM 9-10
3 PROCEDURE TO ENTER A PROGRAM USING TASM
SOFTWARE:
11-13
4 EXAMPLE FOR ASSEMBLE LANGUAGE PROGRAM 14
5 EXECUTION OF PROGRAM THROUGH TRAINER
KIT
15
6 TRAINER KIT PROGRAMMES
1. ADDITION OF „N‟ 8 BIT NUMBERS 16-17
2. MULTI BYTE ADDITION 18-19
3. MULTIBYTE SUBTRACTION 20-21
4. MULTIPLICATION OF 16 BIT NUMBER 22-23
5. DIVISION OF 16 BIT NUMBER 24-25
6. FACTORIAL OF A GIVEN NUMBER 26-27
7 TASM PROGRAMMES
1. MULTI BYTE ADDITION 28-30
2. MULTI BYTE SUBTRACTION 31-33
3. „8‟ BIT MULTIPLICATION (UNSIGNED) 34-35
4. 8-BIT MULTIPLICATION (SIGNED) 36-37
5.„16‟ BIT MULTIPLICATION (UNSIGNED) 38-40
6. „8‟ BIT DIVISION (UNSIGNED) 41-42
7. 8-BIT DIVISION (SIGNED) 43-44
8. „16‟ BIT DIVISION (UNSIGNED) 45-46
9. LARGEST OF A GIVEN NUMBER 47-48
10. ASCII ADDITION 49-50
11. ASCII SUBTRACTION 51-53
8 LOGIC OPERATIONS
1. CHECK WHETHER A GIVEN 16-BIT NUMBER IS
EVEN OR ODD
54-55
2. CHECK WHETHER A GIVEN 16-BIT NUMBER IS
POSITIVE OR NEGATIVE
56-57
Page 4
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 4
3. SORTING (ASCENDING) 58-60
4. SORTING (DESCENDING) 61-63
5. PACKED TO UNPACKED BCD 64-66
6. BCD to ASCII CONVERSION 67-68
9 STRING OPERATIONS
1. LENGTH OF THE STRING 69-71
2. BLOCK TRANSFER 72-74
3. STRING COMPARISION 75-77
4. STRING REVERSAL 78-80
5. STRING INSERTION 81-84
6. STRING DELETION 85-87
7. READING KEYBOARD WITH ECHO 88-89
8. READING KEYBOARD WITHOUT ECHO 90-91
9. DISPLAYING A CHARACTER 92-93
10. DISPLAYING A STRING 94-95
INTERFACING
1. 8255 – PPI INTERFACING -1 97-99
2. 8279 – KEYBOARD/DISPLAY INTERFACING 100-102
3. 8259 – PROGRAMMABLE INTERUPT CONTROLLER 103-104
4. 8251 – USART 105-106
APPENDIX
Expected Questions from Microprocessors 108-110
Key to the Questions on Microprocessors 111-113
Page 5
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 5
Page 6
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 6
1.OVERVIEW OF THE 80X86 FAMILY
The 80x86 family was first started in 1981 with the 8086 and the newest member
is the Pentium which was released thirteen years later in 1994. They are all backwards
compatible with each other but each new generation has added features and more speed
than the previous chip. Today there are very few computers in use that have the 8088 and
8086 chips in them as they are very outdated and slow. The number of 286 or 386 based
computers around is declining as today's software becomes more and more demanding.
Even 486's are being replaced by Pentiums. With the Pentium PRO and the MMX based
CPUs Intel keeps increasing performance and features. As computers are used to
manipulate various types of data, there has to be some physical places where these data
can be stored. Some of these places are the registers.
REGISTERS
Registers are places in the CPU where a number can be stored and manipulated. There
are three sizes of registers: 8-bit, 16-bit and on 386 and above 32-bit. There are four
different types of registers:
- General Purpose Registers,
- Segment Registers,
- Index Registers,
- Stack Registers.
GENERAL PURPOSE REGISTERS
First, we are going to describe the main registers. Later, we are going to describe the
stack registers. The main registers are 16-bit registers. There are four general purpose
registers: AX, BX, CX and DX. They are split up into 8-bit registers. AX is split up into
AH which contains the high byte and AL which contains the low byte. On 386's and
above there are also 32-bit registers, these have the same names as the 16-bit registers but
with an 'E' in front i.e. EAX. You can use AL, AH, AX and EAX separately and treat
them as separate registers for some tasks.
SEGMENT REGISTERS
Code segment register – CS- Stores the base address of Code segment
Stack segment register -SS- Stores the Base address of stack
Data segment register-DS- Stores the Base address of data
Extra segment register-ES- Stores the Base address of the extra segment
Page 7
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 7
INDEX REGISTERS
These registers are sometimes called pointer registers. They are 16-bit registers and are
mainly used for string instructions. There are three index registers SI (source index), DI
(destination index) and IP (instruction pointer). On 386's and above there are also 32-bit
index registers: EDI and ESI. You can also use BX to index strings.
STACK REGISTERS
BP and SP are stack registers and are used when dealing with the stack. We will discuss
about them when we will talk about the stack.
The designers of the 8088 decided that the maximum need for memory space will
be one megabyte. So, the chip they build cannot go above that. The problem is to access a
whole megabyte 20 bits are needed. But registers only have 16 bits so 4 more bites are
needed. They came up with what they thought was a clever way to solve this problem:
segments and offsets. This is a another way to do the addressing with two registers but
not using 32 bits. To compute every single address the segment addresses as well as the
offset are needed. A segment is usually 64kBytes long. To address a location inside a
segment, we need the offset (16 bytes long).
THE STACK
As the number of registers used is low, how do they manage to manipulate the data?
There is something called a stack which is an area of memory which you can save and
restore values to. To physically imagine this we can consider a stack of plates. The last
one you put on is the first one that you take off. This is sometimes referred to as Last On
First Off (LOFO) or Last In First Out (LIFO). But, you have to be sure that you do not
put to much data in the stack.
NUMBERS IN BINARY
Before we begin to understand how to program in assembly it is best to try to remember
how numbers are represented in computers. Numbers are stored in binary, base two.
There are several terms which are used to describe different size numbers:
1 BIT: 0 (can have the values 1 or 0)
One bit is the simplest piece of information that exists. Its either a one or a zero.
1 NIBBLE: 0000 (4 BITS)
Page 8
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 8
The nibble is four bits or half a byte. It has a maximum value of 15 (1111 = 15). This is
the basis for the hexadecimal (base 16) number system which is used as it is far easier to
understand. Hexadecimal numbers that begin with a letter are prefixed with a 0 (zero).
1 BYTE: 00000000 (equivalent with 2 NIBBLES or 8 BITS)
A byte is 8 bits or 2 nibbles. A byte has a maximum value of FFh (255 decimal).
A WORD is a 2 byte data. The maximum value that can be represented using a word is
65535. It is the obvious that if bigger number has to be represented, the necessary number
of bites will increase.
TABLE 1: A Byte Diagram
1 (MSD) 1 0 0 1 0 1 1 (LSD)
Above, MSD means Most Significant Digit and LSD means Least Significant Digit. A
word will be represented as below:
TABLE 2: A Word Diagram
Most Significant Byte Least Significant Byte
In memory, bytes are stored one after another. Each one has an associated address. Often
data needs more than one byte (every number greater then 256). Then we are going to use
a word to represent this number. In 8086 programming, the Most Significant Byte is
stored at higher address then LSB.
Page 9
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 9
2. INTRODUCTION TO TASM
INTRODUCTION:
The aim of this experiment is to introduce the student to assembly language
programming and the use of the tools that he will need throughout the lab experiments. This first
experiment let the student use the Dos Debugger and the Turbo Assembler (TASM). Editing,
Assembling, Linking, Execute up can be done using TASM software
OBJECTIVES:
1. Introduction to Turbo Assembler (TASM)
2. General structure of an assembly language program
3. Use of the Dos Debugger program
OVERVIEW: In general, programming of microprocessor usually takes several iterations
before the right sequence of machine code instruction is written. The process, however is
facilitated using a special program called an “Assembler”. The Assembler allows the user to write
alphanumeric instructions. The Assembler, in turn, generates the desired machine instructions
from the assembly language instructions.
Assembly language programming consists of following steps:
STEP PRODUCES
1 Editing Source file
2 Assembling Object file
3 Linking Executable file
4 Executing Results
Table1.1: Assembly Language Programming Phases
ASSEMBLER:
The assembler is used to convert the assembly language instructions to machine
code. It is used immediately after writing the Assembly language program. The assembler starts
by checking the syntax or validity of the structure of each instruction in the source file .if any
errors are found, the assemblers displays a report on these errors along with brief explanation of
their nature. However if the program does contain any errors, the assembler produces an object
file that has the same name as the original file but with the “obj” extension
Page 10
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 10
LINKER: The Linker is used convert the object file to an executable file. A linker is a
program used to join several object files in to one large object file and convert to an executable
file. The linker produces a link file which contains the binary codes for all the combined
modules. The linker however doesn‟t assign absolute address to the program it assigns is said to
be relocatable because it can be put any where in memory to be run.
EXECUTING THE PROGRAM:
The executable contains the machine language code .it can be loaded in the RAM
and executed by the microprocessor simply by typing ,from the DOS prompt ,the name of the file
followed by the carriage Return Key (Enter Key). If the program produces an output on the
screen or sequence of control signals to control a piece of hard ware, the effect should be noticed
almost immediately. However, if the program manipulates data in memory, nothing would seem
to have happened as a result of executing the program.
DEBUGGER:
The debugger can also be used to find logical errors in the program. Even if a
program does not contain syntax errors it may not produce the desired results after execution.
Logical errors may be found by tracing the action of the program. Once found, the source file
should be rewrite to fix the problem, then the re-assembled and re-linked. A special program
called the debugger is designed for that purpose.
The debugger allows the user to trace the action of the program, by single
stepping through the program or executing the program up to a desired point, called break point.
It also allows the user to inspect or change the contents of the microprocessor internal registers or
the contents of any memory location.
Page 11
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 11
3. PROCEDURE TO ENTER A PROGRAM USING TASM
SOFTWARE:
Start
↓
Run
↓
Type CMD
↓
Ok
Display shows
↓
C :\> D:
(Change to D drive because MASM is in D drive)
↓
Press ENTER
↓
D :\> CD TASM
↓
Press ENTER
↓
D: \TASM> EDIT
↓
Press ENTER
↓
Then the display shows the main menu.
↓
Page 12
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 12
Create A file name with .asm extension
Ex: Filename.asm
↓
Write the program in assemble language then Save and Quit
It returns to DOS Prompt
↓
Use the following Commands
↓
D: \TASM> tasm filename.asm
It is for viewing errors and warnings report exist in the asm file(refer Assembler)
↓
D: \TASM> tlink filename.obj
The assembler produces an object file that has the same name as the original file but with the
“obj” extension
↓
Page 13
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 13
D: \TASM> td filename.exe
It is for viewing the output window
↓
Click Run and Click View
It shows the output for Corresponding Inputs
Page 14
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 14
4. EXAMPLE FOR ASSEMBLE LANGUAGE
PROGRAM
The assembly language program can be divided in to two parts
1. Data Segment
2. Code Segment
In the data segment all the input, output and count (for loop programs) have to
specify. This section starts with Data Segment and ends with Data Ends
Example:
DATA SEGMENT
NUM1 DB 04H
NUM2 DB 02H
RESULT DB 00
RESULT1 DB 00
DATA ENDS
In the code segment remaining the entire program with specified instructions are
present
Example:
CODE SEGMENT
START:
MOV AX, DATA
MOV DS, AX
MOV AL, NUM1
MOV BL, NUM2
MUL BL
MOV RESULT, AL
MOV RESULT1, AH
INT 3
CODE ENDS
Page 15
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 15
5. EXECUTION OF PROGRAM THROUGH
TRAINER KIT
Procedure For Executing Assembly Language Programs In 8086 By Using 8086
Trainer Kit:
Procedure:
Step1: After entering the data in to memory locations by using the known procedure then
the display shows – [blinking cursor]
Step2: Type G starting address
Ex: G 2000
Step3: Then [press] enter
Step4: Then the display shows registers with results
Step5: To see results locations, press D 4000 [4000 is the address of the memory location
where the result is stored „D‟ is the command for displaying the data in memory
locations]
Step6: Then press enter.
Step7: Then the display shows the data in 4000 location.
Step8: If we want to substitute Different inputs for the same locations, press S
3000 [3000 is the address of the memory location where the input data is stored
„S‟ is the command for substituting the data in memory locations]
Page 16
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 16
6. TRAINER KIT PROGRAMMES
ARITHMETIC OPERATIONS
1. ADDITION OF „N‟ 8 BIT NUMBERS
AIM: To write a program to add „N‟ 8 bit numbers.
APPARATUS: 8086 microprocessor trainer kit, power supply
ALGORITHM:
Step1: Initialize AX// load SI with 3000h memory location
Step2: Move the contents of SI in to the CL registers [counter]
Step3: Increment SI [first number of n number]
Step 4: Move the first number of n number in to BL
Step 5: Add AL& BL
Step6: If jump on no carry go to the step8 else step7
Step7: Increment AH
Step8: Decrement CL [count]
Step9: If jump on no zero go to the step 3
Step10: Load DI with 4000h memory location {to store the
Result}
Step11: Move the result in to DI
Step 12: End of the program
PROGRAM:
MOV AX, 0000H
MOVSI, 3000H
BACK: MOV CL, [SI]
INC SI
MOV BL, [SI]
ADD AL, BL
JNC GO
INC AH
G0: DEC CL
JNZ BACK
MOV DI, 4000H
MOV [DI], AX
Page 17
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 17
INT 03
OBSERVATIONS:
Input: Input
S3000: 03 S3002:03 S3000: S3002:
S3001: 02 S3003:04 S3001: S3003:
Output: Output
D4000:09 D4000:
RESULT: Thus the addition of n 8 bit numbers is performed and results are observed
using 8086 microprocessor trainer kit.
VIVA QUESTIONS:
1. What is Microprocessors
2. What are the functions of Accumulator?
3. MOV BL, [SI] which Addressing mode?
4. Basic Difference between 8085 and 8086
Page 18
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 18
2. MULTI BYTE ADDITION
AIM: To write a program to add two multibyte numbers.
APPARATUS: 8086 microprocessor trainer kit, power supply.
ALGORITHM:
Step1: initialize AX// load SI with 3000h memory location
Step2: load DI with 4000h memory location
Step3: load the CX register with count 03
Step4: move the first byte of first number [SI] in to AL
Step5: move the first byte of second number [DI] in to DL
Step6: add AL&DL with carry
Step7: move the contents of AL in to DI
Step8: increment SI
Step9: increment DI
Step10: move the second byte of first number [SI] in to AL
Step11: move the second byte of second number [DI] in to DL
Step12: add AL&DL with carry
Step13: move the contents of AL in to DI
Step14: decrement CX and jump to the step 8 if the CX register is
Non zero
Step15: end of the program
PROGRAM:
MOV AX, 0000H
MOV SI, 3000H
MOV DI, 4000H
MOV CX, 03
MOV AL, [SI]
MOV DL, [DI]
ADC AL, DL
MOV [DI], AL
BACK: INC SI
INC DI
MOV AL, [SI]
MOV DL, [DI]
ADC AL, DL
MOV [DI], AL
Page 19
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 19
LOOP BACK
INT 03
OBSERVATIONS:
Input:
S3000 S3001 S3002 S3003
10 20 30 40
S4000 S4001 S4002 S4003
20 30 40 50
Output:
D4000 D4001 D4002 D4003
30 50 70 90
Input:
S3000 S3001 S3002 S3003
S4000 S4001 S4002 S4003
Output:
D4000 D4001 D4002 D4003
RESULT:
Multi byte addition is performed and results are observed using TASM.
VIVA QUESTIONS
1. Why 8085 processor is called an 8-bit processor
2. What is the disadvantage of microprocessor?
3. What is the difference between ADD & ADC
4. What is the purpose served by CX register?
Page 20
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 20
3. MULTIBYTE SUBTRACTION
AIM: To write a program to subtract multibyte numbers
APPARATUS: 8086 microprocessor trainer kit, power supply
ALGORITHM:
Step1: initialize AX// load SI with 3000h memory location
Step2: load DI with 4000h memory location
Step3: load the CX register with count 03
Step4: move the first byte of first number [SI] in to AL
Step5: move the first byte of second number [DI] in to DL
Step6: subtract AL from DL with borrow
Step7: move the contents of AL in to DI
Step8: increment SI
Step9: increment DI
Step10: move the second byte of first number [SI] in to AL
Step11: move the second byte of second number [DI] in to DL
Step12: subtract AL from DL with borrow
Step13: move the contents of AL in to DI
Step14: decrement CX and jump to the step 8 if the CX register is
Non zero
Step15: end of the program
PROGRAM:
MOV AX, 0000H
MOV SI, 3000H
MOV DI, 4000H
MOV CX, 03
MOV AL, [SI]
MOV DL, [DI]
SBB AL, DL
MOV [DI], AL
BACK: INC SI
INC DI
MOV AL, [SI]
MOV DL, [DI]
SBB AL, DL
MOV [DI], AL
Page 21
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 21
LOOP BACK
INT 03
OBSERVATIONS:
Input:
S3000 S3001 S3002 S3003
50 80 50 40
S4000 S4001 S4002 S4003
20 30 40 20
Output:
D4000 D4001 D4002 D4003
30 50 10 20
Input:
S3000 S3001 S3002 S3003
S4000 S4001 S4002 S4003
Output:
D4000 D4001 D4002 D4003
RESULT:
Thus multibyte subtraction is performed and results are observed using 8086
microprocessor kit
Page 22
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 22
4. MULTIPLICATION OF 16 BIT NUMBER
AIM: To write a program to multiply two 16 bit numbers
APPARATUS: 8086 trainer kit, power supply
ALGORITHM:
Step1: initialize AX, DX load SI with 3000h memory location
Step2: move the contents [SI] in to AX
Step3: increment SI
Step4: increment SI
Step5: move the contents [SI] in to BX
Step6: multiply the contents of BX with AX
Step7: move the contents of AX to the 4000h memory location
Step8: move the contents of DX to the 5000h memory location
Step9: end of the program
PROGRAM:
MOV AX, 0000
MOV DX, 0000
MOV SI, 3000
MOV AX, [SI]
INC SI
INC SI
MOV BX, [SI]
MUL BX
MOV @4000, AX
MOV @5000, DX
INT 03
OBSERVATIONS:
Input: Input:
S3000 S3001 S3002 S3003 S3000 S3001 S3002 S3003
02 01 02 01
Output: Output:
D4000 D4001 D5000 D5001 D4000 D4001 D5000 D5001
04 04 01 00
Page 23
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 23
RESULT:
Thus multiplication of a 16 bit numbers is performed and results are observed
using 8086 microprocessor kit
Page 24
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 24
5. DIVISION OF 16 BIT NUMBER
AIM: To write a program to perform division of two 16 bit numbers
APPARATUS: 8086 trainer kit, power supply
ALGORITHM:
Step1: initialize AX, DX load SI with 3000h memory location
Step2: move the contents [SI] in to AX
Step3: increment SI
Step4: increment SI
Step5: move the contents [SI] in to BX
Step6: divide the contents of BX with AX
Step7: move the contents of AX to the 4000h memory location
Step8: move the contents of DX to the 5000h memory location
Step9: end of the program
PROGRAM:
MOV AX, 0000
MOV DX, 0000
MOV SI, 3000
MOV AX, [SI]
INC SI
INC SI
MOV BX, [SI]
DIV BX
MOV @4000, AX
MOV @5000, DX
INT 03
OBSERVATIONS:
Input: Input:
S3000 S3001 S3002 S3003 S3000 S3001 S3002 S3003
04 00 02 00
Output: Output:
D4000 D4001 D5000 D5001 D4000 D4001 D5000 D5001
02 00 00 00
Page 25
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 25
RESULT:
Thus division of a two 16 bit numbers is performed and results are observed using
8086 microprocessor kit
Page 26
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 26
6. FACTORIAL OF A GIVEN NUMBER
AIM: To write a program to find factorial of a given number
APPARATUS: 8086 trainer kit, power supply
ALGORITHM:
Step1: initialize ax, bx.
Step2: load SI with 3000h memory location
Step3: move the contents [SI] in to AL
Step4: move the contents of AX in to BX
Step5: decrement BX
Step6: multiply the contents of BX with AX
Step7: decrement BX and jump to the step 6 if the BX register is
Non zero
Step8: move the contents of AX to the 4000h memory location
Step9: end of the program
PROGRAM:
MOV AX, 0000H
MOV BX, 0000H
MOV SI, 3000H
MOV AX, [SI]
MOV BX, AX
DEC BX
BACK: MUL BX
DEC BX
JNZ BACK
MOV @4000, AX
INT 03
OBSERVATIONS:
Input: Input:
S3000: 05 S3000:
Output: Output:
D4000: 78 D4000:
Page 27
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 27
RESULT:
Thus factorial of a given number is performed and results are observed using
8086 microprocessor kit.
Page 28
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 28
7. TASM PROGRAMMES
ARITHMETIC OPERATION
1. MULTI BYTE ADDITION
AIM: To write a program to add two multi byte numbers.
APPARATUS: Computer system installed with TASM.
ALGORITHM:
Step1: initialize the data segment.
Step2: load cx with counter
Step3: load the si first number
Step4: load the first byte of num1 (si) into al
Step5: add the first byte of num1 (si) and first byte of num2 (si) with carry
Step6: move the result into num3 (si)
Step7: decrement si
Step8: decrement count
Step9: jump if not zero to step4
Step10: end of the program
PROGRAM:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
NUM1 DB 11H,22H,33H,44H,55H,66H,77H,88H
NUM2 DB 11H,22H,33H,44H,55H,66H,77H,88H
NUM3 DB ?
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
CLC
MOV CL, 08
MOV SI, 0007
BACK: MOV AL, NUM1 [SI]
ADC AL, NUM2 [SI]
MOV NUM3 [SI], AL
Page 29
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 29
DEC SI
DEC CL
JNZ BACK
INT 3
CODE ENDS
END START
OBSERVATION: (Theoretical)
INPUT: NUM1=11h,22h,33h,44h,55h,66h,77h,88h
NUM2=11h,22h,33h,44h,55h,66h,77h,88h
OUTPUT: RES=22h,44h,66h,88h,AAH,CCH,EFH,10H
MEMORY LOCATIONS:
Input: DS: 0000h:11H
0001h: 22H
0002h: 33H
0003h: 44h
0004h: 55H
0005H: 66H
0006h: 77H
0007h: 88H
0008h: 11H
0009h: 22H
000Ah:33H
000Bh:44H
000Ch:55H
000DH:66H
000Eh:77H
000Fh:88H
OUTPUT: DS: 0010h: 22H
0011h: 44H
0012h: 66H
0013h: 88H
0014h: AAH
0015H: CCH
0016h: EFH
0017h: 10H
OBSERVATION: (practical):
INPUT: NUM1=
NUM2=
OUTPUT: RES=
Memory Locations:
Input: ds: 0000h: 0001h:
Page 30
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 30
0002h:
0003h:
0004h:
0005H:
0006h:
0007h:
0008h:
0009h:
000Ah:
000Bh:
000Ch:
000DH:
000Eh:
000Fh:
OUTPUT :DS:0010h:
0011h:
0012h:
0013h:
0014h:
0015H:
0016h:
0017H:
Page 31
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 31
2. MULTI BYTE SUBTRACTION
AIM: To write a program to subtract two multi byte numbers.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Load CX with counter
STEP3: Load the SI first number
STEP4: Load the first byte of num1(SI) into AL
STEP5: subtract the first byte of num1(SI) and first byte of num2(SI)
With borrow
STEP6: move the result into num3(SI)
STEP7: Decrement SI
STEP8: Decrement count
STEP9: Jump if not zero to step4
STEP10: End of the program
PROGRAM:
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
NUM1 DB 88H,77H,66H,55H,44H,33H,22H,11H
NUM2 DB 11H,22H,33H,44H,11H,22H,11H,11H
NUM3 DB ?
DATA ENDS
CODE SEGMENT
START: MOV AX,DATA
MOV DS,AX
CLC
MOV CL,08
MOV SI,0007
BACK: MOV AL,NUM1[SI]
SBB AL,NUM2[SI]
MOV NUM3[SI],AL
DEC SI
DEC CL
Page 32
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 32
JNZ BACK
INT 3
CODE ENDS
END START
OBSERVATION: (Theoretical)
INPUT: NUM1=88H,77H,66H,55H,44H,33H,22H,11H
NUM2=11H,22H,33H,44H,11H,22H,11H,11H
OUTPUT: RES=77h,55h,33h,11h,33H,11H,11H,00H
Memory Locations:
Input: DS: 0000h:
0001h:
0002h:
0003h:
0004h:
0005:
0006h:
0007h:
0008h:
0009h:
000Ah:
000Bh:
000Ch:
000Dh:
000Eh:
000Fh:
OUTPUT:DS: 0010h:
0011h:
0012h:
0013h:
0014h:
0015h:
0016h:
0017h:
OBSERVATION: (practical):
INPUT: NUM1=
NUM2=
OUTPUT: RES=
Page 33
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 33
Memory Locations:
INPUT: DS: 0000h:
0001h:
0002h:
0003h:
0004h:
0005H:
0006h:
0007h:
0008h:
0009h:
000Ah:
000Bh:
000Ch:
000DH:
000Eh:
000Fh:
OUTPUT: DS: 0010h:
0011h:
0012h:
0013h:
0014h:
0015H:
0016h:
0017h:
RESULT:
Multi byte subtraction is performed and results are observed using TASM
EXERCISE:
1. Why is subtract with carry instruction is used in the loop?
2. What is the purpose served by BX register?
3. Why subtraction is done with AL register why not with AX?
4. What is the other instruction which can be used instead of MOV DI, offset NUM2?
Page 34
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 34
3. „8‟ BIT MULTIPLICATION (UNSIGNED)
AIM: To write a program to multiply two 8-bit unsigned numbers.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Load the AL with NUM1
STEP3: Load the BL with NUM2
STEP4: Multiply AL & BL (Unsigned)
STEP5: Store the result in AL and AH
STEP6: End of the program
PROGRAM:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
NUM1 DB 04H
NUM2 DB 02H
RESULT DB 00
RESULT1 DB 00
DATA ENDS
CODE SEGMENT
START:
MOV AX, DATA
MOV DS, AX
MOV AL, NUM1
MOV BL, NUM2
MUL BL
MOV RESULT, AL
MOV RESULT1, AH
INT 3
CODE ENDS
END START
Page 35
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 35
OBSERVATION: (theoretical)
INPUT: NUM1=04h
NUM2=02h
OUTPUT: RES=08h
RES1=00h
MEMORY LOCATIONS:
INPUT: DS: 0000h: 04H
0001h: 02h
OUTPUT: DS: 0002h: 08H
0003h: 00h
OBSERVATION:
INPUT: NUM1=
NUM2=
OUTPUT: RES=
RES1=
MEMORY LOCATIONS:
INPUT: DS: 0000h:
0001h:
OUTPUT: DS: 0002h:
0003h:
RESULT:
8-bit unsigned multiplication is performed and results are observed using TASM.
EXERCISE:
1. AL and BL are used for multiplying why not AX & BX?
2. Instead of using MOV BL is it not possible to MUL num2?
3. What is the instruction used for signed multiplication?
Page 36
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 36
4. 8-BIT MULTIPLICATION (SIGNED)
AIM: To write a program to multiply two 8-bit signed numbers.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Load the AL with NUM1
STEP3: Load the BL with NUM2
STEP4: Multiply AL & BL (signed)
STEP5: Store the result in AL and AH
STEP6: End of the program
PROGRAM:
DATA SEGMENT
NUM1 DB 0A5H
NUM2 DB 20H
RES DW ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV AX,DATA
MOV DS,AX
SUB AX,AX
MOV AL,NUM1
MOV BL,NUM2
IMUL BL
MOV RES,AX
INT 3
CODE ENDS
END START
Page 37
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 37
OBSERVATION: (theoretical)
INPUT: NUM1=A5h
NUM2=20h
OUTPUT: RES=A0 F4h
OBSERVATION: (practical):
INPUT: NUM1=
NUM2=
OUTPUT: RES=
RESULT:
8-bit signed multiplication is performed and results are observed using TASM.
VIVA QUESTIONS:
1. What is the difference between IMUL and MUL?
2. What is the use of instruction CBW?
3. What is the use of instruction CWD?
Page 38
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 38
5. „16‟ BIT MULTIPLICATION (UNSIGNED)
AIM: To write a program to multiply two 16-bit unsigned numbers.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Load the AX with NUM1
STEP3: Load the BX with NUM2
STEP4: Multiply AX & BX(Unsigned)
STEP5: Store the result in AX and DX
STEP6: End of the program
PROGRAM:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
NUM1 DW 0004H
NUM2 DW 0002H
RESULT DW 00
RESULT1 DW 00
DATA ENDS
CODE SEGMENT
START:
MOV AX,DATA
MOV DS,AX
MOV AX,NUM1
MOV BX,NUM2
MUL BX
MOV RESULT,AX
MOV RESULT1,DX
INT 3
CODE ENDS
END START
Page 39
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 39
OBSERVATION: (theoretical)
INPUT: NUM1=0004h
NUM2=0002h
OUTPUT: RES=0008h
RES1=0000h
MEMORY LOCATIONS:
INPUT: DS: 0000h:04H
0001h:00h
0002h:02H
0003h:00h
OUTPUT: DS: 0004:08h
0005:00h
0006:00h
0007:00h
OBSERVATION: (PRACTICAL):
INPUT: NUM1=
NUM2=
OUTPUT: RES=
RES1=
MEMORY LOCATIONS:
INPUT: DS: 0000h:
0001h:
0002h:
0003h:
OUTPUT: DS: 0004h:
0005h:
0006h:
0007h:
RESULT:
16-bit Multiplication is performed and results are observed using TASM.
Page 40
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 40
EXERCISE:
1. Why AL & BL are not used in this program?
2. If result exceeds 32 bit, where is it stored?
Page 41
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 41
6. „8‟ BIT DIVISION (UNSIGNED)
AIM: To write a program to perform division on two 8-bit unsigned numbers.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment and AX, BX registers
STEP2: Load the AL with NUM1(Divisor)
STEP3: Load the BL with NUM2(Dividend)
STEP4: divide AL & BL(Unsigned)
STEP5: Store the result in AL(quotient) and AH(remaider)
STEP6: End of the program
PROGRAM:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
NUM1 DB 04H
NUM2 DB 02H
QUOTIENT DB ?
REMAINDER DB ?
DATA ENDS
CODE SEGMENT
START:
MOV AX,DATA
MOV DS,AX
MOV AX,0000h
MOV DX,0000h
MOV AL,NUM1
MOV BL,NUM2
DIV BL
MOV QUOTIENT,AL
MOV REMAINDER,AH
INT 3
CODE ENDS
END START
Page 42
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 42
OBSERVATION: (THEORETICAL)
INPUT: NUM1=04h
NUM2=02h
OUTPUT: QUEO=02h
REM=00h
MEMORY LOCATIONS:
INPUT: DS: 0000h: 04H
0001h: 02h
OUTPUT: DS: 0002:02h
0003:00h
OBSERVATION: (PRACTICAL):
INPUT: NUM1=
NUM2=
OUTPUT: RES=
RES1=
MEMORY LOCATIONS:
INPUT: DS: 0000h:
0001h:
OUTPUT: DS: 0002:
0003:
RESULT:
Division of two 8-bit numbers is performed and results are observed using
TASM.
EXERCISE:
1. Why is the registers DX & AX made zero in the above program?
2. Where is the remainder in 8 bit division?
3. Where is the quotient in 8 bit division?
4. Which interrupt is used when a divide overflow error occurs?
Page 43
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 43
7. 8-BIT DIVISION (SIGNED)
AIM: To write a program to perform division on two 8-bit signed numbers.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment and AX, BX registers
STEP2: Load the AL with NUM1(Divisor)
STEP3: Load the BL with NUM2(Dividend)
STEP4: divide AL & BL(signed)
STEP5: Store the result in AL(quotient) and AH(remainder)
STEP6: End of the program
PROGRAM:
DATA SEGMENT
NUM1 DB 0D5H
NUM2 DB 20H
QUO DB ?
REM DB ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV AX,DATA
MOV DS,AX
XOR AX,AX
MOV AL,NUM1
MOV BL,NUM2
IDIV BL
MOV QUO,AL
MOV REM,AH
INT 3
CODE ENDS
END START
OBSERVATION: (THEORETICAL)
Page 44
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 44
INPUT: NUM1=D5h
NUM2=20h
OUTPUT: QEO= FFh
REM= F5h
OBSERVATION: (PRACTICAL):
INPUT: NUM1=
NUM2=
OUTPUT: QEO=
REM=
RESULT:
8-bit signed division is performed and results are observed using TASM.
EXERCISE:
1. What is the purpose of XOR AX,AX?
2. What is the difference between IDIV and DIV?
3. What is the use of instruction CBW & CWD?
Page 45
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 45
8. „16‟ BIT DIVISION (UNSIGNED)
AIM: To write a program to perform division on two 16-bit unsigned numbers.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment and AX, DX registers
STEP2: Load the AX with NUM1(Divisor)
STEP3: Load the BX with NUM2(Dividend)
STEP4: divide AX & BX(Unsigned)
STEP5: Store the result in AX(quotient) and DX(remainder)
STEP6: End of the program
PROGRAM:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
NUM1 DW 0004H
NUM2 DW 0002H
QUOTIENT DW ?
REMAINDER DW ?
DATA ENDS
CODE SEGMENT
START:
MOV AX,DATA
MOV DS,AX
MOV AX,0000
MOV DX,0000
MOV AX,NUM1
MOV BX,NUM2
DIV BX
MOV QUOTIENT,AX
MOV REMAINDER,DX
INT 3
CODE ENDS
END START
Page 46
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 46
OBSERVATION: (theoretical)
INPUT: NUM1=0004h
NUM2=0002h
OUTPUT: QUEO=0002h
REMA=0000h
OBSERVATION: (practical):
INPUT: NUM1=
NUM2=
OUTPUT: RES=
RES1=
RESULT:
16-bit division is performed and results are observed using TASM.
EXERCISE:
1. What happens if DX register contains a nonzero value before DIV instruction?
2. What is the instruction used for signed division?
3. In the above program instead of DIV BX is it possible to use DIV num2?
Page 47
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 47
9. LARGEST OF A GIVEN NUMBER
AIM: To write a program to find largest number from a given unordered array of 16 bit
numbers.
APPARATUS: 8086 trainer kit, power supply
ALGORITHM:
Step1: initialize ax// load si with 3000h memory location
step2: load the cx register with count 03
step3: move the contents [si] in to al
step3: compare the contents of [si] with al
step4: jump if not less to the step6
step5: move the contents [si] in to al
step6: increment si
step7: increment si
step8: decrement cl
step9: jump on non zero to the step3
step10: move the contents of ax to the 4000h memory location
step11: end of the program
PROGRAM:
Assume cs:code, ds:data
Data segment
Count db 01h,03h,02h,04h
Data ends
Code segment
Start: Mov ax,data
Mov ds,ax
Mov ax,0000h
Mov si,0000h
Mov cl,04h
Mov al,num1[si]
Back: Inc si
Cmp al,[si]
Jnl next
Mov ax,[si]
Next: Dec cl
Jnz back
Page 48
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 48
Mov num1[si],al
Int 03
Code ends
End start
OBSERVATIONS:
Input: Input:
Output: Output:
RESULT:
Thus largest number from given numbers are found and results are observed using
trainer kit.
Page 49
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 49
10. ASCII ADDITION
AIM: To write a program to perform ASCII addition.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Load the DL with the NUM1
STEP3: Load the DH with NUM2
STEP4: ANDed DL & DH with 0FH
STEP5:Move the DX into AX
STEP6:Add the AH & AL
STEP7:Ascii Adjust After ADDITION
STEP8:ORed AL,AH with 30H and store the result
STEP9: End of the program
PROGRAM:
ASSUME CS: CODE,DS:DATA
DATA SEGMENT
NUM1 DB 36H
NUM2 DB 32H
RES DW 00H
DATA ENDS
CODE SEGMENT
START:
MOV AX,DATA
MOV DS,AX
XOR AX,AX
MOV DL,NUM1
MOV DH,NUM2
AND DL,0FH
AND DH,0FH
MOV AX,DX
ADD AL,AH
MOV AH,00
AAA
Page 50
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 50
OR AL,30H
OR AH,30H
MOV RES,AX
INT 03H
CODE ENDS
END START
OBSERVATIONS:(Theoretical)
INPUT: NUM1=36H
NUM2=32H
OUTPUT: RES=38H 30H
OBSERVATION: (practical)
INPUT: NUM1=
NUM2=
OUTPUT: RES=
RESULT:
ASCII addition is performed and results are observed using TASM.
EXERCISE:
1. What is the purpose of ASCII addition?
2. What is the instruction used for ASCII addition?
3. Why do we make use of instruction ORL AX, 3030H ?
4. Why is AAA after addition?
Page 51
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 51
11. ASCII SUBTRACTION
AIM: To write a program to perform ASCII subtraction.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Load the DL with the NUM1
STEP3: Load the DH with NUM2
STEP4: ANDed DL & DH with 0FH
STEP5:Move the DX into AX
STEP6:Subtract the AH & AL
STEP7:Ascii Adjust After subtraction
STEP8:ORed AL,AH with 30H and store the result
STEP9: End of the program
PROGRAM:
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
NUM1 DB 36H
NUM2 DB 32H
RES DW 00H
DATA ENDS
CODE SEGMENT
START:
MOV AX,DATA
MOV DS,AX
XOR AX,AX
MOV DL,NUM1
MOV DH,NUM2
AND DL,0FH
AND DH,0FH
MOV AX,DX
SBB AL,AH
MOV AH,00
AAS
OR AL,30H
Page 52
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 52
OR AH,30H
MOV RES,AX
INT 03H
CODE ENDS
END START
OBSERVATIONS:(Theoretical)
INPUT: NUM1=36H
NUM2=32H
OUTPUT: RES=34H 30H
MEMORY LOCATIONS:
Input: ds: 0000h:36H
0001h:32H
output: ds: 0002:34H
0003:30H
OBSERVATION: (practical)
INPUT: NUM1=
NUM2=
OUTPUT: RES=
MEMORY LOCATIONS:
Input: ds: 0000h:
0001h:
output: ds: 0002h:
0003h:
RESULT:
ASCII subtraction is performed and results are observed using TASM.
Page 53
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 53
EXERCISE:
1. What is the purpose of ASCII subtraction?
2. What is the instruction used for ASCII subtraction?
3. Why do we make use of instruction ORL AX,3030H ?
4. Why is AAS after addition?
Page 54
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 54
8. LOGIC OPERATIONS
1. CHECK WHETHER A GIVEN 16-BIT NUMBER IS
EVEN OR ODD
AIM: To write a program to check whether a given 16-bit number is even or odd.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Load the AX with the NUM1
STEP3: Load the BX with 0002H(NUM2)
STEP4: Divide AX & BX
STEP5:Compare CX & DX
STEP6:Jump on even step9
STEP7:Load AX with 1111H(ODD NUMBER)
STEP8:Jump to step 10
STEP9: Load the AX with FFFFH(EVEN NUMBER)
STEP10:End of the program.
PROGRAM:
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
NUM1 DW 0008H
DATA ENDS
CODE SEGMENT
START: MOV AX,DATA
MOV DS,AX
MOV AX,NUM1
MOV BX,0002H
MOV CX,0000H
DIV BX
CMP CX,DX
JE EVEN
MOV AX,1111H
JMP NEXT
EVEN: MOV AX,FFFFH
Page 55
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 55
NEXT: INT 03H
CODE ENDS
END START
OBSERVATIONS:(Theoritical)
INPUT: NUM1=0008H
OUTPUT: AX=FFFFH
BX=0002H
OBSERVATION: (practical)
INPUT: NUM1=
OUTPUT: AX=
BX=
RESULT: Checking whether a given 16-bit number is even or odd is performed and
results are observed using Tasm.
Page 56
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 56
2. CHECK WHETHER A GIVEN 16-BIT NUMBER IS
POSITIVE OR NEGATIVE
AIM: To write a program to check whether a given 16-bit number is positive or
negative.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Load the AX with the NUM1
STEP3: Rotate the contents of AX by one through carry
STEP4:Jump on carry (negative number) go to step6
STEP5:Load the AX with FFFFH (if positive number)
STEP6:Jump to step8
STEP7:Load AX with 1111H(negative number)
STEP8:End of the program.
PROGRAM:
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
NUM1 DW 0002H
DATA ENDS
CODE SEGMENT
START:
MOV AX,DATA
MOV DS,AX
MOV AX,NUM1
ROL AX,01H
JC NEG_NUM
MOV AX,FFFFH
JMP EXIT
NEG_NUM:MOV AX,1111H
EXIT: INT 3
CODE ENDS
END START
Page 57
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 57
OBSERVATIONS:(Theoritical)
INPUT: NUM1=0008H
OUTPUT: AX=FFFFH
BX=0000H
OBSERVATION: (practical)
INPUT: NUM1=
OUTPUT: AX=
BX=
RESULT:
Checking whether a given 16-bit number is positive or negative is performed and
results are observed using TASM.
EXERCISE:
1. How can we differentiate between a positive number and a negative number?
Page 58
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 58
3. SORTING (ASCENDING)
AIM: To write a program to sort a given list of numbers in ascending order.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Initialize the count in DX Register
STEP3: Load DX with count
STEP4: move DX into the CX Register
STEP5: Load the SI with first byte of List
STEP6:Move the content of SI into AX register
STEP7:Compare AXwith second byte of SI
STEP8: Jump if Less to the step11
STEP9:Exchage AX and second byte of SI
STEP10: Exchage AX and first byte of SI
STEP11:Add SI with 02
STEP12:continue the loop until to get the result and go to the step7
STEP13:Decrement DX
STEP14:Jump if non zero to the step 4
STEP15:END of the program
PROGRAM:
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
LIST DW 53H,25H,89H,02H
COUNT EQU 04H
DATA ENDS
CODE SEGMENT
START:MOV AX,DATA
MOV DS,AX
MOV DX,COUNT
AGAIN0: MOV CX,DX
MOV SI,OFFSET LIST
AGAIN1: MOV AX,[SI]
CMP AX,[SI+02]
JL NEXT
XCHG [SI+02],AX
Page 59
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 59
XCHG [SI],AX
NEXT: ADD SI,02H
LOOP AGAIN1
DEC DX
JNZ AGAIN0
MOV AH,4CH
INT 03
CODE END
END START
OBSERVATIONS:(Theoritical)
INPUT: LIST=53H,25H,89H,02H
OUTPUT: LIST=02H,25H,53H,89H
MEMORY LOCATIONS:
OUTPUT:DS: 0000H:00h
0001H:00h
0002H:02h
0003H:00h
0004H:25h
0005H:00h
0006H:53h
0007H:00h
0008H:89h
OBSERVATIONS:(practical)
INPUT: LIST=
OUTPUT: LIST=
MEMORY LOCATIONS:
OUTPUT:DS: 0000H:
0001H:
0002H:
0003H:
0004H:
0005H:
0006H:
0007H:
0008H:
Page 60
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 60
RESULT:
Sorting of a given list of numbers is performed and results are observed using
TASM.
EXERCISE:
1. What is the sorting technique used in above program?
2. Are there any other ways to sort a list?
Page 61
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 61
4. SORTING (DESCENDING)
AIM: To write a program to sort a given list of numbers in descending order.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Initialize the count in DX Register
STEP3: Load DX with count
STEP4: move DX into the CX Register
STEP5: Load the SI with first byte of List
STEP6:Move the content of SI into AX register
STEP7:Compare AXwith second byte of SI
STEP8: Jump if Greater to the step11
STEP9:Exchage AX and second byte of SI
STEP10: Exchage AX and first byte of SI
STEP11:Add SI with 02
STEP12:continue the loop until to get the result and go to the step7
STEP13:Decrement DX
STEP14:Jump if non zero to the step 4
STEP15:END of the program
PROGRAM:
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
LIST DW 53H,25H,89H,02H
COUNT EQU 04H
DATA ENDS
CODE SEGMENT
START: MOV AX,DATA
MOV DS,AX
MOV DX,COUNT
AGAIN0: MOV CX,DX
MOV SI,OFFSET LIST
AGAIN1: MOV AX,[SI]
CMP AX,[SI+02]
JG NEXT
Page 62
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 62
XCHG [SI+02],AX
XCHG [SI],AX
NEXT:ADD SI,02H
LOOP AGAIN1
DEC DX
JNZ AGAIN0
MOV AH,4CH
INT 03
CODE END
END START
OBSERVATIONS:(Theoritical)
INPUT: LIST=53H,25H,89H,02H
OUTPUT: LIST=89H,53H,25H,02H
MEMORY LOCATIONS:
OUTPUT:DS: 0000H:00h
0001H:00h
0002H:89h
0003H:00h
0004H:53h
0005H:00h
0006H:25h
0007H:00h
0008H:02h
OBSERVATIONS:(practical)
INPUT: LIST=
OUTPUT: LIST=
MEMORY LOCATIONS:
OUTPUT:DS: 0000H:
0001H:
0002H:
0003H:
0004H:
0005H:
0006H:
Page 63
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 63
0007H:
0008H:
RESULT:
Sorting of a given list of numbers is performed and results are observed using
TASM.
EXERCISE:
1. What is the sorting technique used in above program?
2. Are there any other ways to sort a list?
Page 64
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 64
5. PACKED TO UNPACKED BCD
AIM: To write a program to convert a packed BCD number to unpacked BCD
number.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Load AL with BCDIP & store into the DL
STEP3: ANDed the AL with 0F0H
STEP4:Load the 04 into into CL
STEP5:Rotate accumulator contents by 04 through carry ane moved into the
BH
STEP6: ANDed the DL with 0F0H and moved into BL
STEP7:Store the result
STEP8:End of the program
PROGRAM:
DATA SEGMENT
BCDIP DB 56H
UBCDOP DW 0
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV AX,DATA
MOV DS,AX
XOR AX,AX
MOV AL, BCDIP
MOV DL,AL
AND AL,0F0H
MOV CL,4
ROR AL,CL
MOV BH,AL
AND DL,0FH
MOV BL,DL
MOV UBCDOP,BX
Page 65
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 65
INT 3
CODE ENDS
END START
OBSERVATIONS:(Theoretical)
INPUT: BCDIP=56H
OUTPUT: UBCDOP=06H 05H
MEMORY LOCATIONS:
Input: ds: 0000h:56h
output: ds: 0001h:06h
0002h:05h
OBSERVATIONS:(practical)
INPUT: BCDIP=
OUTPUT: UBCDOP=
MEMORY LOCATIONS:
Input: ds: 0000h:
output: ds: 0001h:
0002h:
RESULT:
Conversion of packed BCD to unpacked BCD is performed and results are
observed using TASM.
EXERCISE:
1. What is the purpose of the instruction ROR AL, CL?
2. What is the purpose of the instruction AND AL, 0FH & AND AL,0F0H in the
program.?
3. What is the expansion of UPBCD?
Page 66
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 66
4. What is the use of DAA instruction?
5. What is the reason for packing unpacked BCD?
6. What is common between unpacked BCD and ASCII?
Page 67
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 67
6. BCD to ASCII CONVERSION
AIM: To write a program to convert a BCD number to its equivalent ASCII number.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Load AL with BCDIP & store into the DL
STEP3:ORed the AL with 30H
STEP4:Store the result
STEP5:End of the program
PROGRAM:
ASSUME CS:CODE, DS:DATA
DATA SEGMENT
BCDIP DB 04H
ASCOP DB 00
DATA ENDS
CODE SEGMENT
START:
MOV AX,DATA
MOV DS,AX
XOR AX,AX
MOV AL, BCDIP
OR AL,30H
MOV ASCOP,AL
INT 3
CODE ENDS
END START
OBSERVATIONS:(Theoretical)
INPUT: BCDIP=04H
OUTPUT: ASCOP=34H
Page 68
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 68
MEMORY LOCATIONS:
Input: ds: 0000h:04h
output: ds: 0001h:34H
OBSERVATIONS:(practical)
INPUT: BCDIP=
OUTPUT: ASCOP=
MEMORY LOCATIONS:
Input: ds: 0000h:
output: ds: 0001h:
RESULT:
Conversion of BCD to ASCII is performed and results are observed using TASM.
EXERCISE:
1. What is the difference between adding 30h and OR 30H to a BCD number to
conversion to ASCII?
2. Why unpacking is necessary during the conversion?
3. What is the ASCII character for symbol A?
4. What is the ASCII character for symbol zero „0‟?
Page 69
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 69
9. STRING OPERATIONS
1. LENGTH OF THE STRING
AIM: To write a program to find the length of the given string.
APPARATUS: Computer system installed with TASM
ALGORITHM:
Step1:Initialize the data segment
Step2: Initialize si and di
Step:3 Take the count as 0000h
Step4: Move the character of the string to al reg.
Step5: compare the al contents with dl ( the data in dl is 00h)
If zero flag is set goto step6 else goto step 8
Step6: increment the count value and increment the si
Step7: jump to step4
Step8: move the count value to output
Step9: end of the program.
PROGRAM:
Assume cs:code, ds:data
Data segment
String1 db “VKR”
String2 db ?
Data ends
Code segment
Start: Mov ax,data
Mov ds,ax
Mov ax,0000h
Mov si,0000h
Mov cl,00h
Mov dl,00h
Up: Mov al,string1[si]
Mov dl,00h
Cmp al,dl
Je Up1
Inc cl
Page 70
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 70
Inc si
Jmp Up
Mov String2[si],al
Up1: Int 03
Code ends
End start
OBSERVATIONS:(Theoretical)
INPUT: STRING=KAKINADA
OUTPUT:
K=6BH
A=61H
K=6BH
I=69H
N=6EH
A=61H
D=64H
A=61H
MEMORY LOCATIONS:
output: ds: 0000h:6BH
0001h:61H
0002h:6BH
0003h:69H
0004h:6EH
0005h:61H
0006h:64H
0007h:61H
OBSERVATIONS:(practical)
OUTPUT: STRING=
MEMORY LOCATIONS:
output: ds: 0000h:
0001h:
Page 71
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 71
0002h:
0003h:
0004h:
0005h:
0006h:
0007h:
RESULT:
Length of a string is performed and results are observed using TASM.
EXERCISE:
1. What is the operation performed by the instruction cmp al,$ ?
2. What is function 09h / int 21h performed?
3. Why SI is not been incremented is the program?
Page 72
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 72
2 BLOCK TRANSFER
AIM: To write a program to transfer a block of characters from one place to
another place using string instructions.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment and ES
STEP2: Load SI with first number (num1)
STEP3: Load DI with first number (num2)
STEP4: Load the count into CL
STEP5: clear the direction flag and transfer the string of bytes into
Respective memory locations
STEP6: End of the program
PROGRAM:
ASSUME CS:CODE, DS:DATA
DATA SEGMENT
NUM1 DB 11H,22H,33H,44H,55H,66H,77H,88H
NUM2 DB 01H,02H,03H,04H,05H,06H,07H,08H
COUNT EQU 08H
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV ES, AX
MOV SI, OFFSET NUM1
MOV DI, OFFSET NUM2
MOV CL, COUNT
CLD
REP MOVSW
INT 03H
CODE ENDS
END START
Page 73
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 73
OBSERVATIONS:(Theoretical)
INPUT: NUM1:11H,22H,33H,44H,55H,66H,77H,88H
NUM2:01H,02H,03H,04H,05H,06H,07H,08H
OUTPUT: NUM1: 11H,22H,33H,44H,55H,66H,77H,88H
MEMORY LOCATIONS:
OUTPUT: DS: 0000h:11H
0001h:22H
0002h:33H
0003h:44H
0004h:55H
0005h:66H
0006h:77H
0007h:88H
OBSERVATIONS:(PRACTICAL)
INPUT: NUM1:
NUM2:
OUTPUT: NUM1:
MEMORY LOCATIONS:
OUTPUT: DS: 0000h:
0001h:
0002h:
0003h:
0004h:
0005h:
0006h:
0007h:
RESULT:
Block transfer is performed and results are observed using TASM.
Page 74
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 74
EXERCISE:
1. If the DF=1, will the SI and DI register decremented?
2. The destination memory is pointed by which register combination?
3. The source is pointed to by which register combination?
Page 75
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 75
3 STRING COMPARISION
AIM: To write a program to Compare the two strings.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment and ES
STEP2: Load CL with first count (string1)
STEP3: Load CL with first count (string2)
STEP4: Compare CL &CH (string1 & string2)
STEP5: Jump if non zero to the step18
STEP6:load the first string character into AL
STEP7:load the second string character into BL
STEP8: Jump if non zero to the step18
STEP9:load the first string character into AL
STEP10:load the second string character into BL
STEP11:Compare the strings
STEP12: Jump if non zero to the step18
STEP13:Increment SI
STEP14:Decrement CL &CH
STEP15: Jump if non zero to the step6
STEP17:load the AX with 0000h
STEP18: Jump to the step20
STEP19:load the AX with1111h
STEP20: End of the program
PROGRAM:
Assume cs:code, ds:data
Data segment
Count1 db 04h
Count2 db 04h
String1 db “JNTU”
String2 db “JNTU”
Data ends
Code segment
Start: Mov ax,data
Mov ds,ax
Page 76
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 76
Mov cl,count1
Mov ch,count2
Cmp ch,cl
Jnz Below
Mov si,0000h
Up: Mov al,string1[si]
Mov bl,string2[si]
Cmp al,bl
Jnz Below
Inc si
Dec cl
Dec ch
Jnz Up
Jmp Below1
Below: Mov ax,0000h
Jmp exit
Below1: Mov ax,1111h
Exit: Int 03
Code ends
End start
OBSERVATIONS:(Theoretical)
INPUT: STRING1 =JNTU
STRING2=KAKINADA
OUTPUT: AX:1111H
MEMORY LOCATIONS:
OUTPUT: DS: 0000h:04H
0001h:04H
0002h:4AH:J
0003h:4EH:N
0004h:54H:T
0005h:55H:U
0006h:4BH:K
0007h:41H:A
0008h:4BH:K
0009h:49H:I
000Ah:4EH:N
000Bh:41H:A
Page 77
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 77
000Ch:44H:D
000Dh:41H:A
OBSERVATIONS:(Practical)
INPUT: STRING1 =
STRING2=
OUTPUT :AX:1111H
MEMORY LOCATIONS:
OUTPUT: DS: 0000h:
0001h:
0002h:
0003h:
0004h:
0005h:
0006h:
0007h:
0008h:
0009h:
000Ah:
000Bh:
000Ch:
000Dh:
RESULT: compare the two strings are performed and results are observed using TASM.
Page 78
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 78
4 STRING REVERSAL
AIM: To write a program to reverse a given string.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment and ES
STEP2: Initialize SI &DI
STEP3: Load BX with count
STEP4: move the BL into DL
STEP5: Jump if non zero to the step18
STEP6:load the first string character into AL
STEP7:load the second string character into BL
STEP8: Jump if non zero to the step18
STEP9:load the first string character into AL
STEP10:load the second string character into BL
PROGRAM:
Assume cs:code, ds:data
Data segment
Count dw 0003h
String1 db “VKR”
String2 db ?
Data ends
Code segment
Start : Mov ax,data
Mov ds,ax
Mov si,0000h
Mov di,0000h
Mov bx,count
Mov cl,04h
Up: Mov al,String1[si+bx]
Mov String2[di],al
Inc di
Dec bx
Jnz Up
Int 03
Page 79
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 79
Code ends
End start
OBSERVATIONS:(Theoretical)
INPUT: STRING1=KAKINADA
OUTPUT: STRING2=ADANIKAK
MEMORY LOCATIONS:
INPUT:DS: 0000H:K=6BH OUTPUT:DS: 0008H:A=61H
0001H:A=61H 0009H:D=64H
0002H:K=6BH 000AH:A=61H
0003H:I=69H 000BH:N=6EH
0004H:N=6EH 000CH:I=69H
0005H:A=61H 000DH:K=6BH
0006H:D=64H 000EH:A=61H
0007H:A=61H 000FH:K=6BH
OBSERVATIONS:(practical)
INPUT: STRING1=
OUTPUT: STRING2=
MEMORY LOCATIONS:
INPUT:DS: 0000H =
0001H =
0002H =
0003H =
0004H =
0005H =
0006H =
0007H =
OUTPUT:DS: 0008H =
0009H =
000AH =
000BH =
000CH =
000DH =
000EH =
000FH =
RESULT:
String reversal is performed and results are observed using TASM.
Page 80
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 80
EXERCISE:
1. Why BX register is added with „5‟?
2. Why MOVS instruction is not used?
3. What is the function of LODS and STOS instructions?
Page 81
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 81
5. STRING INSERTION
AIM: To write a program to insert a word in the given sentence.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Initialize the SI Register with 0000
STEP3: Load DL with Location
STEP4: Initialize the DI Register with 0000
STEP5: Move the content of LEN into the CL register
STEP6:Compare DX with SI Register
STEP7: Jump if Equal to the step18
STEP8: Move the content of String1 into the AL register
STEP9:Move the content of AL into the String2 of DI Register
STEP10: Decrement CL and increment SI,DI
STEP11:Jump to STEP6
STEP12:Move the content of ELEMENT into the AL register
STEP13:Move the AL into DI
STEP14:Increment DI
STEP15:Move the SI into AL and AL into DL
STEP16: Increment SI
STEP17: Continue the loop until to get result
STEP18:End of the program
PROGRAM:
Assume cs:code, ds:data
Data segment
String1 db “GUDVADA”
String2 db ?
Element db “ I “
Len db 08h
Location db 03h
Data ends
Code segment
Start: Mov ax,data
Page 82
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 82
Mov ds,ax
Mov si,0000h
Mov dl,Location
Mov di,0000h
Mov cl,len
Up: Cmp dx,si
Je down
Mov al,string1[si]
Mov string2[di],al
Dec cl
Inc si
Inc di
Jmp Up
Down: Mov al,element
Mov string2[di],al
Up1: inc di
Mov al,string1[si]
Mov string2[di],al
Inc si
Loop Up1
Int 03
Code ends
End start
OBSERVATIONS:(Theoretical)
INPUT: STRING1=RAJASKAR
ELEMENT=E
OUTPUT: STRING2=RAJASEKAR
MEMORY LOCATIONS:
INPUT:DS: 0000H:R=52H
0001H:A=41H
0002H:J=4AH
0003H:A=41H
0004H:S=53H
0005H:K=4BH
0006H:A=41H
0007H:R=52H
Page 83
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 83
OUTPUT:DS: 0008H:R=52H
0009H:A=41H
000AH:J=4AH
000BH:A=41H
000CH:S=53H
000DH:E=45H
000EH:K=4BH
000FH:A=41H
0010H:R=52H
OBSERVATIONS:(practical)
INPUT: STRING1=
ELEMENT=
OUTPUT: STRING2=
MEMORY LOCATIONS:
INPUT:DS: 0000H =
0001H =
0002H =
0003H =
0004H =
0005H =
0006H =
0007H =
OUTPUT:DS: 0008H =
0009H =
000AH =
000BH =
000CH =
000DH =
000EH =
000FH =
Page 84
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 84
RESULT:
String insertion is performed and results are observed using TASM.
EXERCISE:
1. Why register „DI‟ is loaded with 5?
2. What is the function of rep movsb?
3. What is the purpose of mov ah,01h / int 21h?
Page 85
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 85
6. STRING DELETION
AIM: To delete a word from the given sentence.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Initialize the SI Register with 0000
STEP3: Load CL with counter
STEP4: Load DH with counter 1
STEP5: Move the content of String1 into the AL register
STEP6: Compare AL and DL
STEP7 Jump on zero to step15
STEP8:Increment CH and SI
STEP9: Compare CL and CH
STEP10:Jump if non zero to step5
STEP11:Subtract DH and CL
STEP12:Move the SI into AL and AL into DL
STEP13: Increment SI and decrement DH
STEP14:Jump if non zero to step12
STEP15:End of the program
PROGRAM:
Assume cs:code, ds:data
Data segment
String1 db “GUDIVADA”
String2 db ?
Count1 db 04h
Data ends
Code segment
Start: Mov ax,data
Mov ds,ax
Mov si,0000h
Mov ch,00h
Mov cl,count1
Mov dh,count1
Page 86
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 86
Mov dl,00h
Up1: Mov al,string1[si]
Cmp al,dl
Jz Below
Inc ch
Inc si
Cmp cl,ch
Jnz Up1
Sub dh,cl
Up2: Mov al,string1[si]
Mov string2[si],al
Inc si
Dec ch
Jnz Up2
Below: int 03h
Code ends
End start
OBSERVATIONS:(Theoretical)
INPUT: STRING1=KAKINADA
OUTPUT: STRING2=NADA
MEMORY LOCATIONS:
INPUT:DS: 0000H:K=4BH
0001H:A=41H
0002H:K=4BH
0003H:I=49H
0004H:N=4EH
0005H:A=41H
0006H:D=44H
0007H:A=41H
OUTPUT:DS:
000EH:N=4EH
000FH:A=41H
Page 87
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 87
0010H:D=44H
0011H:A=41H
OBSERVATIONS:(practical)
INPUT: STRING1=
OUTPUT: STRING2=
MEMORY LOCATIONS:
INPUT:DS: 0000H:
0001H:
0002H:
0003H:
0004H:
0005H:
0006H:
0007H:
OUTPUT:DS:
000EH:
000FH:
0010H:
0011H:
RESULT:
String deletion is performed and results are observed using TASM.
EXERCISE:
1. What is the purpose of string length?
2. What does „equ‟ stands for?
3. What is the purpose of label start after the end directive?
Page 88
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 88
7. READING KEYBOARD WITH ECHO
AIM: To write a program to read the keyboard with echo.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Move 01 into AL
STEP3: Initialize DOS
STEP4: Move AL into address
STEP5: End of the program
PROGRAM:
DATA SEGMENT
CHAR DB 0
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV AH,01H
INT 21H
MOV CHAR, AL
INT 3
CODE ENDS
END START
OBSERVATIONS:
INPUT: N
OUTPUT:N
Page 89
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 89
RESULT:
Reading a keyboard is performed and results are observed using TASM.
EXERCISE:
1. Write a brief note on DOS interrupts.
2. What does AH register hold when INT 21H is called?
Page 90
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 90
8. READING KEYBOARD WITHOUT ECHO
AIM: To write a program to read the keyboard without echo.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Move 08 into AL
STEP3: Initialize DOS
STEP4: Move AL into address
STEP5: End of the program
PROGRAM:
DATA SEGMENT
CHAR DB 0
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX,DATA
MOV DS,AX
MOV AH,08H
INT 21H
MOV CHAR, AL
INT 3
CODE ENDS
END START
OBSERVATIONS:
INPUT:
OUTPUT:
RESULT:
Reading a keyboard is performed and results are observed using TASM.
Page 91
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 91
EXERCISE:
1. Write a brief note on DOS interrupts.
2. What does AH register hold when INT 21H is called?
Page 92
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 92
9. DISPLAYING A CHARACTER
AIM: To write a program to displaying a given string.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Move 08 into AL
STEP3: Initialize DOS
STEP4: Move AL into address
STEP5: End of the program
PROGRAM:
DATA SEGMENT
CHAR DB „*‟
DATA ENDS
CODE SEGMENT
ASSUME CS: CODE, DS: DATA
START:
MOV AX, DATA
MOV DS, AX
MOV AH, 02H
MOV DL,CHAR
INT 21H
MOV AX, 4C00H
INT 21H
CODE ENDS
END START
OBSERVATIONS:
INPUT:
OUTPUT:
RESULT:
Page 93
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 93
Displaying a character on screen is performed and results are observed using
TASM.
EXERCISE:
1. Write a brief note on DOS interrupts.
2. What does AH register hold when INT 21H is called?
Page 94
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 94
10. DISPLAYING A STRING
AIM: To write a program to displaying a given string.
APPARATUS: Computer system installed with TASM
ALGORITHM:
STEP1: Initialize the data segment
STEP2: Load DX with the string
STEP3: Initialize DOS
STEP4: End of the program
PROGRAM:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
STRING DB 'HAPPY NEW YEAR', 0DH, 0AH,'$'
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
LEA DX, STRING
MOV AH, 09H
INT 21H
CODE ENDS
END START
OBSERVATIONS:
INPUT: HAPPY NEW YEAR
OUTPUT: HAPPY NEW YEAR
RESULT:
Displaying a string on screen is performed and results are observed using TASM.
Page 95
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 95
EXERCISE:
1. Write a brief note on DOS interrupts.
2. What does AH register hold when INT 21H is called?
Page 96
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 96
Page 97
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 97
1. 8255 – PPI INTERFACING -1
AIM: Configure 8255A such that port A and port B as an output ports .Execute the
program at 0000:2000h
APPARATUS:
1. 8086 TRAINER KIT
2. 8255 STUDY CARD
3. ADAPTER, KEYBOARD, CABLES, ETC…
PROGRAM:
// DAC FOR ADC INTERFACE
// Connect the interface over J4 of the trainer
// This program illustrates the use of counter method for A/D conversion
// The program can be executed in Standalone or Serial Mode
// Execute the program from 2000H
OUTPUT 2500AD
ORG 2000H
MOV AX,00H //INITIALISE SEGMENT REGISTERS
MOV CS,AX
MOV ES,AX
MOV SP,3000H //INITIALISE STACK POINTER
CALL FAR 0FE00:0031H //NEWLINE
MOV DX,0FFE6H //INITIALISE 8255 AS FOLLOWS
MOV AL,81H //PORT A = OUTPUT
OUT DX,AL //PORT C = INPUT
JMP SHORT START
TEST: DB 0DH,20H,'CONVERTING... ', 00H
MES: DB 0AH,0DH,20H, 'DIGITAL VALUE = ',00H
START: MOV DX,0FFE4H //wait for start of conversion(SOC)
IN AL,DX
CALL DELAY
CALL DELAY
AND AL,02H
JZ START
Page 98
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 98
MOV AX,0FFH
PUSH AX
CONT: MOV DX,0FFE4H //check for SOC
IN AL,DX
CALL DELAY
AND AL,02H
JNZ START //If true start again
POP AX //else continue
MOV DX,0FFE0H
INC AL //increment count and
OUT DX,AL //output to port
PUSH AX
PUSH DX
LEA DX,TEST //display 'converting...'
MOV AX,DX
POP DX
CALL FAR 0FE00:0013H
CALL DELAY
MOV DX,0FFE4H //read comparator output
IN AL,DX
AND AL,00000001B
JNZ CONT //if PC0=1,continue else
LEA DX,MES //conversion is over
MOV AX,DX
CALL FAR 0FE00:0013H //display message
POP AX
CALL FAR 0FE00:0052H //DISPLAY OUTPUT
CALL FAR 0FE00:0031H
JMP SHORT START
DELAY: MOV CX,8000H //delay routine
HERE: LOOP HERE
RET
END
Page 99
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 99
OBSERVATIONS:
INPUT:
OUTPUT:
RESULT:
8086 Interfacing with 8255 is done and results are observed.
Page 100
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 100
2. 8279 – KEYBOARD/DISPLAY INTERFACING
AIM: To interface keyboard/display with 8086 microprocessor and display a given
sentence on the display board.(Left Entry)
APPARATUS:
1. 8086 TRAINER KIT
2. 8279 STUDY CARD
3. ADAPTER, KEYBOARD, CABLES, ETC…
PROGRAM:
CMDREG EQU 0FFEBH
DATAREG EQU 0FFE9H
.8086
.MODEL TINY
.STACK 32
.DATA
.CODE
ORG 2000H
START:
MOV AX,CS
MOV DS,AX
MOV AL,10H // ENCODED SCAN-8CHAR 8 BIT
LEFT ENTRY
MOV DX,CMDREG
OUT DX,AL
MOV AL,090H //WRITE RAM AUTO INCREMENT
OUT DX,AL
MOV CX,08
CLEAR:MOV AL,00
MOV DX,DATAREG
OUT DX,AL
LOOP CLEAR
BACK: MOV DX,CMDREG
IN AL,DX // READ THE COMMAND R4EGISTER TO GET THE 8279
STATUS
Page 101
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 101
AND AL,07 // NUMBER OF KEYS PRESSED IS IN THE LOWER 3 BITS
MASK //THESE AND CHECK IF NOT ZERO. IF ZERO NO
KEY PRESSED
JZ BACK
MOV BX,OFFSET SSCHARLUT
MOV AL,040H // READ THE FIRST RAM ADDRESS OF
FIFO
OUT DX,AL
MOV DX,DATAREG //
IN AL, DX
AND AL,01FH
XLAT // CONVERT THE KEY READ TO THE
SS CODE
MOV DX,DATAREG
OUT DX,AL // DISPLAY AT THE CURRENT DIGIT
POSITION
JMP BACK
SSCHARLUT:
SS0 DB 3FH //0
SS1 DB 6H //1
SS2 DB 5BH //2
SS3 DB 4FH //3
SS4 DB 66H //4
SS5 DB 6DH //5
SS6 DB 7DH //6
SS7 DB 07H //7
SS8 DB 7FH
SS9 DB 6FH
SSA DB 77H
SSB DB 7CH
SSC DB 39H
SSD DB 5EH
SSE DB 79H
SSF DB 71H
END START
OBSERVATIONS:
INPUT:
Page 102
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 102
OUTPUT:
RESULT:
8086 Interfacing with 8279 is done and results are observed.
Page 103
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 103
3. 8259 – PROGRAMMABLE INTERUPT CONTROLLER
AIM: To interface Programmable Interrupt Controller with 8086 microprocessor.
APPARATUS:
1. 8086 TRAINER KIT
2. 8259 STUDY CARD
3. ADAPTER, KEYBOARD, CABLES, ETC…
PROGRAM:
ORG 1000H
MOV AL,17H
OUT 0C0H, AL
MOV AL,08H
OUT 0C2H, AL
MOV AL,01H
OUT 0C2H, AL
MOV AL,FEH
OUT 0C2H, AL
STI
HERE: JMP HERE
MOV AL,20H
LOOP 0C0H,AL
INT 02H
Interrupt Vector:-
0000:0200 00h
0000:0021 12h
0000:0022 00h
0000:0023 00h
OBSERVATIONS:
INPUT:
OUTPUT:
Page 104
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 104
RESULT:
8086 Interfacing with 8279 is done and results are observed.
Page 105
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 105
4. 8251 – USART
AIM: To interface USART (Universal Synchronous Asynchronous Receiver
Transmitter) with 8086 microprocessor.
APPARATUS:
1 8086 TRAINER KIT
2 8251 STUDY CARD
3 ADAPTER, KEYBOARD, CABLES, ETC…
PROGRAM:
TRANSMITTER END:
ORG 1000H
MOV AL,36H
OUT 0CEH, AL
MOV AL,10H
OUT 0C8H, AL
MOV AL,00H
OUT 0C8H, AL
MOV AL,4EH
OUT 0C2H, AL
MOV AL,37H
OUT 0C2H, AL
LOOP1:IN AL,0C2H
AND AL,04H
JZ LOOP1
MOV AL,41H
OUT 0C0H,AL
INT 02H
RECEIVER END:
ORG 1200H
MOV AL,36H
OUT 0CEH, AL
MOV AL,10H
OUT 0C8H, AL
MOV AL,00H
Page 106
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 106
OUT 0C8H, AL
MOV AL,4EH
OUT 0C2H, AL
MOV AL,37H
OUT 0C2H, AL
LOOP2:IN AL,0C2H
AND AL,04H
JZ LOOP2
IN AL,0C0H
MOV BX,I500H
MOV [BX],AL
INT 02H
OBSERVATIONS:
INPUT:
OUTPUT:
RESULT:
8086 Interfacing with 8279 is done and results are observed.
Page 107
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 107
Page 108
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 108
Expected Questions from Microprocessors
1. Who Invented 8086 microprocessor?
2. In which year 8086 microprocessor is invented?
3. How many address lines are available on 8086?
4. How many data lines are available on 8086?
5. Why address bus is unidirectional?
6. Whether data bus is unidirectional or bidirectional?
7. What is a bus?
8. If AL=0FFh and ADD AL,01h instruction is executed, what is the status of status
flags?
9. Under what condition bus contention occurs?
10. How can you avoid bus contention?
11. The segment 1234h and offset is 0022h, then the physical address is?
12. If an instruction is accessed by 8086 is 20ms, the time taken by 8088 is?
13. The no. of cycles required by 8086 for writing/reading to/from memory/IO ports is?
14. Whether 8086 contains internal clock generator?
15. 8086 requires external clock signal with a duty cycle of?
16. In 8086 the lower bank of 8086 contains?
17. When ready pin of 8086 is at logic 0 then wait states are
18. The vectored interrupt in 8086 is?
19. Non vectored interrupt in 8086 is?
20. To restart from the initial state when „1‟ is placed on 8086 RESET pin, the duration
for which the signal must present is?
21. The rate of transmission in serial mode is?
22. In serial I/O, data transmission takes place using which code?
23. USART converts data from which form to which from?
24. The inputs and outputs of 8251 are compatible with which logic?
25. Whether RS232C is compatible with TTL Logic?
26. If TxD output remains high the 8251 contains which characters?
27. In RS232C, RS stands for?
28. In RS 232C standard uses positive logic or negative logic?
29. Which transmission is used for high speed serial data transmission?
30. Expand DCE and DTE?
31. Which type of ADC is the fastest one?
32. Which type of ADC is the most expensive one?
33. Which type of ADC used DAC inside?
34. How many comparators are required by an 8-bit flash type ADC?
Page 109
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 109
35. In 8259 if IR3, IR6, IR7 are activated, which interrupt has the highest priority?
36. Which register in 8259 is used to disable interrupt requests?
37. Which ports are used in BSR mode of 8255?
38. Which port provides hand shaking signals in Mode1 & Mode2 of 8255?
39. What is the IC used for DMA transfer?
40. How many peripherals can be connected to 8237 at any point of time?
41. For bidirectional data transfer, 8255 is operated in which mode?
42. DMA will send a request signal to which pin of 8086?
43. Which instruction is used to return from the interrupt service procedure?
44. What are the ICs MC 1488 and MC 1489?
45. When accessing a memory location shared with a coprocessor, the signal that
prevents the coprocessor from accessing that location is?
46. There are two no. of 2Kx8 memory chips. How to obtain 4Kx8 memory?
47. When the processor has 32 address lines, how much memory can be interfaced to
that processor?
48. Whether Stepper Motor is an AC Motor or DC Motor?
49. Give any application of Stepper Motor in our real life?
50. What do you mean by interfacing?
Expected Questions from Microcontrollers
1. Who has introduced MCS-51 family of microcontrollers?
2. MCS-51 family of microcontrollers contains which ICs?
3. What is the difference between MP and MC?
4. Give any Example of Microcontrollers?
5. Is 8051 an 8-bit controller?
6. Why 8051 is an 8-bit controller?
7. What is the on chip ROM capacity of 8051?
8. What is the on chip RAM capacity of 8051?
9. How many IO ports are available on 8051 on chip?
10. How many timers are available on 8051 on chip?
11. Which version of 8051 doesn‟t have on chip ROM?
12. Which version of 8051 contains EPROM on chip?
13. 8051 contains which type of ROM?
14. What is the purpose of ROM in 8051?
15. What is the purpose of RAM in 8051?
16. Whether ROM is accessible randomly or not?
17. What is the capacity of on chip EPROM on 8751?
18. Can you connect external program memory to 8051?
19. Can you connect external data memory to 8051?
Page 110
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 110
20. What is the capacity of external program memory that can be connected to 8051?
21. What is the capacity of external data memory that can be connected to 8051?
22. How can you access internal program memory?
23. How can you access external program memory?
24. How is it possible to access both internal & external ROM using PC?
25. How can you access internal data memory?
26. How can you access external data memory?
27. Do you require any signal to access external data memory?
28. Do you require any signal to access external program memory?
29. What is the reason behind connecting only 64KB of external program memory?
30. What is the reason behind connecting only 64KB of external data memory?
31. Expand DPTR?
32. Is a DPTR an 8-bit register?
33. Can we access PC as two 8-bit registers?
34. Is there any register in 8086 similar to PC in 8051?
35. Expand SFR?
36. Is PC a special function register?
37. Whether external interrupts are edge triggered or level triggered type?
38. Expand ALE?
39. Expand PSEN?
40. What is the function of PSEN pin?
41. For serial communication the pins of which IO port is used?
42. Which register is used to operate 8051 in different modes?
43. What are the modes of operation of 8051?
44. Whether PCON is a bit addressable SFR?
45. Which port will hold the higher order address information during memory access?
46. Which Io port of 8051 doesn‟t have dual function?
47. What is the Architecture of 8051?
48. What is stack?
49. What is the function of SP register?
50. The number of clock cycles in one machine cycle of 8051 is?
Page 111
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 111
Key to the Questions on Microprocessors
1. Intel Corporation
2. 1974
3. 20 address lines
4. 16 data lines
5. The address bus is unidirectional because the information on the address
bus is always provided by the microprocessor.
6. Data bus is bidirectional.
7. Bus is a collection of signal lines. Generally they carry address, data and
control signals.
8. CF=1, PF=1, AF=1, ZF=1, SF=0 and OF=0
9. Bus contention occurs when two outputs trying to drive the same line.
10. Bus contention can be avoided by using tri-state condition which isolates one of
the outputs.
11. 12362h.
12. 40ms.
13. 4 clock cycles.
14. No
15. 33% duty cycle for its optimal functioning.
16. Even address locations.
17. Between T3 and T4 states.
18. NMI.
19. INTR.
20. 4 clock cycles.
21. Baud.
22. ASCII.
23. Parallel form to Serial.
24. TTL Logic.
25. No.
26. No data (Stop bits).
27. Recommended Standard.
28. Negative logic.
29. Synchronous transmission.
30. DCE stands for Data Communications Equipment and DTE stands for Data
Terminal Equipment.
31. Flash type ADC.
32. Successive Approximation ADC.
33. Successive Approximation ADC.
34. 8 Comparators.
Page 112
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 112
35. IR3.
36. Interrupt Mask Register.
37. Only Port C bits.
38. Port C provides hand shaking signals.
39. 8237 or 8257
40. Four
41. Mode 2
42. HOLD pin.
43. IRET.
44. Voltage translators.
45. LOCK
46. By connecting address lines in serial and data lines parallel
47. 232
= 4GB
48. DC Motor
49. Printers, X-Y plotters, Hard disk/Floppy Disk Drives, etc.,
50. Interfacing means not only connecting the devices but also communicating
between them.
Key to the Questions on Microcontrollers
1. Intel Corporation
2. 8031, 8051, 8052, 8751 and 8752 Microcontrollers.
3. MP contains ALU, Control Unit and On chip memory where as
Microcontroller contains MP, ROM, RAM, IO Ports, Counters/Timers on chip.
4. 8051
5. Yes
6. Because all the internal registers and accumulator are of 8-bit wide and they can
process 8-bit data.
7. 4KB
8. 128 bytes
9. 4 no. of 8-bit IO Ports
10. 2 no. of 16-bit Timers/Counters
11. 8031
12. 8751
13. Simple Read Only Memory
14. ROM is used for storing Programs hence it is called as Program Memory.
15. RAM is nothing but Data Memory and is used to store data
16. Yes
17. 4KB
18. Yes
Page 113
Dept. of ECE MPI LAB MANUAL
V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 113
19. Yes
20. 64KB
21. 64KB
22. Program Counter
23. Program Counter
24. Whenever we access external program memory, we use MOVX instruction which
distinguish the internal & external ROM.
25. By means of its address in the program instructions.
26. Data Pointer.
27. Yes. We require Logic „0‟ on External Access pin.
28. No signal is required to access external program memory.
29. Because PC is a 16-bit register, the maximum memory that can be
interfaced externally is 216
= 64KB only.
30. DPTR is a 16-bit register// the maximum memory that can be interfaced
externally is 216
= 64KB only.
31. Data Pointer
32. DPTR is a 16-bit register, but we can access it as two 8-bit registers DPH & DPL.
33. No, we can‟t access PC as two 8-bit registers.
34. PC is very similar to IP register in 8086.
35. SFR stands for Special Function register.
36. No, PC is the only register which doesn‟t come under SFR.
37. They can be programmed as either edge triggered or level triggered.
38. Address Latch Enable
39. PSEN stands for Program Store ENable.
40. PSEN is used to store program in external memory.
41. Port 3 pins are used for serial communication.
42. PCON (Power CONtrol) SFR is used.
43. Power Down Mode and Idle Mode.
44. No. PCON is not bit addressable.
45. Port 2 will hold the higher order address information during memory access.
46. Port 1 pins have no dual functions.
47. The Architecture of 8051is called Harvard Architecture.
48. Stack is an area in internal RAM that is used in conjunction with certain opcodes
to store and retrieve data quickly.
49. SP holds an internal RAM address that is called top of the stack.
50. 12 clock cycles.