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

  1.     PAGE    ,132
  2.     TITLE    COVER    -    Diskette contents list    - Main Module
  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. ;                *     DD Systems     *
  23. ;                **********************
  24. ;
  25. CODE    SEGMENT    PARA PUBLIC 'CODE'
  26.     ASSUME    CS:CODE, DS:CODE
  27. ;
  28.     EXTRN    RESTR:BYTE
  29.     EXTRN    DOPRT:NEAR
  30. ;
  31.     ORG    100H
  32. BEGIN:    JMP    START
  33. ;
  34.     PUBLIC    VERS
  35. ;
  36. VERS    DB    0            ; DOS Version flag
  37. DDRV    DB    0            ; Default drive at entry
  38. NDRV    DB    0            ; Number of drives in system
  39. PRMT    DB    13,10,'Enter drive to list  (Esc to quit):  $'
  40. ERMSG1    DB    13,10,'Invalid drive$'
  41. SETPRT    DB    27,'0',27,'C',44,15,0    ; Set 1/8" line, 132 characters
  42. RESPRT    DB    27,'@',0        ; Restore printer to power up status
  43. ;
  44.     EXTRN    GETTTL:NEAR, GETFRE:NEAR, SCAN:NEAR, SORT:NEAR, PRINT:NEAR, GETORD:NEAR
  45.     EXTRN    PSX:BYTE
  46. ;
  47. START    PROC    NEAR
  48.     MOV    DX,OFFSET SETPRT
  49.     CALL    DOPRT            ; Set printer
  50.     MOV    AH,30H
  51.     INT    21H            ; Check for DOS Version
  52.     OR    AL,AL
  53.     JZ    NOTTWO            ; V1.x
  54.     DEC    AL            ; V2.0
  55. NOTTWO:    MOV    VERS,AL            ; Save DOS flag
  56.     MOV    AH,19H
  57.     INT    21H            ; Get default drive
  58.     MOV    DDRV,AL            ;     and save
  59.     MOV    DL,AL
  60.     MOV    AH,0EH
  61.     INT    21H            ; Get number of drives
  62.     MOV    NDRV,AL            ;     and save
  63. ;
  64. ;    Start of main loop
  65. ;
  66. MLOOP:    MOV    DX,OFFSET PRMT        ; Prompt for drive
  67.     MOV    AH,9
  68.     INT    21H
  69.     MOV    AH,1
  70.     INT    21H            ; Get user response
  71.     CMP    AL,1BH            ; Check for exit (ESC)
  72.     JE    QUIT
  73.     OR    AL,' '            ; Not finished, force lowercase
  74.     SUB    AL,'a'-1        ; Compute drive number ('a' = 1)
  75.     JNC    DRVOK            ; May be valid, result > 0
  76. ERR1:    MOV    DX,OFFSET ERMSG1    ; Invalid drive MS
  77.     MOV    AH,9
  78.     INT    21H            ; List error MS
  79.     JMP    MLOOP
  80. DRVOK:    CMP    AL,NDRV            ; Check requested drive in system
  81.     JA    ERR1            ; No, go to error
  82.     DEC    AL            ; Decrement, drive #'s  0...
  83.     MOV    DL,AL
  84.     MOV    AH,0EH
  85.     INT    21H            ; Make selected drive the default
  86.     CALL    GETTTL            ; Get title of listing
  87.     CALL    GETORD            ; Get file extension reorder list
  88.     CALL    GETFRE            ; Get free space on disk
  89.     CALL    SCAN            ; Load directory entries
  90.     CALL    SORT            ; Sequence entries
  91.     CALL    PRINT            ; Print directory listing
  92.     JMP    MLOOP
  93. ;
  94. QUIT:    MOV    DL,12
  95.     MOV    AH,2
  96.     INT    21H            ; Force page restore
  97.     MOV    DL,DDRV
  98.     MOV    AH,0EH
  99.     INT    21H            ; Restore initial default drive
  100.     TEST    PSX,1
  101.     JZ    NOREST
  102.     MOV    DX,OFFSET RESTR        ; Printer TOF (if needed)
  103.     CALL     DOPRT
  104. NOREST:    MOV    DX,OFFSET RESPRT
  105.     CALL    DOPRT            ; Reset the printer
  106.     INT    20H            ;      and exit
  107. START    ENDP
  108. ;
  109. CODE    ENDS
  110. ;
  111.     END    BEGIN
  112.