0% found this document useful (0 votes)
129 views59 pages

MPMC Lab Manual

The document discusses Microsoft Macro Assembler (MASM), an x86 assembler for MS-DOS and Windows. It supports macros, structured programming, and high-level functions. Later versions added 32-bit and 64-bit support. Assembly language programming involves editing source code with an editor, assembling the code with MASM to generate object files, linking object files with a linker, and debugging the executable with a debugger. Debuggers allow examining memory and registers, setting breakpoints, and stepping through code.

Uploaded by

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

MPMC Lab Manual

The document discusses Microsoft Macro Assembler (MASM), an x86 assembler for MS-DOS and Windows. It supports macros, structured programming, and high-level functions. Later versions added 32-bit and 64-bit support. Assembly language programming involves editing source code with an editor, assembling the code with MASM to generate object files, linking object files with a linker, and debugging the executable with a debugger. Debuggers allow examining memory and registers, setting breakpoints, and stepping through code.

Uploaded by

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

MICROPROCESSORS ANDMICROCONTROLLERS LAB

INTRODUCTION TO MASM

MASM (Microsoft Macro assembler):

The Microsoft Macro Assembler (MASM) is an x86 assembler for MS-DOS and Microsoft
Windows. It supports a wide variety of macro facilities and structured programming idioms, including
high- level functions for looping and procedures. Later versions added the capability of producing
programs for Windows. MASM is one of the few Microsoft development tools that target 16-bit, 32-bit
and is supplied as a 64 bit version ML64.EXE for 64-bit platforms. Versions 5.0 and earlier were MS-
DOS applications. Versions 5.1 and 6.0 were available as both MS-DOS and OS/2 applications. Versions
6.12 to 6.14 were implemented as patches for version 6.11 which converted them from 16 bit MZ
executables to 32 bit PE executable files. All later versions have been 32 bit PE executable files built as
Win32 console mode applications.
The Microsoft Assembler has been in production since 1981 and is upgraded by Microsoft to keep
abreast with operating system needs and processor developments. Prior to Microsoft Assembler, the
abbreviation MASM referred to Meta Assembler. MASM 6.0 was released in 1992 and was the first
version to include high-level programming support (in particular if/endif macros) and a more C-like
syntax. By the end of the year, version 6.1A updated the memory management to be compatible with code
produced by Visual C++. In 1993, full support for 32-bit applications and the Pentium instruction set had
been added, plus Phar Lap's DOS extender. By the end of 1997, MASM fully supported Windows 95, did
not require the DOS extender, and included some AMD-specific instructions. In 1999, Intel released
macros for SIMD and MMX instructions, which were shortly after supported natively by MASM. With
the 6.15 release in 2000, Microsoft discontinued support for MASM as a separate product, instead
subsuming it into the Visual Studio toolset, though it was still compatible with Windows 98, though
current versions of Visual Studio were not. Support for 64-bit processors was not added until the release
of Visual Studio 2005, with MASM given the version number 8.0.
Assembly language programming consists of following steps:

EDITOR:
An editor is a program, which allows you to create a file containing the assembly language statements
for your program. As you type in your program, the editor stores the ASCII codes for the letters and numbers in
successive RAM locations. When you have typed in all of your programs, you then save the file on a floppy of
hard disk. This file is called source file. The next step is to process the source file with an assembler. In the
MASM /TASM assembler, you should give your source file name the extension, .ASM
ASSEMBLER:
An assembler program is used to translate the assembly language mnemonics for instructions to the
corresponding binary codes. When you run the assembler, it reads the source file of your program from the disk,
where you saved it after editing on the first pass through the source program the assembler determines the
displacement of named data items, the offset of labels and pails this information in a symbol table. On the second
pass through the source program, the assembler produces the binary code for each instruction and inserts the
offset etc that is calculated during the first pass. The assembler generates two files on floppy or hard disk. The
first file called the object file is given the extension. OBJ. The object file contains the binary codes for the
instructions and information about the addresses of the instructions. The second file generated by the assembler is
called assembler list file. The list file contains your assembly language statements, the binary codes for each
instructions and the offset for each instruction. In MASM/TASM assembler, MASM/TASM source file name
ASM is used to assemble the file. Edit source file name LST is used to view the list file, which is generated, when
you assemble the file.

