home *** CD-ROM | disk | FTP | other *** search
/ Creative Computers / CreativeComputers.iso / shareware / text / dvi_3.62 / source / dvisrc.lha / dvisend.c < prev    next >
C/C++ Source or Header  |  1993-10-26  |  3KB  |  113 lines

  1. #include <stdio.h>
  2. #include <stdarg.h>
  3. #include "dvi.h"
  4. #include "dvihdcp.h"
  5.  
  6. #ifndef ATARI_ST
  7. void send24(byte huge *addr,int words,int width,int pattern)
  8. {
  9.     byte huge *p;
  10.     byte buffer[24];
  11.     int i; byte the_byte, the_bit;
  12.  
  13.     for (words *= 2; words; words--,addr++)
  14.     {
  15.     for (p=addr, i=0; i<24; i++, p+=width)
  16.         buffer[i] = *p & (byte)pattern;
  17.     for (the_bit=128; the_bit; the_bit >>=1)
  18.     {
  19.         the_byte = 0;
  20.         if (buffer[0]&the_bit) the_byte |= 128;
  21.         if (buffer[1]&the_bit) the_byte |= 64;
  22.         if (buffer[2]&the_bit) the_byte |= 32;
  23.         if (buffer[3]&the_bit) the_byte |= 16;
  24.         if (buffer[4]&the_bit) the_byte |= 8;
  25.         if (buffer[5]&the_bit) the_byte |= 4;
  26.         if (buffer[6]&the_bit) the_byte |= 2;
  27.         if (buffer[7]&the_bit) the_byte |= 1;
  28.         prbyte((int)the_byte);
  29.         the_byte = 0;
  30.         if (buffer[8]&the_bit) the_byte |= 128;
  31.         if (buffer[9]&the_bit) the_byte |= 64;
  32.         if (buffer[10]&the_bit) the_byte |= 32;
  33.         if (buffer[11]&the_bit) the_byte |= 16;
  34.         if (buffer[12]&the_bit) the_byte |= 8;
  35.         if (buffer[13]&the_bit) the_byte |= 4;
  36.         if (buffer[14]&the_bit) the_byte |= 2;
  37.         if (buffer[15]&the_bit) the_byte |= 1;
  38.         prbyte((int)the_byte);
  39.         the_byte = 0;
  40.         if (buffer[16]&the_bit) the_byte |= 128;
  41.         if (buffer[17]&the_bit) the_byte |= 64;
  42.         if (buffer[18]&the_bit) the_byte |= 32;
  43.         if (buffer[19]&the_bit) the_byte |= 16;
  44.         if (buffer[20]&the_bit) the_byte |= 8;
  45.         if (buffer[21]&the_bit) the_byte |= 4;
  46.         if (buffer[22]&the_bit) the_byte |= 2;
  47.         if (buffer[23]&the_bit) the_byte |= 1;
  48.         prbyte((int)the_byte);
  49.     }
  50.     }
  51. }
  52.  
  53. void send8(byte huge *addr,int words,int width,int pattern)
  54. {
  55.     byte huge *p;
  56.     byte buffer[8];
  57.     int i; byte the_byte, the_bit;
  58.  
  59.     for (words *= 2; words; words--,addr++)
  60.     {
  61.     for (p=addr, i=0; i<8; i++, p+=width)
  62.         buffer[i] = *p & (byte)pattern;
  63.     for (the_bit=128; the_bit; the_bit >>=1)
  64.     {
  65.         the_byte = 0;
  66.         if (buffer[0]&the_bit) the_byte |= 128;
  67.         if (buffer[1]&the_bit) the_byte |= 64;
  68.         if (buffer[2]&the_bit) the_byte |= 32;
  69.         if (buffer[3]&the_bit) the_byte |= 16;
  70.         if (buffer[4]&the_bit) the_byte |= 8;
  71.         if (buffer[5]&the_bit) the_byte |= 4;
  72.         if (buffer[6]&the_bit) the_byte |= 2;
  73.         if (buffer[7]&the_bit) the_byte |= 1;
  74.         prbyte((int)the_byte);
  75.     }
  76.     }
  77. }
  78.  
  79. #endif
  80.  
  81. void send48(byte huge *addr,int words,int width,int pattern)
  82. {
  83.     byte huge *p;
  84.     byte buffer[48];
  85.     int i,j;
  86.     register byte the_byte, the_bit;
  87.  
  88.     for (words *= 2; words; words--,addr++)
  89.     {
  90.     for (p=addr, i=0; i<48; i++, p+=width)
  91.         buffer[i] = *p & (byte)pattern;
  92.     for (the_bit=128; the_bit; the_bit >>=1)
  93.     {
  94.         register byte *bb = buffer;
  95.         for (j=0; j<6; j++)
  96.         {
  97.         the_byte = 0;
  98.         if (*bb++&the_bit) the_byte |= 128;
  99.         if (*bb++&the_bit) the_byte |= 64;
  100.         if (*bb++&the_bit) the_byte |= 32;
  101.         if (*bb++&the_bit) the_byte |= 16;
  102.         if (*bb++&the_bit) the_byte |= 8;
  103.         if (*bb++&the_bit) the_byte |= 4;
  104.         if (*bb++&the_bit) the_byte |= 2;
  105.         if (*bb++&the_bit) the_byte |= 1;
  106.         prbyte((int)the_byte);
  107.         }
  108.     }
  109.     }
  110. }
  111.  
  112.  
  113.