home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / assemblr / library / asm_kit / getspec.asm < prev    next >
Assembly Source File  |  1985-06-21  |  1KB  |  46 lines

  1. ;ROUTINE TO GET    FILE SPECIFIER
  2. ;
  3. getspec          proc    far
  4. ;
  5.           push    ds
  6.           push    es
  7.           push    si
  8.           push    di
  9.           push    cx
  10. ;
  11. ;set up    pointer    to get parameters
  12.           lds    si,dta      ;point to dta    for parameters
  13.           mov    cl,[si]      ;get length of string
  14.           mov    ch,0      ;make    16-bit
  15.           inc    si      ;skip    the length byte
  16. ;scan past the spaces
  17.           mov    al,' '      ;skip    spaces
  18. getspec1:     cmp    [si],al      ;check for space
  19.           jne    getspec2  ;exit    the loop if nonsapce
  20.           inc    si      ;otherwise point to next byte
  21.           loop    getspec1  ;loop    back for more
  22.           jcxz    getspec3  ;no file specifier?
  23. ;
  24. ;move the rest into place
  25. getspec2:
  26.           mov    di,dx      ;index points    to destination
  27.           cld          ;forward direction
  28.           rep    movsb      ;make    the transfer
  29.           clc          ;no error so no carry
  30.           jmp    getspecexit ; and return
  31. ;
  32. getspec3:
  33.           mov    ax,20      ;no file specified
  34.           stc          ;set carry for error
  35.           jmp    getspecexit  ;and exit
  36. ;
  37. getspecexit:
  38.           pop    cx      ;save    registers
  39.           pop    di
  40.           pop    si
  41.           pop    es
  42.           pop    ds
  43.           ret
  44. ;
  45. getspec          end
  46.