home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / MAKEFREQ.ZIP / MAKEFREQ.8 < prev    next >
Encoding:
Text File  |  1993-08-09  |  4.4 KB  |  101 lines

  1. ; This is the ASM source code to MAKEFREQ, written by Chad Robinson on 8/9/93
  2. ; This is MAKEFREQ version 1.0 - the public release version
  3. ;
  4. ; This file is designed to be assembled with the A86 shareware assembler
  5.  
  6.  
  7. jmp     start
  8.  
  9. hellomsg        db      0FEh, ' MAKEFREQ, Written by Chad Robinson'
  10.                 db      ' on 8/9/93.  Public Domain.'
  11.                 db      0Dh, 0Ah, '$'
  12. pathfile        db      'FILEPATH.EZY', 0       ; Where to find the pathnames
  13. inhandle        dw      ?                       ; For filepath.ezy's handle
  14. freqfile        db      'FREQ.DIR', 0           ; Output filename
  15. outhandle       dw      ?                       ; For output filename's handle
  16.  
  17. notfound        db      0FEh, ' Cannot find FILEPATH.EZY', 0Dh, 0Ah
  18.                 db      0FEh, ' Exiting with Errorlevel 1', 0Dh, 0Ah, '$'
  19.  
  20.  
  21. ; Structure length: 79 bytes
  22. pathlen         db      ?                       ; Length of pathname
  23. filepath        db      60 dup (?)              ; Actual pathname
  24. security        dw      ?                       ; Security to DL from area
  25. flags           dd      ?                       ; Flags as above (1 byte/flag)
  26. ularea          dw      ?                       ; Upload area template
  27. pword           db      9 dup (?)               ; Password to access area
  28. attr            db      ?                       ; Attribute for area
  29. crlf            db      0Dh, 0Ah
  30.  
  31. start:          mov     ah, 09h
  32.                 mov     dx, offset hellomsg
  33.                 int     21h
  34.  
  35.                 mov     ah, 41h                 ; Delete output file so write-
  36.                 mov     dx, offset freqfile     ; over errors don't occur
  37.                 int     21h
  38.  
  39.                 mov     ax, 3D00h               ; Open file for READ ONLY
  40.                 mov     dx, offset pathfile     ; file to open is FILEPATH.EZY
  41.                 int     21h
  42.                 mov     inhandle, ax            ; Store file handle in inhandle
  43.                 jnc     keepon                  ; no errors occurred
  44.  
  45.                 mov     ah, 09h
  46.                 mov     dx, offset notfound     ; Display 'file not found'
  47.                 int     21h                     ; message
  48.                 mov     ax, 4C01h               ; Errorlevel 1 = FNF
  49.                 int     21h
  50.  
  51. keepon:         mov     ah, 3Ch
  52.                 mov     dx, offset freqfile
  53.                 mov     cx, 00100000b
  54.                 int     21h
  55.                 mov     ax, 3D01h               ; Open file for READ ONLY
  56.                 mov     dx, offset freqfile     ; file to open is FILEPATH.EZY
  57.                 int     21h
  58.                 mov     outhandle, ax           ; Store handle in outhandle
  59.  
  60. fileloop:       mov     ah, 3Fh                 ; Read in 79 bytes = 1 record
  61.                 mov     bx, inhandle            ; from FILEPATH.EZY
  62.                 mov     cx, 79                  ;
  63.                 mov     dx, offset pathlen      ;
  64.                 int     21h
  65.                 cmp     ax, 0000h               ; If 0, end of file was reached
  66.                 jne     floop1
  67.                 jmp     theend
  68.  
  69. floop1:         mov     al, attr                ; Check attribute byte
  70.                 and     al, 2                   ; Is it FNF or not enough sec?
  71.                 jz      fileloop                ; No security = skip area
  72.                 mov     cl, pathlen
  73.                 cmp     cl, 00h
  74.                 jne     okaycont
  75.                 jmp     fileloop
  76.  
  77. okaycont:       mov     ah, 40h
  78.                 mov     bx, outhandle
  79.                 xor     ch, ch
  80.                 mov     cl, pathlen             ; bytes to write = lengh of
  81.                 mov     dx, offset filepath
  82.                 int     21h                     ; pathstring
  83.                 mov     ah, 40h
  84.                 mov     bx, outhandle
  85.                 mov     dx, offset crlf         ; add a CR+LF to the end
  86.                 xor     ch, ch
  87.                 mov     cl, 2                   ; bytes to write = lengh of
  88.                 int     21h                     ; pathstring
  89.  
  90.                 jmp fileloop
  91.  
  92. theend:         mov     ah, 3Eh                 ; Close the output file
  93.                 mov     bx, outhandle
  94.                 int     21h
  95.                 mov     ah, 3Eh
  96.                 mov     bx, inhandle            ; Close the input file
  97.                 int     21h
  98.                 mov     ax, 4C00h               ; Program successful
  99.                 int     21h
  100.  
  101.