Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!cbmvax!peter From: peter@cbmvax.commodore.com (Peter Cherna) Newsgroups: comp.sys.amiga.programmer Subject: Re: HELP with RawDoFmt! Message-ID: <18111@cbmvax.commodore.com> Date: 26 Jan 91 01:49:47 GMT References: <1991Jan24.084316.12804@hoss.unl.edu> Reply-To: peter@cbmvax.commodore.com (Peter Cherna) Organization: Commodore, West Chester, PA Lines: 51 In article <1991Jan24.084316.12804@hoss.unl.edu> 231b3678@fergvax.unl.edu (CS 231 section 2) writes: >Could someone please show an example of how to correctly use >RawDoFmt, specifically something similar to > >sprintf(string,"%-22s",fi->fib_FileName); RawDoFmt()'s autodoc contains assembler code for a simple sprintf() that you could then use from C. You can use that as is, if that's what you need, or study it to learn about RawDoFmt(). Here is that code: ; ; Simple version of the C "sprintf" function. Assumes C-style ; stack-based function conventions. ; ; long eyecount; ; eyecount=2; ; sprintf(string,"%s have %ld eyes.","Fish",eyecount); ; ; would produce "Fish have 2 eyes." in the string buffer. ; XDEF _sprintf XREF _AbsExecBase XREF _LVORawDoFmt _sprintf: ; ( ostring, format, {values} ) movem.l a2/a3/a6,-(sp) move.l 4*4(sp),a3 ;Get the output string pointer move.l 5*4(sp),a0 ;Get the FormatString pointer lea.l 6*4(sp),a1 ;Get the pointer to the DataStream lea.l stuffChar(pc),a2 move.l _AbsExecBase,a6 jsr _LVORawDoFmt(a6) movem.l (sp)+,a2/a3/a6 rts ;------ PutChProc function used by RawDoFmt ----------- stuffChar: move.b d0,(a3)+ ;Put data to output string rts >Phil Dietz Peter -- Peter Cherna, Software Engineer, Commodore-Amiga, Inc. {uunet|rutgers}!cbmvax!peter peter@cbmvax.commodore.com My opinions do not necessarily represent the opinions of my employer. "Oh, PIN-compatible! I thought you wanted me to make it IN-compatible!"