home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / fortran / mslang / biosasm / intx.for < prev    next >
Text File  |  1991-02-04  |  2KB  |  44 lines

  1. c INTX.FOR  A sample program which uses the INT21, function 41 hex
  2. c  to delete a file.  This example uses the segment registers.
  3. c
  4. c
  5. c NOTE:
  6. c THIS PROGRAM, ITS USE, OPERATION AND SUPPORT IS PROVIDED "AS
  7. c IS," WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
  8. c INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  9. c MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE
  10. c ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THIS PROGRAM
  11. c IS WITH THE USER.  IN NO EVENT SHALL MICROSOFT BE LIABLE FOR ANY
  12. c DAMAGES INCLUDING, WITHOUT LIMITATION, ANY LOST PROFITS, LOST
  13. c SAVINGS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
  14. c FROM THE USE OR INABILITY TO USE SUCH PROGRAM, EVEN IF
  15. c MICROSOFT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
  16. c OR FOR ANY CLAIM BY ANY OTHER PARTY.                               
  17.  
  18.  
  19.       include 'interrpt.inc' 
  20.       character filename*12              ! File to delete 
  21.       integer*2 flen                     ! Length of filename 
  22.       integer*4 addr                     ! Location of filename 
  23.       gethibyte (dataword) = dataword / 256  ! statement functions from
  24.       getlobyte (dataword) = iand(dataword , 255)  ! include file
  25.       print 10 
  26.    10 format (' Enter name of file to delete -> ',$) 
  27.       read (*,'(a)') filename            ! Get the file to delete 
  28.       flen=len_trim(filename)            ! Remove extra spaces 
  29.       filename=filename(:flen)//char(0)  ! Must be an ASCIIZ filename 
  30.       addr=locfar(filename)              ! Get the segment and offset 
  31.                                          ! of the file 
  32.       intnum=#21
  33.       inregsX.dx=iand(addr,#FFFF) 
  34.       inregsX.ds=ishft(addr,-16) 
  35.       inregsX.ax=#4100                        ! Function number 
  36.       call interruptX(intnum,inregsX,outregsX)   ! Call DOS interruptX 
  37.       if (iand(outregsX.flags,1).eq.0) then   ! No error on delete 
  38.         write (*,*) 'File deleted sucessfully!' 
  39.       else                                   ! Error if carry is set 
  40.         write (*,*) ' File not deleted!  Status= ', outregsX.ax 
  41.       endif 
  42.       end
  43. 
  44.