0% found this document useful (0 votes)
2 views6 pages

Lab Manual Microprocessor

The document is a lab manual for Microprocessor Assembly Programming, detailing four assembly programs. The programs include printing a string, taking user input and displaying it, determining if a number is even or odd, and converting character case from uppercase to lowercase and vice versa. Each program is presented with its code and comments for clarity.

Uploaded by

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

Lab Manual Microprocessor

The document is a lab manual for Microprocessor Assembly Programming, detailing four assembly programs. The programs include printing a string, taking user input and displaying it, determining if a number is even or odd, and converting character case from uppercase to lowercase and vice versa. Each program is presented with its code and comments for clarity.

Uploaded by

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

Lab Manual for

Microprocessor Assembly Programming Lab


CSE0613210
Program 01: Write an assembly program to print a String declared
under the data segment.

Code:

.MODEL SMALL
.STACK 100h
.DATA

​ MSG DB "THIS IS A MESSAGE$"

.CODE

MAIN PROC
​ MOV AX, @DATA
​ MOV DS, AX

​ MOV AH, 9
​ LEA DX, MSG
​ INT 21H

​ MOV AH, 4CH


​ INT 21H

​ MAIN ENDP
END MAIN
Program 02: Write an assembly program to take input from user
and print it on the console.

Code:

.MODEL SMALL
.STACK 100h
.DATA

.CODE

MAIN PROC
​ MOV AH, 1
​ INT 21H

​ MOV BL, AL

​ MOV AH, 2
​ MOV DL, 0AH
​ INT 21H
​ MOV DL, 0DH
​ INT 21H

​ MOV DL, BL
​ INT 21H

​ MOV AH, 4CH


​ INT 21H

​ MAIN ENDP
END MAIN
Program 03: Write an assembly program so that if AL contains 2 or
4, the output shows even. If AL contains 3 or 5, the output shows
odd.

Code:
.MODEL SMALL
.STACK 100H
.DATA
EVEN DB "EVEN$"
ODD DB "ODD$"
.CODE
MAIN PROC
MOV AX, @DATA
MOV DS, AX

MOV AL, 2
MOV AH, 9

CMP AL, 3
JE PRINT_ODD
CMP AL, 5
JE PRINT_ODD
CMP AL, 2
JE PRINT_EVEN
CMP AL, 4
JE PRINT_EVEN

PRINT_EVEN:
LEA DX, EVEN
INT 21H
JMP EXIT
PRINT_ODD:
LEA DX, ODD
INT 21H
JMP EXIT
EXIT:
MOV AH, 4CH
INT 21H
MAIN ENDP
END MAIN
Program 02: Write an assembly program to read a character. If it is
in uppercase, convert it to lowercase, and if it is in lowercase,
convert it to uppercase.

Code:
.MODEL SMALL
.STACK 100H
.DATA
.CODE
MAIN PROC
MOV AH, 1
INT 21H

CMP AL, 65
JL EXIT
CMP AL, 90
JG CHECK_LOWER
JMP CONVERT_LOWER

CHECK_LOWER:
CMP AL, 97
JL EXIT
CMP AL, 122
JG EXIT
JMP CONVERT_UPPER

CONVERT_LOWER:
ADD AL, 32
MOV AH, 2
MOV DL, AL
INT 21H
JMP EXIT

CONVERT_UPPER:
SUB AL, 32
MOV AH, 2
MOV DL, AL
INT 21H
EXIT:
MOV AH, 4CH
INT 21H
MAIN ENDP
END MAIN

You might also like