   incdir include_i:
   include lvos.i

   ;
   ; Simple version of the C "sprintf" function.  Assumes C-style
   ; stack-based function conventions.
   ;



_sprintf:   ; ( ostring, format, {values} )

   lea dosname(pc),a1
   moveq.l #0,d0
   movea.l 4.w,a6
    jsr _LVOOpenLibrary(a6)
   move.l d0,dosbase
   move.l #65535,d3
cicle:
   lea   string(pc),a3       ;Get the output string pointer
   lea   format(pc),a0       ;Get the FormatString pointer
   lea datastream(pc),a1       ;Get the pointer to the DataStream
   lea.l stuffChar(pc),a2
   movea.l   4.w,a6
   jsr   _LVORawDoFmt(a6)

   dbf d3,cicle


   move.l dosbase(pc),a6
   move.l #string,d1
    jsr _LVOPutStr(a6)



   movea.l 4.w,a6
   movea.l dosbase(pc),a1
    jsr _LVOCloseLibrary(a6)

   rts

   ;------ PutChProc function used by RawDoFmt -----------
stuffChar:
   move.b   d0,(a3)+        ;Put data to output string
   rts

dosname: dc.b "dos.library",0
 cnop 0,4
dosbase: ds.l 1
string: ds.l 64
format: dc.b ":-\t...%s you have %07lD eyes and 0x%lx heads!\n",0
 cnop 0,4
datastream:  dc.l stringa
             dc.l 12345
             dc.l 76

stringa: dc.b  "Sante",0
