home *** CD-ROM | disk | FTP | other *** search
/ ANews 1 / AnewsCD01.iso / Internet / Newsgroup / THOR_2.6 / THOR26_API.LHA / common / SPrintf.asm < prev    next >
Assembly Source File  |  1993-05-13  |  771b  |  37 lines

  1. ;
  2. ; Simple version of the C "sprintf" function.  Assumes C-style
  3. ; stack-based function conventions.
  4. ;
  5. ;   long eyecount;
  6. ;   eyecount=2;
  7. ;   sprintf(string,"%s have %ld eyes.","Fish",eyecount);
  8. ;
  9. ; would produce "Fish have 2 eyes." in the string buffer.
  10. ;
  11.     CSECT    text
  12.  
  13.     XDEF _SPrintf
  14.  
  15. _LVORawDoFmt    EQU    -$20A
  16.  
  17.         
  18. _SPrintf:            ; ( ostring, format, {values} )
  19.     movem.l a2/a3/a6,-(sp)
  20.  
  21.     move.l    4*4(sp),a3       ;Get the output string pointer
  22.     move.l    5*4(sp),a0       ;Get the FormatString pointer
  23.     lea.l    6*4(sp),a1       ;Get the pointer to the DataStream
  24.     lea.l    stuffChar(pc),a2
  25.     move.l    4,a6
  26.     jsr    _LVORawDoFmt(a6)
  27.  
  28.     movem.l (sp)+,a2/a3/a6
  29.     rts
  30.  
  31. ;------ PutChProc function used by RawDoFmt -----------
  32. stuffChar:
  33.     move.b    d0,(a3)+        ;Put data to output string
  34.     rts
  35.  
  36.     END
  37.