home *** CD-ROM | disk | FTP | other *** search
/ The Business Master (3rd Edition) / The Business Master (3rd Edition).iso / files / utilfile / bye / byeit.asm < prev    next >
Encoding:
Assembly Source File  |  1991-06-03  |  2.6 KB  |  66 lines

  1. ;**********************************************************************
  2. ;  Super-simple file deleter that completely erases file !
  3. ;  Free utility from David Smith, Compuserve 71441,2723
  4. ;         Any comments, suggestions ... write me.
  5. ;**********************************************************************
  6.  
  7.           DOSSEG
  8.           MODEL small
  9.           STACK 256
  10.  
  11.           DATASEG
  12.  
  13. helping   db  'Usage: BYE [filename] ',0
  14. hand      db  'Free utility from Dave Smith, Compuserve [71441,2723]',0
  15. msg       db  'Error deleting the file ',0
  16.  
  17.           CODESEG
  18.  
  19. EXTRN getparams:proc, getoneparam:proc, strwrite:proc, byebye:proc
  20. EXTRN paramcount:proc, newline:proc
  21.  
  22. Start:
  23.           mov       ax, @data           ;move variables into AX
  24.           mov       es, ax              ;and that into ES
  25.           call      getparams           ;External function to get
  26.           call      paramcount          ;command-line parameters
  27.           or        dx, dx              ;See if parameters exist
  28.           jz        help                ;If not, show help screen
  29.  
  30.           xor       cx, cx              ;Clear out CX
  31.           call      getoneparam         ;get first parameter
  32.           mov       dx, di              ;move name into DX
  33.           mov       ah, 3Ch             ;CREATE file function
  34.           mov       cx, 06h             ;make Hidden + System
  35.           int       21h                 ;call DOS
  36.           jc        error
  37.  
  38.           mov       bx, ax              ;move file handle to BX
  39.           mov       ah, 57h             ;set-up for file date/time change
  40.           mov       al, 01h
  41.           mov       cx, 00h             ;time == 0
  42.           mov       dx, 00h             ;date == 0
  43.           int       21h                 ;call DOS
  44.           jc        error
  45.  
  46.           mov       dx, di              ;set-up for deleting file
  47.           mov       ah, 41h
  48.           int       21h                 ;and DOS it !
  49.           jc        error
  50.           call byebye                   ;Then exit via external function
  51.  
  52. help:     call newline                  ;external function to make newline
  53.           mov       di, offset helping  ;Pull helpscreen in
  54.           call strwrite
  55.           call newline
  56.           mov       di, offset hand
  57.           call strwrite                 ;and write it
  58.           call newline                  ;  Another newline, then leave
  59.           call byebye
  60. error:
  61.           mov       di, offset msg      ;Show error message
  62.           call strwrite
  63.           call byebye                   ;Then leave
  64.  
  65. END       start
  66.