home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / directry / mv / putn.asm < prev    next >
Encoding:
Assembly Source File  |  1994-06-05  |  1.6 KB  |  53 lines

  1. ;  8-Sep-86 16:23:36-PDT,1153;000000000000
  2. ;  Return-Path: <pwu@unix.macc.wisc.edu>
  3. ;  Received: FROM UNIX.MACC.WISC.EDU BY B.ISI.EDU WITH TCP ; 8 Sep 86 16:19:27 PDT
  4. ;  Received: by unix.macc.wisc.edu;
  5. ;            id AA04992; 4.12/5; Mon, 8 Sep 86 17:32:20 cdt
  6. ;  Date: Mon, 8 Sep 86 17:32:20 cdt
  7. ;  From: Peter Wu <pwu@unix.macc.wisc.edu>
  8. ;  Message-Id: <8609082232.AA04992@unix.macc.wisc.edu>
  9. ;  To: info-ibmpc-request@mosis
  10. ;  Subject: putn.asm
  11. ;
  12. ; allows C program to call cputs with multiple arguments.
  13. ; E.g. putn("How ", "are ", "you?", 0);
  14. ; the last argument must be either 0 or ""
  15.  
  16. _text   segment public byte 'code'
  17.         assume cs:_text
  18.  
  19.         extrn   _cputs:near
  20.  
  21.         public  _putn
  22. _putn   proc    near
  23.         push    si
  24.         push    di
  25.         push    bp
  26.         mov     bp,sp
  27.  
  28.         mov     si,8
  29. loop:
  30.         mov     di,[bp+si]      ; get next string
  31.         or      di,di           ; is it NULL
  32.         je      done            ; if so, nothing more to print
  33.         or      byte ptr [di],0 ; it is "" (null string)
  34.         je      done            ; if so, nothing more to print
  35.  
  36. ; now call cputs to print the string
  37.         push    di              ; push parameter on stack
  38.         call    _cputs
  39.         pop     di              ; get rid of parameter on stack
  40.  
  41.         add     si,2            ; point to next parameter
  42.         jmp     loop
  43.  
  44. done:
  45.         pop     bp
  46.         pop     di
  47.         pop     si
  48.         ret
  49. _putn   endp
  50. _text   ends
  51.         end
  52. ; -----------------------------------------------------------------------
  53.