DEPT. OF ECE, ADITYA COLLEGE OF Page 1


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

LINKER:
A linker is a program used to join several object files into one large object file and convert to an exe file.
The linker produces a link file, which contains the binary codes for all the combined modules. The linker however
doesn’t assign absolute addresses to the program, it assigns is said to be reloadable because it can be put
anywhere in memory to be run. In MASM/TASM, LINK/TLIN7K source filename is used to link the file.
DEBUGGER:
A debugger is a program which allows you to load your object code program into system memory,
execute the program and troubleshoot are debug it the debugger allows you to look at the contents of registers and
memory locations after your program runs. It allows you to change the contents of register and memory locations
after your program runs. It allows you to change the contents of register and memory locations and return the
program. A debugger also allows you to set a break point at any point in the program. If you inset a breakpoint
the debugger will run the program up to the instruction where the breakpoint is set and stop execution. You can
then examine register and memory contents to see whether the results are correct at that point. In MASM/TASM,
td filename is issued to debug the file.
DEBUGGER FUNCTIONS:
1. Debugger allows looking at the contents of registers and memory locations.
2. We can extend 8-bit register to 16-bit register which the help of extended register option.
3. Debugger allows setting breakpoints at any point with the program.
4. The debugger will run the program up to the instruction where the breakpoint is set and then stop execution of
program. At this point, we can examine registry and memory contents at that point.
5. With the help of dump we can view register contents.
6. We can trace the program step by step with the help of F7.
7. We can execute the program completely at a time using F8.

DEPT. OF ECE, ADITYA COLLEGE OF Page 2


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

PROCEDURE TO CREATE FILES AND TO EXECUTE PROGRAMS:

1. Navigate to MASM directory.


2. Create an ASM file using Notepad.
3. Save the program with an extension of .asm.
4. Make ensure that the file is saved with an extension of .asm
5. Click on DosBox icon.
6. Type mount e e:\
7. Type e: to go to e drive.
8. Type cd masm to change masm directory.
9. Type exec filename to check for errors
10. If no errors or warnings, type afdebug filename to execute program and
see the result.

To navigate through the window:


1. Use f1 for single step execution
2. Use f7, f8, f9, f10 for navigation through the window.
3. Use f3 to go to starting command line

DEPT. OF ECE, ADITYA COLLEGE OF Page 3


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

THEORETICAL CALCULATIONS:

Address OP Code Label Mnemonics Operands Comment

DEPT. OF ECE, ADITYA COLLEGE OF Page 4


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

EXP. NO: 1 PERFORM SIMPLE ARITHMETIC OPERATIONS USING DIFFERENT ADDRESSING MODES
DATE: 1(a). Addition of two 16 bit numbers

AIM: To write an assembly language program for Addition of two 16-bit numbers.

APPARATUS: MASM software, PC

PROGRAM:

ASSUME CS:CODE, DS:DATA


CODE SEGMENT
DATA SEGMENT
OP1 DW ?
OP2 DW ?
SUM DW ?
DATA ENDS

CODE SEGMENT
START:
MOV AX,DATA
MOV DS,AX
MOV AX,OP1
MOV BX,OP2
ADD AX,BX
MOV SUM,AX
INT 03H
CODE ENDS
END START
END
OUTPUT:
Address of an operand Example – 1 Example - 2

RESULT:

DEPT. OF ECE, ADITYA COLLEGE OF Page 5


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

THEORETICAL CALCULATIONS:

Address OP Code Label Mnemonics Operands Comment

DEPT. OF ECE, ADITYA COLLEGE OF Page 6


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

1(b). Subtraction of two 16 bit numbers

AIM: To write an assembly language program for subtraction of two 16-bit numbers.

APPARATUS: MASM software, PC

PROGRAM:

ASSUME CS:CODE, DS:DATA


DATA SEGMENT
OP1 DW ?
OP2 DW ?
DIFF DW ?
DATA ENDS
CODE SEGMENT
START:
MOV DS,AX
MOV
AX,OP1
MOV BX,OP2
SUB AX,BX
MOV
DIFF,AX INT
03H CODE
ENDS END
START END

