Subversion Repositories pentevo

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed | ?url?

  1. #include "_global.h"
  2. #include "_uart.h"
  3. #include "_screen.h"
  4.  
  5. //-----------------------------------------------------------------------------
  6.  
  7. void put_char(u8 ch)
  8. {
  9.  if (flags1&ENABLE_DIRECTUART) directuart_putchar(ch);
  10.  if (flags1&ENABLE_UART) uart_putchar(ch);
  11.  if (flags1&ENABLE_SCR) scr_putchar(ch);
  12. }
  13.  
  14. //-----------------------------------------------------------------------------
  15.  
  16. void print_hexhalf(u8 b)
  17. {
  18.  b&=0x0f;
  19.  if (b>9) b+=7;
  20.  b+=0x30;
  21.  put_char(b);
  22. }
  23.  
  24. //-----------------------------------------------------------------------------
  25.  
  26. void print_hexbyte(u8 b)
  27. {
  28.  print_hexhalf(b>>4);
  29.  print_hexhalf(b);
  30. }
  31.  
  32. //-----------------------------------------------------------------------------
  33.  
  34. void print_hexbyte_for_dump(u8 b)
  35. {
  36.  print_hexbyte(b);
  37.  put_char(0x20);
  38. }
  39.  
  40. //-----------------------------------------------------------------------------
  41.  
  42. void print_hexlong(u32 l)
  43. {
  44.  print_hexbyte((u8)(l>>24));
  45.  print_hexbyte((u8)(l>>16));
  46.  print_hexbyte((u8)(l>>8));
  47.  print_hexbyte((u8)l);
  48. }
  49.  
  50. //-----------------------------------------------------------------------------
  51.  
  52. void put_char_for_dump(u8 ch)
  53. {
  54.  if (ch<0x20) put_char('.'); else put_char(ch);
  55. }
  56.  
  57. //-----------------------------------------------------------------------------
  58.  
  59. void print_dec99(u8 b)
  60. {
  61.  asm volatile("\tsubi %0,208\n"\
  62.               "\tsbrs %0,7\n"\
  63.               "\tsubi %0,48\n"\
  64.               "\tsubi %0,232\n"\
  65.               "\tsbrs %0,6\n"\
  66.               "\tsubi %0,24\n"\
  67.               "\tsubi %0,244\n"\
  68.               "\tsbrs %0,5\n"\
  69.               "\tsubi %0,12\n"\
  70.               "\tsubi %0,250\n"\
  71.               "\tsbrs %0,4\n"\
  72.               "\tsubi %0,6\n"\
  73.               :"=d"(b):"d"(b) );
  74.  print_hexbyte(b);
  75. }
  76.  
  77. //-----------------------------------------------------------------------------
  78.  
  79. const u16 decwtab[4] PROGMEM = {10000,1000,100,10};
  80.  
  81. void print_dec16(u16 w)
  82. {
  83.  u8 i, f;
  84.  i=0; f=0;
  85.  do
  86.  {
  87.   u16 k;
  88.   k=pgm_read_word(&decwtab[i]);
  89.   u8 x;
  90.   x=0;
  91.   while (w>=k)
  92.   {
  93.    w-=k;
  94.    x++;
  95.   }
  96.   if ( (x==0) && (f==0) )
  97.    put_char(' ');
  98.   else
  99.   {
  100.    f=1;
  101.    x|=0x30;
  102.    put_char(x);
  103.   }
  104.   i++;
  105.  }while (i<4);
  106.  i=(u8)w;
  107.  i|=0x30;
  108.  put_char(i);
  109. }
  110.  
  111. //-----------------------------------------------------------------------------
  112.  
  113. void print_msg(PGM_U8_P msg)
  114. {
  115.  u8 ch;
  116.  do
  117.  {
  118.   ch=pgm_read_byte(msg);
  119.   msg++;
  120.   if (ch) put_char(ch);
  121.  }while (ch);
  122. }
  123.  
  124. //-----------------------------------------------------------------------------
  125.  
  126. void print_mlmsg(PGM_U8_P *mlmsg)
  127. {
  128.  print_msg((PGM_U8_P)pgm_read_word(mlmsg+lang));
  129. }
  130.  
  131. //-----------------------------------------------------------------------------
  132.  
  133. void print_short_vers(void)
  134. {
  135.  u16 vers;
  136.  vers=pgm_read_word_far(0x1dffc);
  137.  u8 day;
  138.  day=vers&0x1f;
  139.  if (day)
  140.  {
  141.   u8 month, year;
  142.   month=(vers>>5)&0x0f;
  143.   year=(vers>>9)&0x3f;
  144.   if ( (month) && (month<13) && (year>10) )
  145.   {
  146.    put_char('(');
  147.    print_dec99(year);
  148.    print_dec99(month);
  149.    print_dec99(day);
  150.    put_char(')');
  151.   }
  152.  }
  153. }
  154.  
  155. //-----------------------------------------------------------------------------
  156.