home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / JSAGE / ZSUS / PROGPACK / PARMLIB1.LBR / PPARGET.ZZ0 / PPARGET.Z8°
Text File  |  1989-07-10  |  1KB  |  51 lines

  1.  
  2. ; Library:    PARMLIB
  3. ; Version:    1.0
  4. ; Module:    PARGET
  5. ; Version:    1.0
  6. ; Author:    Carson Wilson
  7. ; Date:        July 10, 1989
  8. ; Purpose:    Gets pointer to CP/M command line parameter #A.
  9. ;
  10.  
  11.     public    parget
  12.  
  13.     extrn    parcnt        ; PARMLIB
  14.     extrn    sksp, sknsp    ; SYSLIB
  15.  
  16. cpmcmd    equ    80h        ; CP/M command line location
  17.  
  18. ;
  19. ; PARGET - Gets pointer to CP/M command line parameter #A.
  20. ;
  21. ;    Entry:    - <A> holds number of desired parameter.
  22. ;    Exit:    <F>  - NZ if parameter found, Z if not found.
  23. ;        <A>  - holds first character of parameter, or 00 if not found.
  24. ;        <HL> - points to parameter #A, if found.
  25. ;    Uses:    - <AF>, <HL>.
  26. ;
  27. parget:
  28.     push    bc
  29.  
  30.     or    a            ; Just in case 
  31.     ret    z
  32.     ld    b,a            ; Save
  33.     call    parcnt            ; See how many parameters
  34.     cp    b
  35.     ld    a,0            ; For error exit
  36.     jr    c,pargex        ; A-th parameter does not exist
  37.     ld    hl,cpmcmd+1        ; Always a space if parameters
  38. pargt1:
  39.     call    sknsp
  40.     call    sksp            ; Point to next parm.
  41.     djnz    pargt1
  42.     ld    a,(hl)            ; 1st char.
  43. pargex:
  44.     or    a            ; Set Z flag
  45.     pop    bc
  46.     ret
  47.  
  48.     end
  49.  
  50. ; End PARGET.Z80
  51.