OUTPUT:

Address of an operand Example – 1 Example - 2

RESULT:

DEPT. OF ECE, ADITYA COLLEGE OF Page 7


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

THEORETICAL CALCULATIONS:

Address OP Code Label Mnemonics Operands Comment

DEPT. OF ECE, ADITYA COLLEGE OF Page 8


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

1(C). Multiplication of two 16 bit numbers


AIM: To write an assembly language program for multiplication of two 16-bit num.

APPARATUS: MASM software, PC

PROGRAM:

ASSUME CS:CODE, DS:DATA


CODE SEGMENT
DATA SEGMENT
OP1 DW ?
OP2 DW ?
PL DW ?
PH DW ?
DATA ENDS
CODE SEGMENT
START:
MOV AX,DATA
MOV DS,AX
MOV AX,OP1
MOV BX,OP2
MUL BX
MOV PL,AX
MOV PH,DX
INT 03H
CODE ENDS
END START
END

OUTPUT:
Address of an operand Example – 1 Example - 2

RESULT:

DEPT. OF ECE, ADITYA COLLEGE OF Page 9


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

THEORETICAL CALCULATIONS:

Address OP Code Label Mnemonics Operands Comment

DEPT. OF ECE, ADITYA COLLEGE OF Page 10


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

1(d). Division of two 16 bit numbers


AIM: To write an assembly language program for division of two 16-bit numbers.

APPARATUS: MASM software, PC

PROGRAM:

ASSUME CS:CODE, DS:DATA


CODE SEGMENT
DATA SEGMENT
OP1 DW
? OP2 DW
? Q DW ?
R DW ?
DATA ENDS
CODE SEGMENT
START:
MOV AX,DATA
MOV DS,AX
MOV AX,OP1
MOV BX,OP2
DIV BX
MOV Q,AX
MOV R,DX
INT 03H
CODE ENDS
END START
END

OUTPUT:
Address of an operand Example – 1 Example - 2

RESULT:

DEPT. OF ECE, ADITYA COLLEGE OF Page 11


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

Viva questions:

1) What is a microprocessor and microcontroller?


2) Mention the features of microprocessor?
3) What are the features of 8086
microprocessor? 4)What is difference between
8085 and 8086?
5) What is the maximum memory addressing capacity of 8086?
6) Mention the registers of 8085 and 8086?
7) What are the functions of general purpose and segment register in 8086?
8) Draw and mention the flags of 8086?
9) What does it mean by physical address in8086?
10) List out the different addressing modes with
examples in 8086?
11) What is meant by accumulator?
12) What is meant by assembler directive?
13) What is the use of INT 03H instruction

DEPT. OF ECE, ADITYA COLLEGE OF Page 12


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

DEPT. OF ECE, ADITYA COLLEGE OF Page 13


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

DEPT. OF ECE, ADITYA COLLEGE OF Page 14


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

Inference (Things learned from the experiment):

Applications:

(To be filled by faculty)


Marks Remarks:
Category
awarded
Experiment Conduction
&Behavior
Regularity
Calculations
Viva-Voce
Inference Date of Submission:
Total: Signature of the faculty:

DEPT. OF ECE, ADITYA COLLEGE OF Page 15


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

THEORETICAL CALCULATIONS:

Address OP Code Label Mnemonics Operands Comment

DEPT. OF ECE, ADITYA COLLEGE OF Page 16


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

EXP. NO: 2 SORT AN ARRAY OF BINARY NUMBERS.


DATE: 2(a). Sort an array of binary numbers in ascending order

AIM: To write an assembly language program for arranging a string in ascending order.

APPARATUS: MASM Software, PC

PROGRAM: ASSUME CS: CODE, DS: DATA

DATA SEGMENT
LIST DW 0101b, 0100b, 0011b,
0010b COUNT EQU 04H
DATA ENDS

CODE SEGMENT
START:
MOV AX, DATA
MOV DS, AX
MOV DX, COUNT-
1 AGAIN0: MOV CX, DX
MOVSI, OFFSET
LIST AGAIN1: MOV AX, [SI]
CMP AX, [ SI+2]
JC PR1
XCHG [SI+2], AX
XCHG [SI], AX
PR1: ADD SI,02H
LOOP
AGAIN1 DEC
DX
JNZ AGAIN0
INT 03H
CODE ENDS
END START

