home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / modem / byepc300.arc / BYEXLIB.ARC / GETNAME.ASM < prev    next >
Assembly Source File  |  1987-10-26  |  2KB  |  58 lines

  1.            INCLUDE MODEL.INC
  2. ;
  3. ;---------------------------------------------------------------------------
  4. ;   Function:    void _bye_getname(s)
  5. ;
  6. ;   Parms:    int *s;  -> ptr to string buffer
  7. ;
  8. ;   Purpose:    This function returns a null terminated string up
  9. ;        to 64 characters in length. The string contains the
  10. ;        callers name currently on line set from a previous
  11. ;        call by '_bye_setname()'.
  12. ;
  13. ;   Return:    void
  14. ;---------------------------------------------------------------------------
  15. ;
  16.            PUBLIC __bye_getname
  17.  
  18. __bye_getname  PROC
  19.  
  20.            push bp            ;standard 'C' function entry
  21.            mov  bp,sp
  22.            push di
  23.            push si
  24.            push ds
  25.            push es
  26.  
  27.          IF @datasize
  28.            les  di,ARG1        ;ES:DI = ptr string dest
  29.          ELSE
  30.            mov  di,ARG1        ;DI = near ptr to string dest
  31.          ENDIF
  32.  
  33.            push es            ;save ES
  34.            mov  ah,21        ;AH=21 for get name ptr
  35.            int  BYE_VECT        ;ES:BX = far ptr to name buffer
  36.            mov  si,bx
  37.            mov  ax,es
  38.            mov  ds,ax        ;DS:SI = far ptr to source
  39.            pop  es            ;restore ES
  40.  
  41.            cld            ;clear direction flag
  42. getn_loop:     lodsb            ;read a byte from source DS:SI
  43.            stosb            ;store a byte at ES:DI
  44.            cmp  al,0        ;end of string yet?
  45.            jne  SHORT getn_loop    ;no, loop back again
  46.  
  47. getn_end:      pop  es
  48.            pop  ds
  49.            pop  si
  50.            pop  di
  51.            mov  sp,bp        ;standard 'C' exit
  52.            pop  bp
  53.            ret
  54.  
  55. __bye_getname  ENDP
  56.            END
  57.  
  58.