unsigned char asc2ebc[256] = {
  0,  1,  2,  3, 55, 45, 46, 47,
 22,  5, 37, 11, 12, 13, 14, 15,
 16, 17, 18, 19, 60, 61, 50, 38,
 24, 25, 63, 39, 28, 29, 30, 31,
 64, 79,127,123, 91,108, 80,125,
 77, 93, 92, 78,107, 96, 75, 97,
240,241,242,243,244,245,246,247,
248,249,122, 94, 76,126,110,111,
124,193,194,195,196,197,198,199,
200,201,209,210,211,212,213,214,
215,216,217,226,227,228,229,230,
231,232,233, 74,224, 90, 95,109,
121,129,130,131,132,133,134,135,
136,137,145,146,147,148,149,150,
151,152,153,162,163,164,165,166,
167,168,169,192,106,208,161,  7,
 63, 63, 63, 63, 63, 63, 63, 63,
 63, 63, 63, 63, 63, 63, 63, 63,
 63, 63, 63, 63, 63, 63, 63, 63,
 63, 63, 63, 63, 63, 63, 63, 63,
 63, 63, 63, 63, 63, 63, 63, 63,
 63, 63, 63, 63, 63, 63, 63, 63,
 63, 63, 63, 63, 63, 63, 63, 63,
 63, 63, 63, 63, 63, 63, 63, 63,
 63, 63, 63, 63, 63, 63, 63, 63,
 63, 63, 63, 63, 63, 63, 63, 63,
 63, 63, 63, 63, 63, 63, 63, 63,
 63, 63, 63, 63, 63, 63, 63, 63,
 63, 63, 63, 63, 63, 63, 63, 63,
 63, 63, 63, 63, 63, 63, 63, 63,
 63, 63, 63, 63, 63, 63, 63, 63,
 63, 63, 63, 63, 63, 63, 63,255};

unsigned char ebc2asc[256] = {
  0,  1,  2,  3, 92,  9, 92,127,
 92, 92, 92, 11, 12, 13, 14, 15,
 16, 17, 18, 19, 92, 92,  8, 92,
 24, 25, 92, 92, 28, 29, 30, 31,
 92, 92, 92, 92, 92, 10, 23, 27,
 92, 92, 92, 92, 92,  5,  6,  7,
 92, 92, 22, 92, 92, 92, 92,  4,
 92, 92, 92, 92, 20, 21, 92, 26,
 32, 92, 92, 92, 92, 92, 92, 92,
 92, 92, 91, 46, 60, 40, 43, 33,
 38, 92, 92, 92, 92, 92, 92, 92,
 92, 92, 93, 36, 42, 41, 59, 94,
 45, 47, 92, 92, 92, 92, 92, 92,
 92, 92,124, 44, 37, 95, 62, 63,
 92, 92, 92, 92, 92, 92, 92, 92,
 92, 96, 58, 35, 64, 39, 61, 34,
 92, 97, 98, 99,100,101,102,103,
104,105, 92, 92, 92, 92, 92, 92,
 92,106,107,108,109,110,111,112,
113,114, 92, 92, 92, 92, 92, 92,
 92,126,115,116,117,118,119,120,
121,122, 92, 92, 92, 92, 92, 92,
 92, 92, 92, 92, 92, 92, 92, 92,
 92, 92, 92, 92, 92, 92, 92, 92,
123, 65, 66, 67, 68, 69, 70, 71,
 72, 73, 92, 92, 92, 92, 92, 92,
125, 74, 75, 76, 77, 78, 79, 80,
 81, 82, 92, 92, 92, 92, 92, 92,
 92, 92, 83, 84, 85, 86, 87, 88,
 89, 90, 92, 92, 92, 92, 92, 92,
 48, 49, 50, 51, 52, 53, 54, 55,
 56, 57, 92, 92, 92, 92, 92,255};

void cvt_asc2ebc(unsigned char *ebc,unsigned char *asc)
{
   unsigned char *e,*a;
   e = ebc;
   a = asc;
   while(*a) {
      *e = asc2ebc[*a];
      e++; a++;
   }
   *e = *a;
   return;
}

void cvt_ebc2asc(unsigned char *asc,unsigned char *ebc)
{
   unsigned char *a,*e;
   a = asc;
   e = ebc;
   while(*e) {
      *a = ebc2asc[*e];
      a++; e++;
   }
   *a = *e;
   return;
}