OUTPUT:
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA

RESULT:

DEPT. OF ECE, ADITYA COLLEGE OF Page 17


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

THEORETICAL CALCULATIONS:

Address OP Code Label Mnemonics Operands Comment

DEPT. OF ECE, ADITYA COLLEGE OF Page 18


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

2(b). Sort an array of binary numbers in descending order

AIM: To write an assembly language program for arranging a string in descending order.

APPARATUS: MASM Software, PC

PROGRAM:
ASSUME CS: CODE, DS:

DATA DATA SEGMENT


LIST DW 0010b, 0011b, 0100b,
0101b COUNT EQU 04H
DATA ENDS

CODE SEGMENT
START:
MOV AX, DATA
MOV DS, AX
MOV DX, COUNT-
1 AGAIN0: MOV CX, DX
MOV SI, OFFSET
LIST AGAIN1: MOV AX, [SI]
CMP AX, [ SI+2]
JNC PR1
XCHG [SI+2], AX
XCHG [SI], AX
PR1: ADD SI,02H
LOOP
AGAIN1 DEC
DX
JNZ AGAIN0
INT 03
CODE ENDS
END START

OUTPUT:
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA

RESULT:

DEPT. OF ECE, ADITYA COLLEGE OF Page 19


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

Viva questions:
1) What is the use of SI, DI, SP, and BP Registers?
2) What is the use of XCHG instruction?
3) What is the use of CX Register?
4) What is the use of JNZ instruction?
5) What are the functions of BIU?
6) What are the functions of EU?
7) What are the interrupts of 8086?
8) What is instruction cycle?
9) What is pipelining in 8086?
10) Draw the pin diagram of 8086?

DEPT. OF ECE, ADITYA COLLEGE OF Page 20


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

DEPT. OF ECE, ADITYA COLLEGE OF Page 21


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

DEPT. OF ECE, ADITYA COLLEGE OF Page 22


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

Inference (Things learned from the experiment):

Applications:

(To be filled by faculty)


Marks Remarks:
Category
awarded
Experiment Conduction
&Behavior
Regularity
Calculations
Viva-Voce
Inference Date of Submission:
Total: Signature of the faculty:

DEPT. OF ECE, ADITYA COLLEGE OF Page 23


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

THEORETICAL CALCULATIONS:

Address OP Code Label Mnemonics Operands Comment

DEPT. OF ECE, ADITYA COLLEGE OF Page 24


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

EXP. NO: 3 CODE CONVERSIONS


DATE: 3(a). Converting packed BCD to unpacked BCD

AIM: - To write an assembly language program for converting packed BCD to unpacked BCD for 8086
processor.

APPARATUS: MASM SOFTWARE, PC

PROGRAM:

ASSUME CS: CODE, DS: DATA

DATA SEGMENT
PBCD DB ?
UPBCD DW ?
DATA ENDS

CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
XOR AX,AX
MOV AL,
PBCD MOV
AH, AL MOV
CL, 4 SHR AH,
CL
AND AX, 0F0FH
MOV UPBCD,AX
INT 3H
CODE ENDS
END START

OUTPUT:

Address of an operand Example – 1 Example - 2

RESULT:

DEPT. OF ECE, ADITYA COLLEGE OF Page 25


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

THEORETICAL CALCULATIONS:

Address OP Code Label Mnemonics Operands Comment

DEPT. OF ECE, ADITYA COLLEGE OF Page 26


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

3b. Converting packed BCD to ASCII

AIM: - To write an assembly language program for converting packed BCD to ASCII for 8086 processor

APPARATUS: MASM SOFTWARE, PC

PROGRAM:

ASSUME CS: CODE, DS: DATA

DATA SEGMENT
PBCD DB ?
ASCI DW ?
DATA ENDS

CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
XOR AX,AX
MOV AL,
PBCD MOV
AH, AL MOV
CL, 4 SHR AH,
CL
AND AX, 0F0FH
OR AX,3030H
MOV ASCI,AX
INT 3H
CODE ENDS
END START

