home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1997 #3 / amigamamagazinepolishissue03-1 / polski_aminet / michal_letowski / debuglib / src / kdofmt.a < prev    next >
Text File  |  1996-05-11  |  2KB  |  76 lines

  1. ;    kdofmt.a - KDoFmt implementation using ROM routines
  2. ;    $VER: kdofmt.a 37.1 (10.5.96)
  3. ;    Copyright © 1996 Michael Letowski
  4. ;
  5. ;    37.1 (10.5.96) - initial version
  6.  
  7.     include    "exec/funcdef.i"
  8.     include    "exec/exec_lib.i"
  9.  
  10.     xdef    _KDoFmt
  11.     xdef    @KDoFmt
  12.  
  13. ; Some aliases
  14.  
  15.     xdef    KDoFmt
  16.  
  17.     section    text,code
  18.  
  19.  
  20. ******* debug.lib/KDoFmt ****************************************************
  21. *
  22. *   NAME
  23. *       KDoFmt -- format data into a character stream. (V37)
  24. *
  25. *   SYNOPSIS
  26. *       nextData = KDoFmt(formatString, dataStream, putChProc, putChData)
  27. *       D0                A0            A1          A2         A3
  28. *
  29. *       APTR KDoFmt(STRPTR, STRPTR, void (*)(), APTR);
  30. *
  31. *   FUNCTION
  32. *       Interface to ROM RawDoFmt() function.
  33. *
  34. *   INPUTS
  35. *       formatString - "C"-language-like NULL terminated format string.
  36. *       dataStream   - stream of data to be interpreted.
  37. *       putChProc    - the procedure to call with each character to be
  38. *                      output.
  39. *       putChData    - the value that is passed through to the putChProc
  40. *                      procedure.
  41. *
  42. *   RESULT
  43. *       nextData - pointer to end of the data stream (the next argument that
  44. *                  would have been processed).
  45. *
  46. *   NOTES
  47. *       @KDoFmt, KDoFmt are identical assembly interfaces that want pointers
  48. *       in registers. _KDoFmt is a C interface that expects the parameters
  49. *       on the stack.
  50. *
  51. *   SEE ALSO
  52. *       exec.library/RawDoFmt().
  53. *
  54. *****************************************************************************
  55. *
  56. * _KDoFmt(formatString, dataString, putProc, procData)
  57. * @KDoFmt(R_A0 format, R_A1 data, R_A2 putProc, R_A3 procData)
  58. *
  59.  
  60. _KDoFmt:
  61.     movem.l    a2-a3/a6,-(sp)        ; Save registers on stack
  62.     movem.l    4*4(sp),a0-a3        ; Load registers with stack parameters
  63.     bra    ParamsLoaded        ; Go with register parameters
  64.  
  65. @KDoFmt:
  66. KDoFmt:
  67.     movem.l    a2-a3/a6,-(sp)        ; Save registers on stack
  68.  
  69. ParamsLoaded:
  70.     move.l    (4).w,a6        ; Load a6 with SysBase
  71.     jsr    _LVORawDoFmt(a6)    ; Jump to ROM
  72.     movem.l    (sp)+,a2-a3/a6        ; Restore registers from stack
  73.     rts                ; Done
  74.  
  75.     end
  76.