Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #include<stdio.h>
  2. #include<stdarg.h>
  3.  
  4. #if (MCOFF_MENUETOS==1)
  5. static int vdprintf_help(unsigned c)
  6. {
  7.  int d0;
  8.  if(c=='\n')
  9.  {
  10.   c='\r';
  11.   __asm__ __volatile__("int $0x40":"=&a"(d0):"0"(63),"b"(1),"c"(c));
  12.   c='\n';
  13.   __asm__ __volatile__("int $0x40":"=&a"(d0):"0"(63),"b"(1),"c"(c));
  14.   return 0;
  15.  }
  16.  __asm__ __volatile__("int $0x40":"=&a"(d0):"0"(63),"b"(1),"c"(c));
  17.  return 0 ;
  18. }
  19.  
  20. static void xputs(char * p)
  21. {
  22.  for(;*p;p++) vdprintf_help((*p)&0xff);
  23. }
  24.  
  25. static char dbg_buf[1024];
  26.  
  27. void dprintf(const char * fmt,...)
  28. {
  29.  va_list ap;
  30.  va_start(ap,fmt);
  31.  vsprintf(dbg_buf,fmt,ap);
  32.  va_end(ap);
  33.  xputs(dbg_buf);
  34. }
  35.  
  36. #else
  37. void dprintf(const char * fmt,...)
  38. {
  39.  va_list ap;
  40.  va_start(ap,fmt);
  41.  vfprintf(stderr,fmt,ap);
  42.  va_end(ap);
  43. }
  44. #endif
  45.