OUTPUT:
Address of an operand Example – 1 Example - 2

RESULT:

DEPT. OF ECE, ADITYA COLLEGE OF Page 27


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

THEORETICAL CALCULATIONS:

Address OP Code Label Mnemonics Operands Comment

DEPT. OF ECE, ADITYA COLLEGE OF Page 28


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

3c. Converting ASCII to packed BCD

AIM: - To write an assembly language program for converting ASCII to packed BCD for 8086 processor

APPARATUS: MASM SOFTWARE, PC

PROGRAM:

ASSUME CS:CODE
CODE SEGMENT
MOV Ax,3637h
MOV CL, 04
and Ax,0f0fh
rol ah,cl
add ah,al
INT 3H
CODE ENDS
END

OUTPUT:

Address of an operand Example – 1 Example - 2

RESULT:

DEPT. OF ECE, ADITYA COLLEGE OF Page 29


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

Viva questions:
1) What is the meaning of packed and unpacked data?
2) What is ASCII and BCD code?
3) What is difference between ROR and RCR?
4) What are the hardware and software interrupts of 8086?
5) Explain how AAA, AAS, AAM and AAD instructions are performed by the 8086 processor?
6) Bring out the differences between 8086 and 8088?
7) What is instruction set of 8086 and give the classification?
8) What are the differences between maskable and non maskable interrupts?
9) What is maximum and minimum mode of 8086?
10) Mention the pins present in maximum and minimum mode of 8086

DEPT. OF ECE, ADITYA COLLEGE OF Page 30


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

DEPT. OF ECE, ADITYA COLLEGE OF Page 31


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

DEPT. OF ECE, ADITYA COLLEGE OF Page 32


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

Inference (Things learned from the experiment):

Applications:

(To be filled by faculty)


Marks Remarks:
Category
awarded
Experiment Conduction
&Behavior
Regularity
Calculations
Viva-Voce
Inference Date of Submission:
Total: Signature of the faculty:

DEPT. OF ECE, ADITYA COLLEGE OF Page 33


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

THEORETICAL CALCULATIONS:

Address OP Code Label Mnemonics Operands Comment

DEPT. OF ECE, ADITYA COLLEGE OF Page 34


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

EXP. NO: 04 Addition of an array of BCD numbers stored in packed form


DATE:

AIM: - To write an assembly language program for Addition of an array of BCD numbers stored in packed
form.
APPARATUS: MASM SOFTWARE, PC

PROGRAM: ASSUME CS:CODE, DS:DATA


DATA SEGMENT
LIST DB 01,02,03,04,05,06,07,08,09
COUNT EQU 09H
SUM_LSB DB 0
DATA ENDS
CODE SEGMENT
START:
MOV AX,DATA
MOV DS,AX
MOV CL,09H
MOV SI,OFFSET LIST
MOV AL,[SI]
UP: INC SI
MOV BL,[SI]
ADD AL,BL
DAA
DEC CL
JNZ UP
INT 21H
CODE ENDS
END START
END

OUTPUT:

Address of an operand Example – 1 Example - 2

RESULT:

DEPT. OF ECE, ADITYA COLLEGE OF Page 35


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

Viva questions:
1) What is the use of DAA instruction?
2) Explain LOOP and LOOPE instructions?
3) What is stack pointer and program counter?
4) What are the functions of RD’, WR’, M/IO’, BHE’/S7 pins in 8086?
5) What are the advantages of memory segmentization?
6) What are macros and procedures?
7) What is the use of PUSH and POP instruction?
8) Differentiate RISC and CISC processors?
9) What is the need of interfacing I/O devices to microprocessor?
10) Differentiate between inter segment and intra segment jumps in 8086?

DEPT. OF ECE, ADITYA COLLEGE OF Page 36


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

DEPT. OF ECE, ADITYA COLLEGE OF Page 37


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

DEPT. OF ECE, ADITYA COLLEGE OF Page 38


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

Inference (Things learned from the experiment):

Applications:

(To be filled by faculty)


Marks Remarks:
Category
awarded
Experiment Conduction
&Behavior
Regularity
Calculations
Viva-Voce
Inference Date of Submission:
Total: Signature of the faculty:

