home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Creative Computers
/
CreativeComputers.iso
/
shareware
/
text
/
dvi_3.62
/
source
/
dvisrc.lha
/
dvisend.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-26
|
3KB
|
113 lines
#include <stdio.h>
#include <stdarg.h>
#include "dvi.h"
#include "dvihdcp.h"
#ifndef ATARI_ST
void send24(byte huge *addr,int words,int width,int pattern)
{
byte huge *p;
byte buffer[24];
int i; byte the_byte, the_bit;
for (words *= 2; words; words--,addr++)
{
for (p=addr, i=0; i<24; i++, p+=width)
buffer[i] = *p & (byte)pattern;
for (the_bit=128; the_bit; the_bit >>=1)
{
the_byte = 0;
if (buffer[0]&the_bit) the_byte |= 128;
if (buffer[1]&the_bit) the_byte |= 64;
if (buffer[2]&the_bit) the_byte |= 32;
if (buffer[3]&the_bit) the_byte |= 16;
if (buffer[4]&the_bit) the_byte |= 8;
if (buffer[5]&the_bit) the_byte |= 4;
if (buffer[6]&the_bit) the_byte |= 2;
if (buffer[7]&the_bit) the_byte |= 1;
prbyte((int)the_byte);
the_byte = 0;
if (buffer[8]&the_bit) the_byte |= 128;
if (buffer[9]&the_bit) the_byte |= 64;
if (buffer[10]&the_bit) the_byte |= 32;
if (buffer[11]&the_bit) the_byte |= 16;
if (buffer[12]&the_bit) the_byte |= 8;
if (buffer[13]&the_bit) the_byte |= 4;
if (buffer[14]&the_bit) the_byte |= 2;
if (buffer[15]&the_bit) the_byte |= 1;
prbyte((int)the_byte);
the_byte = 0;
if (buffer[16]&the_bit) the_byte |= 128;
if (buffer[17]&the_bit) the_byte |= 64;
if (buffer[18]&the_bit) the_byte |= 32;
if (buffer[19]&the_bit) the_byte |= 16;
if (buffer[20]&the_bit) the_byte |= 8;
if (buffer[21]&the_bit) the_byte |= 4;
if (buffer[22]&the_bit) the_byte |= 2;
if (buffer[23]&the_bit) the_byte |= 1;
prbyte((int)the_byte);
}
}
}
void send8(byte huge *addr,int words,int width,int pattern)
{
byte huge *p;
byte buffer[8];
int i; byte the_byte, the_bit;
for (words *= 2; words; words--,addr++)
{
for (p=addr, i=0; i<8; i++, p+=width)
buffer[i] = *p & (byte)pattern;
for (the_bit=128; the_bit; the_bit >>=1)
{
the_byte = 0;
if (buffer[0]&the_bit) the_byte |= 128;
if (buffer[1]&the_bit) the_byte |= 64;
if (buffer[2]&the_bit) the_byte |= 32;
if (buffer[3]&the_bit) the_byte |= 16;
if (buffer[4]&the_bit) the_byte |= 8;
if (buffer[5]&the_bit) the_byte |= 4;
if (buffer[6]&the_bit) the_byte |= 2;
if (buffer[7]&the_bit) the_byte |= 1;
prbyte((int)the_byte);
}
}
}
#endif
void send48(byte huge *addr,int words,int width,int pattern)
{
byte huge *p;
byte buffer[48];
int i,j;
register byte the_byte, the_bit;
for (words *= 2; words; words--,addr++)
{
for (p=addr, i=0; i<48; i++, p+=width)
buffer[i] = *p & (byte)pattern;
for (the_bit=128; the_bit; the_bit >>=1)
{
register byte *bb = buffer;
for (j=0; j<6; j++)
{
the_byte = 0;
if (*bb++&the_bit) the_byte |= 128;
if (*bb++&the_bit) the_byte |= 64;
if (*bb++&the_bit) the_byte |= 32;
if (*bb++&the_bit) the_byte |= 16;
if (*bb++&the_bit) the_byte |= 8;
if (*bb++&the_bit) the_byte |= 4;
if (*bb++&the_bit) the_byte |= 2;
if (*bb++&the_bit) the_byte |= 1;
prbyte((int)the_byte);
}
}
}
}