home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
fortran
/
mslang
/
biosasm
/
intx.for
< prev
next >
Wrap
Text File
|
1991-02-04
|
2KB
|
44 lines
c INTX.FOR A sample program which uses the INT21, function 41 hex
c to delete a file. This example uses the segment registers.
c
c
c NOTE:
c THIS PROGRAM, ITS USE, OPERATION AND SUPPORT IS PROVIDED "AS
c IS," WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
c INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
c MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
c ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THIS PROGRAM
c IS WITH THE USER. IN NO EVENT SHALL MICROSOFT BE LIABLE FOR ANY
c DAMAGES INCLUDING, WITHOUT LIMITATION, ANY LOST PROFITS, LOST
c SAVINGS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
c FROM THE USE OR INABILITY TO USE SUCH PROGRAM, EVEN IF
c MICROSOFT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
c OR FOR ANY CLAIM BY ANY OTHER PARTY.
include 'interrpt.inc'
character filename*12 ! File to delete
integer*2 flen ! Length of filename
integer*4 addr ! Location of filename
gethibyte (dataword) = dataword / 256 ! statement functions from
getlobyte (dataword) = iand(dataword , 255) ! include file
print 10
10 format (' Enter name of file to delete -> ',$)
read (*,'(a)') filename ! Get the file to delete
flen=len_trim(filename) ! Remove extra spaces
filename=filename(:flen)//char(0) ! Must be an ASCIIZ filename
addr=locfar(filename) ! Get the segment and offset
! of the file
intnum=#21
inregsX.dx=iand(addr,#FFFF)
inregsX.ds=ishft(addr,-16)
inregsX.ax=#4100 ! Function number
call interruptX(intnum,inregsX,outregsX) ! Call DOS interruptX
if (iand(outregsX.flags,1).eq.0) then ! No error on delete
write (*,*) 'File deleted sucessfully!'
else ! Error if carry is set
write (*,*) ' File not deleted! Status= ', outregsX.ax
endif
end