DEPT. OF ECE, ADITYA COLLEGE OF Page 39


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

THEORETICAL CALCULATIONS:

Address OP Code Label Mnemonics Operands Comment

DEPT. OF ECE, ADITYA COLLEGE OF Page 40


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

EXP. NO: 05 Multiplying two 3x3 matrices and print on DOS


DATE:

AIM: - To write an assembly language program for Multiplying two 3x3 matrices and print on DOS.

APPARATUS: MASM SOFTWARE, PC

PROGRAM:
ASSUME CS:CODE , DS:DATA
DATA SEGMENT
ROCOL EQU 03H
MAT1 DB 01H,02H,03H,04H,05H,06H,07H,08H,09H
MAT2 DB 01H,02H,03H,01H,02H,03H,01H,02H,03H
PMAT3 DW 09H DUP(?)
DATA ENDS
CODE SEGMENT
START:MOV
AX,DATA MOV
DS,AX
MOV CH,ROCOL
MOV BX,OFFSET PMAT3
MOV SI,OFFSET MAT1
NEXTROW: MOV DI,OFFSET MAT2
MOV CL,ROCOL
NEXTCOL: MOV
DL,ROCOL MOV
BP,0000H
MOV AX,0000H
SAHF
NEXT_ELE:MOV AL,[SI]
MUL BYTE PTR[DI]
ADD BP,AX
INC SI
ADD DI,03
DEC DL
JNZ NEXT_ELE
SUB DI,08
SUB SI,03
MOV [BX],BP
ADD BX,02
DEC CL
JNZ NEXTCOL
ADD SI,03
DEC CH

DEPT. OF ECE, ADITYA COLLEGE OF Page 41


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB
JNZ NEXTROW
MOV AH,4CH

DEPT. OF ECE, ADITYA COLLEGE OF Page 42


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

INT 21H
CODE ENDS
END START
END

OUTPUT:

Address of an operand Example – 1 Example - 2

RESULT:

DEPT. OF ECE, ADITYA COLLEGE OF Page 43


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

Viva questions:
1) State the significance of LOCK’ signal in 8086?
2) How does the microprocessor differentiate data and instruction?
3) Differentiate near jump and far jump?
4) What is DOS and BIOS function calls?
5) Compare serial and parallel communication?
6) List the various operating modes of 8253?
7) Write the format of ICW1 of 8259?
8) Name the six modes of operations of an 8253?
9) Give the memory classification?
10) What are the differences between SRAM and DRAM?

DEPT. OF ECE, ADITYA COLLEGE OF Page 44


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

DEPT. OF ECE, ADITYA COLLEGE OF Page 45


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

Inference (Things learned from the experiment):

Applications:

(To be filled by faculty)


Marks Remarks:
Category
awarded
Experiment Conduction
&Behavior
Regularity
Calculations
Viva-Voce
Inference Date of Submission:
Total: Signature of the faculty:

DEPT. OF ECE, ADITYA COLLEGE OF Page 46


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB
THEORETICAL CALCULATIONS:

Address OP Code Label Mnemonics Operands Comment

DEPT. OF ECE, ADITYA COLLEGE OF Page 47


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

EXP. NO: 6 IDENTIFICATION & DISPLAYING THE ACTIVATED KEY USING DOS AND BIOS FUNCTION
CALLS
DATE:

AIM: To write an assembly language program for Identification & Displaying the Activated Key
Using DOS and BIOS Function Calls

APPARATUS: MASM software, PC

PROGRAM:
DISPLAY A CHARACTER

ASSUME CS: CODE, DS: DATA


DATA SEGMENT
OP1 DB 'A'
DATA ENDS
CODE SEGMENT
START:MOV AX,DATA
MOV DS,AX
MOV AH,02H
MOV DL,OP1
INT 21H
CODE ENDS
END START
END

READING A KEYBOARD WITHOUT ECHO

ASSUME CS:CODE
CODE SEGMENT
START:
MOV AH,08H
INT 21H
CODE ENDS
END START
END

INPUT A CHARACTER WITH ECHO

ASSUME CS:CODE
CODE SEGMENT
START:
MOV AH,01H
INT 21H
CODE ENDS
END START
END

