Categories
- 4th semester (27)
- 5th semester (3)
- ADA (13)
- Assembly Level Language (12)
- BE (45)
- C Language Programming (5)
- C language (20)
- C++ Language (5)
- CCP Lab programing (3)
- Computer Programming Lab (3)
- DAA Lab Programming (13)
- Data Structure and C++ laboratory Program (6)
- Data Structure and C++ labotary Program (5)
- Design and Analysis of algorithm (14)
- First Year (5)
- MASM (12)
- Microprocessor (12)
- Microprocessor lab program (12)
- System Software & OS Laboratory (5)
- Unix program (4)
- bachelor of engineering (30)
- basic (1)
- basic mathematics (2)
- beginners (10)
- c++ program (9)
- calculations (7)
- computer science (30)
- downloadable (5)
- engineering syllabus (4)
- simple program (6)
Trend Posts
Blogger news
Author
Followers
Blog Archive
-
▼
2014
(37)
-
▼
February
(12)
- a program to create a file (input file) and to del...
- Read a pair of input co-ordinates in BCD and move ...
- Write a program to simulate a Decimal Up-counter t...
- Read the current time from the system and display ...
- Compute nCr using recursive procedure. Assume that...
- Read your name from the keyboard and display it at...
- Read two strings, store them in locations STR1 and...
- Reverse a given string and check whether it is a p...
- Read an alphanumeric character and display its equ...
- Sort a given set of ‘n’ numbers in ascending order...
- Write two ALP modules stored in two different file...
- Search a key element in a list of ‘n’ 16-bit numbe...
-
▼
February
(12)
Friday, February 21, 2014
ASSUME DS: DATA, CS: CODE
DATA SEGMENT
FILEC DB 'D:\MPLAB\SEM4.TXT$', 0 ;FILEC array is
declared to create a file SEM4.txt in D
; directory under MPLAB folder.
FILED DB 'D:\MPLAB\123.TXT$', 0 ;FILED array is declared to delete a file123.txt
which is
;already
created in D directory under MPLAB
folder.
MSG1 DB 0AH, 0DH, 'FILE IS CREATED', '$'
MSG2 DB 0AH, 0DH, 'FILE IS NOT CREATED', '$'
MSG3 DB 0AH, 0DH,'FILE IS DELETED', '$'
MSG4 DB 0AH, 0DH,'FILE IS NOT DELETED', '$'
MSG5 DB 0AH, 0DH,'CREATED FILE IS : ', '$'
MSG6 DB 0AH, 0DH,'DELETED FILE IS : ', '$'
DATA ENDS ; end of data
segment
DISP MACRO MSG ; DISP macro definition starts
MOV DX, OFFSET MSG ; display the message whose offset is in
DX
MOV AH, 09H ; using 09H with DOS 21H interrupt.
INT 21H
ENDM ; end of macro
definition
CODE SEGMENT
START: MOV AX, DATA ; data segment
initialization
MOV DS, AX
MOV DX, OFFSET FILEC ; DX: offset address of
FILEC array containing the drive,
;directory path and filename to be
created.
MOV CX, 00 ; CX
is cleared indicating no attributes for the file. (read only)
MOV AH, 3CH ; service no. to create file with DOS 21H
interrupt
INT 21H ; file is created
JC NOTCRE ; if carry flag is set to 1, it
indicates that file is not created,
;
then jump to
label NOTCRE
DISP MSG1 ; otherwise invoke the macro to display MSG1 (created)
DISP MSG5 ; invoke the macro to display MSG5
(created file is)
DISP FILEC ;invoke the macro
to display FILEC
array contents.
JMP NEXT ;
jump
to label NEXT to delete the file.
NOTCRE: DISP
MSG2 ; invoke
the macro to display MSG2 (file is not created)
NEXT:
MOV DX, OFFSET FILED ;DX: offset address of FILED array containing the drive,
; directory path and filename to be
deleted.
MOV AH, 41H ; service
number to delete a file with DOS 21 H interrupt
INT 21H ; file is deleted
JC NOTDEL ; if carry flag is set to 1, it
indicates that file is not deleted,
;
jump to label NOTDEL
DISP MSG3 ; invoke the macro to display MSG3
(file is deleted)
DISP MSG6 ; invoke the macro to display MSG6
(deleted file is)
DISP FILED ;invoke the macro to display FILED array contents.
NOTDEL:DISP MSG4 ;
invoke
the macro to display MSG4 (file is
not deleted)
EXIT: MOV AH, 4CH ; terminate the program
INT 21H
CODE ENDS ; end
of code segment
END START ; end
of program
Output:
D:\MASM>
Masm 12a.asm;
D:\MASM>
Link 12a.obj;
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment
You are very Important to Us...
STAY TUNE...