home *** CD-ROM | disk | FTP | other *** search
/ Amiga Games 1995 January / amigagames-1995-01.iso / archive / userbox / publicdomain / ged313.lha / Install / data / tools / Source / sprintf.a < prev   
Text File  |  1994-02-09  |  734b  |  38 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.         xdef _myprintf
  12.         xref _LVORawDoFmt
  13.  
  14.         SECTION sprintf,CODE
  15.  
  16. _myprintf:
  17.         movem.l a2/a3/a6,-(sp)
  18.  
  19.         move.l  16(sp),a3
  20.         move.l  20(sp),a0
  21.         lea.l   24(sp),a1
  22.         lea.l   stuffChar(pc),a2
  23.         move.l  4,a6
  24.         jsr     _LVORawDoFmt(a6)
  25.  
  26.         movem.l (sp)+,a2/a3/a6
  27.         move.l  4(sp),d0
  28.         rts
  29.  
  30. ;------ PutChProc function used by RawDoFmt -----------
  31.  
  32. stuffChar:
  33.  
  34.         move.b  d0,(a3)+
  35.         rts
  36.  
  37.         END
  38.