OUTPUT:

Address of an operand Example – 1 Example - 2

RESULT:

DEPT. OF ECE, ADITYA COLLEGE OF Page 48


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

Viva questions:
1) What is DOS and BIOS function calls?
2) Write differences between macros & procedures?
3) Define immediate addressing mode of 8086 microprocessor with example.
4) Define direct addressing mode of 8086 microprocessor with example.
5) Define register addressing mode of 8086 microprocessor with example.
6) Define indexed addressing mode of 8086 microprocessor with example.
7) Define based, based indexed addressing modes of 8086 microprocessor with example.
8) What is assembler directive? List out all assembler directives of 8086?
9) List out the data transfer instructions of 8086?
10) List out the arithmetic and logical instructions of 8086?
11) List out the string manipulation instructions of 8086?
12) List out the data transfer instructions of 8086?
13) List out the branch instructions of 8086?
14) List out the processor control and flag manipulation instructions of 8086?
15) Compare CALL, PUSH and RET,POP instructions?

DEPT. OF ECE, ADITYA COLLEGE OF Page 49


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

DEPT. OF ECE, ADITYA COLLEGE OF Page 50


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

DEPT. OF ECE, ADITYA COLLEGE OF Page 51


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB
Inference (Things learned from the experiment):

Applications:

(To be filled by faculty)


Marks Remarks:
Category
awarded
Experiment Conduction
&Behavior
Regularity
Calculations
Viva-Voce
Inference Date of Submission:
Total: Signature of the faculty:

DEPT. OF ECE, ADITYA COLLEGE OF Page 52


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

CYCLE -II
INTEL 8051 ( 8-Bit Microcontroller)
EXP. NO: 1 DETECTION OF KEY CLOSURE BY POLLING TECHNIQUE
DATE:

AIM: To write an C language program for Detection of Key Closure by Polling Technique

APPARATUS: KEIL software, PC

PROGRAM:
#include<reg51.h>
sbit SW=P1^7;
void Msdelay(unsigned int itime)
{
unsigned int i,j;
for(i=0;i<itime;i++)
for(j=0;j<1275;j++);
}
void main()
{
SW=1;
while(1)
{
if (SW==0)
{
P2=0X66;
Msdelay(10000);
P2=0Xcc;
Msdelay(10000);
P2=0X99;
Msdelay(10000);
P2=0X33;
Msdelay(10000);
}
else
{
P2=0X66;
Msdelay(10000);
P2=0X33;
Msdelay(10000);

DEPT. OF ECE, ADITYA COLLEGE OF Page 53


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB
P2=0X99;
Msdelay(10000);
P2=0Xcc;
Msdelay(10000);
}
}
}

OUTPUT:

Address of an operand Example – 1 Example - 2

RESULT:

DEPT. OF ECE, ADITYA COLLEGE OF Page 54


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB
Viva questions:
1) What is mean by microcontroller?
2) What are the advantages of microcontroller over microprocessor?
3) List the features of 8051 microcontroller?
4) List the on-chip peripherals of 8051 microcontroller.
5) Explain the 16-bit registers DPTR and SP of 8051.
6) What is the importance of special function registers (SPF) in 8051?
7) Name the special functions registers available in 8051.
8) Name the five interrupt sources of 8051?
9) What are the addressing modes of 8051 microcontroller?
10) What is the purpose for the 8255 PPI?

DEPT. OF ECE, ADITYA COLLEGE OF Page 55


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

DEPT. OF ECE, ADITYA COLLEGE OF Page 56


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

DEPT. OF ECE, ADITYA COLLEGE OF Page 57


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB
Inference (Things learned from the experiment):

Applications:

(To be filled by faculty)


Marks Remarks:
Category
awarded
Experiment Conduction
&Behavior
Regularity
Calculations
Viva-Voce
Inference Date of Submission:
Total: Signature of the faculty:

DEPT. OF ECE, ADITYA COLLEGE OF Page 58


ENGINEERING
MICROPROCESSORS ANDMICROCONTROLLERS LAB

DEPT. OF ECE, ADITYA COLLEGE OF Page 59


ENGINEERING

You might also like