0% found this document useful (0 votes)
165 views5 pages

Lab 5

This document contains two 8086 assembly language programs (ALPs). The first ALP renames an existing file called "hello.txt". It prompts the user to enter data, opens the existing file, writes the input data to the file, and displays an error message if the file operation fails. The second ALP inputs an organization name from the keyboard and conditionally displays different messages based on whether the input matches "VIT" or not. It will display "Permission granted" if the input is "VIT", otherwise it will display "Wrong details".
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)
165 views5 pages

Lab 5

This document contains two 8086 assembly language programs (ALPs). The first ALP renames an existing file called "hello.txt". It prompts the user to enter data, opens the existing file, writes the input data to the file, and displays an error message if the file operation fails. The second ALP inputs an organization name from the keyboard and conditionally displays different messages based on whether the input matches "VIT" or not. It will display "Permission granted" if the input is "VIT", otherwise it will display "Wrong details".
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/ 5

CSE 2006 – MICROPROCESSORS AND INTERFACING

LAB ASSESSMENT - 5

SANCHET KUMAR SAHU


17BCE0595
SLOT – L47 + L48
1) Write an ALP to rename an existing file named “hello.txt”.
ALP:
DATA SEGMENT
MES DB 10,13,'ENTER SOME DATA IN THE FILE$' FILENAME DB
'HELLO.TXT'
BUFFER DB 22 DUP(0)
MES1 DB 10,13, 'ERROR IN FILE HANDLING$' DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:MOV AX,DATA
MOV DS,AX
MOV AH,09H
LEA DX,MES
INT 21H
MOV BUFFER,20
MOV AH,0AH
MOV DX,OFFSET BUFFER
INT 21H
MOV AH,3CH
MOV CX,0
MOV DX,OFFSET FILENAME
INT 21H
MOV BX,AX
MOV AH,40H
MOV CX,20
MOV DX, OFFSET BUFFER
INT 21H
JC ERROR JMP EXIT
ERROR:MOV DX,OFFSET MES1
MOV AH,09
INT 21H
EXIT:
MOV AH,4CH
INT 21H
CODE ENDS
END START

2) Write an 8086 ALP which will input the organization name from the
keyboard. If the name is ‘VIT’ it will output “Permission granted” else it will
display the message “Wrong details” using DOS Interrupt.

ALP:
DATA SEGMENT
MSG1 DB 10,13,"INPUT ORGANISATION : $" MSG2 DB
10,13,"WRONG DETAILS $"
MSG3 DB 10,13,"PERMISSION GRANTED $" STR1 DB

"VIT"
P1 LABEL BYTE M1
DB 0FFH L1 DB ?
P11 DB 0FFH DUP ('$')
DATA ENDS

DISPLAY MACRO MSG


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

CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV AX,DATA
MOV DS,AX

DISPLAY MSG1 LEA

DX,P1
MOV AH,0AH
INT 21H

LEA SI,STR1
LEA DI,P11

MOV CX,3 CHECK:


MOV AL,[SI] CMP
[DI],AL
JNE NOPASWD
INC SI
INC DI
LOOP CHECK

DISPLAY MSG3
JMP EXIT

NOTEQUAL:
DISPLAY MSG4

NOPASWD:
DISPLAY MSG2
JMP EXIT

EXIT: MOV AH,4CH


INT 21H
CODE ENDS
END START

You might also like