home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Basic / MAXONB32.DMS / in.adf / Includes.lha / BH / BLib / VSPrintf.bas < prev   
Encoding:
BASIC Source File  |  1994-05-12  |  800 b   |  28 lines

  1. ''
  2. '' $Id: VSPrintf.bas,v 1.2 1994/05/12 14:20:53 alex Rel $
  3. ''
  4. '' Amiga.lib (sort-of) style VSPrintf function
  5. ''
  6. '' (c) Copyright 1994 HiSoft
  7. ''
  8.  
  9. 'REM $INCLUDE Exec.bh
  10.  
  11. SUB VSPrintf(BYVAL buffer&, BYVAL fmt&, BYVAL args&)
  12.     STATIC vspfPCP&, vspfJunk&
  13.  
  14.     IF vspfPCP& = 0& THEN
  15.         ' wizardry to stuff a bit of assembler into a static variable;
  16.         ' we need to flush its cached location afterwards
  17.  
  18.         vspfPCP& = &h16c04e75    ' move.b d0,(a3)+; rts
  19.         IF PEEKW(LIBRARY("exec.library") + LibNode + lib_Version) >= 37 THEN
  20.             ' CacheClearE is >= V37 only, without the flush this code will
  21.             ' certainly not work on a 68040 (but does 1.3 work on an '040?)
  22.  
  23.             CacheClearE VARPTR(vspfPCP&), 4, CACRF_ClearI& OR CACRF_ClearD&
  24.         END IF
  25.     END IF
  26.     vspfJunk& = RawDoFmt&(fmt&, args&, VARPTR(vspfPCP&), buffer&)
  27. END SUB
  28.