home *** CD-ROM | disk | FTP | other *** search
/ Phoenix CD 2.0 / Phoenix_CD.cdr / 11a / cover20.zip / COORDR.ASM < prev    next >
Assembly Source File  |  1991-01-21  |  2KB  |  78 lines

  1.     PAGE    ,132
  2.     TITLE    COORDR  -  Diskette contents list - Redefine Order
  3.     COMMENT        * Version 1.0  -  June 1983
  4.             (PER Dr. Dobbs Journal, January, 1984, #87)
  5.             (Dan Daetwyler "Sorted Diskette Directory for
  6.                  the IBM PC")
  7.  
  8.         Version 2.0       Bruce F. Cameron
  9.                   Cincinnati  OH 
  10.  
  11.            February 25, 1985
  12.  
  13.     Counts hidden files
  14.     Grouped sort (i.e. all COM files first etc.)
  15.     Includes Volume Label and Directory (if not root)
  16.     Lists Subdirectory names
  17.     Free space up to 100M (hard disk)  *
  18. ;
  19. ;
  20.     PAGE    82
  21. ;
  22. ;    Request file extension entries which are to be sorted to the beginning of the list
  23. ;
  24. CODE    SEGMENT    PARA PUBLIC 'CODE'
  25.     ASSUME    CS:CODE, DS:CODE
  26. ;
  27.     EXTRN    RELOC:BYTE
  28. SPCHAR    DB    80H            ; Ordering character
  29. XBUF    DB    8,0            ; Input buffer for extension
  30.     DB    8 DUP (?)
  31. XPRMT1    DB    13,10,'Enter file name extension to relocate$'
  32. XPRMT2    DB    13,10,'   to top of list ("\" to quit): $'
  33. ;
  34.     PUBLIC    GETORD
  35. GETORD    PROC    NEAR
  36.     MOV    BP,0            ; Counter of entries
  37.     MOV    DI,OFFSET RELOC
  38. LOOP:    MOV    DX,OFFSET XPRMT1    ; Prompt for extension
  39.     MOV    AH,9
  40.     INT    21H
  41.     MOV    DX,OFFSET XPRMT2
  42.     MOV    AH,9
  43.     INT    21H
  44.     MOV    DX,OFFSET XBUF
  45.     MOV    AH,0AH            ; Get extension
  46.     INT    21H
  47.     CMP    XBUF+2,5CH        ; Check for done (\)
  48.     JE    QUIT
  49.     MOV    BL,XBUF+1        ; Get length
  50.     CMP    BL,2
  51.     JNLE    STOR
  52.     XOR    BH,BH
  53.     MOV    CX,BX
  54.     SUB    CX,3
  55.     NEG    CX            ; Set loop count (3 - length of string)
  56.     PUSH    DI
  57.     LEA    DI,XBUF[BX+2]        ; Points to char just after string
  58.     MOV    AL,' '            ; Fill with blanks
  59.     REP    STOSB            ;   to 3 characters
  60.     POP    DI
  61. STOR:    MOV    CX,3
  62.     MOV    SI,OFFSET XBUF+2
  63.     REP    MOVSB            ; Extension from buffer to list
  64.     MOV    AL,SPCHAR
  65.     STOSB                ; Add `ordering' character
  66.     INC    SPCHAR
  67.     INC    BP            ; Count entry
  68.     CMP    BP,10
  69.     JL    LOOP            ; Cycle if 9 or fewer entries
  70. QUIT:    MOV    BYTE PTR [DI],0        ; Terminator to end-of-list
  71.     MOV    SPCHAR,80H        ; Reset ordering character
  72.     RET
  73. GETORD    ENDP
  74. ;
  75. CODE    ENDS
  76. ;
  77.     END
  78.