home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol264 / zlib1.lbr / Z3GFNX.Z80 < prev    next >
Encoding:
Text File  |  1986-03-23  |  768 b   |  41 lines

  1. ;
  2. ; Z3LIB Module Name:  Z3GFNX
  3. ; Author:  Richard Conn
  4. ; Z3LIB  Version Number:  1.3
  5. ; Module Version Number:  1.1
  6. ;
  7.     public    getfnx
  8.  
  9.     ext    envptr
  10.  
  11. ;
  12. ;    GETFNX returns the address of the nth filename.typ entry in HL.
  13. ; HL only is affected.  On input, A = 1 to 4 to identify the desired file.
  14. ;
  15. getfnx:
  16.     dec    a        ;check range
  17.     cp    4        ;0 to 3 is valid
  18.     jp    nc,error
  19.     inc    a        ;set offset to 1-4 again
  20.     push    de
  21.     push    af        ;save A
  22.     ld    hl,(envptr)    ;pt to environment
  23.     ld    de,52h        ;pt to file name entry
  24.     add    hl,de
  25.     ld    de,11        ;offset to next name
  26.     pop    af        ;get A
  27. gfnx1:
  28.     dec    a        ;count down
  29.     jp    z,gfnx2
  30.     add    hl,de        ;pt to next
  31.     jp    gfnx1
  32. gfnx2:
  33.     pop    de        ;restore regs
  34.     or    0ffh        ;set NZ for OK
  35.     ret
  36. error:
  37.     xor    a        ;error
  38.     ret
  39.  
  40.     end
  41.