home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 March
/
VPR9703A.ISO
/
VPR_DATA
/
DOGA
/
SOURCES
/
REND.LZH
/
REND
/
CRT98.C
< prev
next >
Wrap
C/C++ Source or Header
|
1996-04-22
|
19KB
|
841 lines
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include "reader.h"
#include "glib.h"
#include "rend.h"
static void graph_cls(void);
#ifdef __GNUC__
#define GRAPH_ADDRESS_B (0xe00a8000)
#define GRAPH_ADDRESS_R (0xe00b0000)
#define GRAPH_ADDRESS_G (0xe00b8000)
#define GRAPH_ADDRESS_I (0xe00e0000)
#else
#define GRAPH_ADDRESS_B (0xa8000000)
#define GRAPH_ADDRESS_R (0xb0000000)
#define GRAPH_ADDRESS_G (0xb8000000)
#define GRAPH_ADDRESS_I (0xe0000000)
#endif
#ifdef __GNUC__
#include <pc.h>
#else
#include <conio.h>
#define outportb(port,value) outp(port,value)
#endif
static short paletdata[16];
#ifdef __GNUC__
#define far
static unsigned int longleftedge[32] = {
0xffffffff, 0xffffff7f, 0xffffff3f, 0xffffff1f,
0xffffff0f, 0xffffff07, 0xffffff03, 0xffffff01,
0xffffff00, 0xffff7f00, 0xffff3f00, 0xffff1f00,
0xffff0f00, 0xffff0700, 0xffff0300, 0xffff0100,
0xffff0000, 0xff7f0000, 0xff3f0000, 0xff1f0000,
0xff0f0000, 0xff070000, 0xff030000, 0xff010000,
0xff000000, 0x7f000000, 0x3f000000, 0x1f000000,
0x0f000000, 0x07000000, 0x03000000, 0x01000000,
};
static unsigned int longrightedge[32] = {
0x00000080, 0x000000c0, 0x000000e0, 0x000000f0,
0x000000f8, 0x000000fc, 0x000000fe, 0x000000ff,
0x000080ff, 0x0000c0ff, 0x0000e0ff, 0x0000f0ff,
0x0000f8ff, 0x0000fcff, 0x0000feff, 0x0000ffff,
0x0080ffff, 0x00c0ffff, 0x00e0ffff, 0x00f0ffff,
0x00f8ffff, 0x00fcffff, 0x00feffff, 0x00ffffff,
0x80ffffff, 0xc0ffffff, 0xe0ffffff, 0xf0ffffff,
0xf8ffffff, 0xfcffffff, 0xfeffffff, 0xffffffff,
};
#endif
static unsigned char charleftedge[8] = {
0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01
};
static unsigned char charrightedge[8] = {
0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff
};
static void graph_line_1(int x1, int y1, int x2, int y2, int color)
{
int temp;
int i;
int offset;
int data;
unsigned char *gram = (unsigned char *)GRAPH_ADDRESS_B;
if (y1 > y2) {
temp = y1; y1 = y2; y2 = temp;
}
gram += offset = y1 * 80 + x1 / 8;
data = 0x80 >> (x1 % 8);
for (i = y2 - y1 + 1; i > 0; --i) {
*gram = data;
gram += 80;
}
}
static void graph_line_2(int x1, int y1, int x2, int y2, int color)
{
int i;
int offset;
int data;
int diff;
int plus, minus;
unsigned char *gram = (unsigned char *)GRAPH_ADDRESS_B;
plus = (y1 - y2) * 2;
minus = (x2 - x1) * 2;
diff = plus / 2;
gram += offset = y1 * 80 + x1 / 8;
data = 0x80 >> (x1 % 8);
for (i = y1 - y2 + 1; i > 0; --i) {
*gram = data;
gram -= 80;
if ((diff -= minus) < 0) {
if ((data >>= 1) == 0) {
data = 0x80;
gram++;
}
diff += plus;
}
}
}
static void graph_line_3(int x1, int y1, int x2, int y2, int color)
{
int i;
int offset;
int data;
unsigned char *gram = (unsigned char *)GRAPH_ADDRESS_B;
gram += offset = y1 * 80 + x1 / 8;
data = 0x80 >> (x1 % 8);
for (i = y1 - y2 + 1; i > 0; --i) {
*gram = data;
gram -= 80;
if ((data >>= 1) == 0) {
data = 0x80;
gram++;
}
}
}
static void graph_line_4(int x1, int y1, int x2, int y2, int color)
{
int i;
int offset;
int diff;
int plus, minus;
int start, end;
unsigned char *gram = (unsigned char *)GRAPH_ADDRESS_B;
plus = (x2 - x1) * 2;
minus = (y1 - y2) * 2;
diff = plus / 2;
gram += offset = y1 * 80 + x1 / 8;
start = end = x1 % 8;
for (i = x2 - x1 + 1; i > 0; --i) {
end++;
if ((diff -= minus) < 0) {
*gram = charleftedge[start] & charrightedge[(end-1)];
gram -= 80;
if (end == 8) {
gram++;
end = 0;
}
start = end;
diff += plus;
} else if (end == 8) {
*gram++ = charleftedge[start];
start = end = 0;
}
}
if (end != 0) {
*gram = charleftedge[start] & charrightedge[end-1];
}
}
static void graph_line_5(int x1, int y1, int x2, int y2, int color)
{
int i;
int offset1, offset2;
#ifdef __GNUC__
unsigned int *gram = (unsigned int *)GRAPH_ADDRESS_B;
offset1 = y1 * 20 + x1 / 32;
offset2 = y1 * 20 + x2 / 32;
gram += offset1;
if (offset1 == offset2) {
*gram = longleftedge[x1%32] & longrightedge[x2%32];
} else if (offset2 == offset1 + 1) {
*gram++ = longleftedge[x1%32];
*gram = longrightedge[x2%32];
} else {
*gram++ = longleftedge[x1%32];
for (i = offset2 - offset1 - 1;i > 0; --i) {
*gram++ = 0xffffffff;
}
*gram = longrightedge[x2%32];
}
#else
unsigned char far *gram = (unsigned char far *)GRAPH_ADDRESS_B;
offset1 = y1 * 80 + x1 / 8;
offset2 = y1 * 80 + x2 / 8;
gram += offset1;
if (offset1 == offset2) {
*gram = charleftedge[x1%8] & charrightedge[x2%8];
} else if (offset2 == offset1 + 1) {
*gram++ = charleftedge[x1%8];
*gram = charrightedge[x2%8];
} else {
*gram++ = charleftedge[x1%8];
for (i = offset2 - offset1 - 1;i > 0; --i) {
*gram++ = 0xff;
}
*gram = charrightedge[x2%8];
}
#endif
}
static void graph_line_6(int x1, int y1, int x2, int y2, int color)
{
int i;
int offset;
int diff;
int plus, minus;
int start, end;
unsigned char *gram = (unsigned char *)GRAPH_ADDRESS_B;
plus = (x2 - x1) * 2;
minus = (y2 - y1) * 2;
diff = plus / 2;
gram += offset = y1 * 80 + x1 / 8;
start = end = x1 % 8;
for (i = x2 - x1 + 1; i > 0; --i) {
end++;
if ((diff -= minus) < 0) {
*gram = charleftedge[start] & charrightedge[(end-1)];
gram += 80;
start = end;
diff += plus;
if (end == 8) {
gram++;
start = end = 0;
}
} else if (end == 8) {
*gram++ = charleftedge[start];
start = end = 0;
}
}
if (end != 0) {
*gram = charleftedge[start] & charrightedge[end-1];
}
}
static void graph_line_7(int x1, int y1, int x2, int y2, int color)
{
int i;
int offset;
int data;
unsigned char *gram = (unsigned char *)GRAPH_ADDRESS_B;
gram += offset = y1 * 80 + x1 / 8;
data = 0x80 >> (x1 % 8);
for (i = y2 - y1 + 1; i > 0; --i) {
*gram = data;
gram += 80;
if ((data >>= 1) == 0) {
data = 0x80;
gram++;
}
}
}
static void graph_line_8(int x1, int y1, int x2, int y2, int color)
{
int i;
int offset;
int data;
int diff;
int plus, minus;
unsigned char *gram = (unsigned char *)GRAPH_ADDRESS_B;
plus = (y2 - y1) * 2;
minus = (x2 - x1) * 2;
diff = plus / 2;
gram += offset = y1 * 80 + x1 / 8;
data = 0x80 >> (x1 % 8);
for (i = y2 - y1 + 1; i > 0; --i) {
*gram = data;
gram += 80;
if ((diff -= minus) < 0) {
if ((data >>= 1) == 0) {
data = 0x80;
gram++;
}
diff += plus;
}
}
}
void graph_line(int x1, int y1, int x2, int y2, int color)
{
int temp;
if (y1 > y2) {
temp = x1; x1 = x2; x2 = temp;
temp = y1; y1 = y2; y2 = temp;
}
if (y2 < 0 || y1 > 399) {
return;
}
if (y1 < 0) {
x1 = (x1 * y2 - x2 * y1) / (y2 - y1);
y1 = 0;
}
if (y2 > 399) {
x2 = (x2 - x1) * (399 - y1) / (y2 - y1) + x1;
y2 = 399;
}
if (x1 > x2) {
temp = x1; x1 = x2; x2 = temp;
temp = y1; y1 = y2; y2 = temp;
}
if (x2 < 0 || x1 > 639) {
return;
}
if (x1 < 0) {
y1 = (y1 * x2 - y2 * x1) / (x2 - x1);
x1 = 0;
}
if (x2 > 639) {
y2 = (y2 - y1) * (639 - x1) / (x2 - x1) + y1;
x2 = 639;
}
/*
1 2 3
| /
| / 4
|/
.---5
\
\ 6
\
9 8 7
*/
outportb(0x7c, 0xc8);
#ifdef __GNUC__
outportb(0x7e, (color & 1) ? 0xff : 0);
outportb(0x7e, (color & 2) ? 0xff : 0);
outportb(0x7e, (color & 4) ? 0xff : 0);
#else
outportb(0x7e, (color & 1) ? 0 : 0xff);
outportb(0x7e, (color & 2) ? 0 : 0xff);
outportb(0x7e, (color & 4) ? 0 : 0xff);
#endif
if (x1 == x2) {
graph_line_1(x1, y1, x2, y2, color);
} else if (y1 == y2) {
graph_line_5(x1, y1, x2, y2, color);
} else if (y2 < y1) {
if (y1 - y2 > x2 - x1) {
graph_line_2(x1, y1, x2, y2, color);
} else if (y1 - y2 == x2 - x1) {
graph_line_3(x1, y1, x2, y2, color);
} else {
graph_line_4(x1, y1, x2, y2, color);
}
} else {
if (y2 - y1 < x2 - x1) {
graph_line_6(x1, y1, x2, y2, color);
} else if (y2 - y1 == x2 - x1) {
graph_line_7(x1, y1, x2, y2, color);
} else {
graph_line_8(x1, y1, x2, y2, color);
}
}
outportb(0x7c, 0 );
}
void graph_palet(int paletmode, int color)
{
paletdata[paletmode & 7] = color;
switch(paletmode & 7) {
case 0:
case 4:
outportb(0xae, paletdata[0] * 16 + paletdata[4]);
break;
case 1:
case 5:
outportb(0xaa, paletdata[1] * 16 + paletdata[5]);
break;
case 2:
case 6:
outportb(0xac, paletdata[2] * 16 + paletdata[6]);
break;
case 3:
case 7:
outportb(0xa8, paletdata[3] * 16 + paletdata[7]);
break;
}
}
void graph_init(void)
{
union REGS in;
union REGS out;
int i;
in.h.ah = 0x42;
in.h.ch = 0xc0;
int86( 0x18, &in, &out ); /*graphic bios set gvram domain*/
#if 0
outportb( 0x68, 2 ); /*graphic mode = color*/
outportb( 0x68, 8 ); /*brp mode = 400line*/
outportb( 0x6a, 1 ); /*color = 8*/
#endif
in.h.ah = 0x40;
int86( 0x18, &in, &out );
outportb( 0x6a, 0);
for (i = 0; i < 8; ++i) {
graph_palet(i, i);
}
outportb(0xa6, 0);/*apage=0*/
outportb(0xa4, 0);/*vpage=0*/
graph_cls();
}
void graph_cls(void)
{
int i;
unsigned long far *p;
outportb(0x7c, 0xc8);
outportb(0x7e, 0);
outportb(0x7e, 0);
outportb(0x7e, 0);
for (i = 8000, p = (unsigned long far *)GRAPH_ADDRESS_B; i > 0; --i) {
*p++ = 0xffffffffUL;
}
#if 0
memset(GRAPH_ADDRESS_B, 0, 0x8000);
#endif
outportb(0x7c, 0);
}
static int vline ;
#define LINE1 80
#define LINE2 160
#define T0 6
#define T1 12
#define T2 18
#define T3 24
#define setvalall0(c0,c1,c2,c3,c4,c5,c6,c7) \
(unsigned char)( ((c0) > T1 ? 0x80 : 0) \
| ((c1) > T2 ? 0x40 : 0) \
| ((c2) > T1 ? 0x20 : 0) \
| ((c3) > T2 ? 0x10 : 0) \
| ((c4) > T1 ? 0x08 : 0) \
| ((c5) > T2 ? 0x04 : 0) \
| ((c6) > T1 ? 0x02 : 0) \
| ((c7) > T2 ? 0x01 : 0) )
#define setvalall1(c0,c1,c2,c3,c4,c5,c6,c7) \
(unsigned char)( ((c0) > T3 ? 0x80 : 0) \
| ((c1) > T0 ? 0x40 : 0) \
| ((c2) > T3 ? 0x20 : 0) \
| ((c3) > T0 ? 0x10 : 0) \
| ((c4) > T3 ? 0x08 : 0) \
| ((c5) > T0 ? 0x04 : 0) \
| ((c6) > T3 ? 0x02 : 0) \
| ((c7) > T0 ? 0x01 : 0) )
#define setval0(c0, c1, c2, c3) \
(unsigned char)( ((c0) > tiletable[0] ? 0x80 : 0) \
| ((c0) > tiletable[1] ? 0x40 : 0) \
| ((c1) > tiletable[2] ? 0x20 : 0) \
| ((c1) > tiletable[3] ? 0x10 : 0) \
| ((c2) > tiletable[0] ? 0x08 : 0) \
| ((c2) > tiletable[1] ? 0x04 : 0) \
| ((c3) > tiletable[2] ? 0x02 : 0) \
| ((c3) > tiletable[3] ? 0x01 : 0) )
#define setval1(c0,c1,c2,c3) \
(unsigned char)( ((c0) > tiletable[4] ? 0x80 : 0) \
| ((c0) > tiletable[5] ? 0x40 : 0) \
| ((c1) > tiletable[6] ? 0x20 : 0) \
| ((c1) > tiletable[7] ? 0x10 : 0) \
| ((c2) > tiletable[4] ? 0x08 : 0) \
| ((c2) > tiletable[5] ? 0x04 : 0) \
| ((c3) > tiletable[6] ? 0x02 : 0) \
| ((c3) > tiletable[7] ? 0x01 : 0) )
#define setval2(c0,c1,c2,c3) \
(unsigned char)( ((c0) > tiletable[ 8] ? 0x80 : 0) \
| ((c0) > tiletable[ 9] ? 0x40 : 0) \
| ((c1) > tiletable[10] ? 0x20 : 0) \
| ((c1) > tiletable[11] ? 0x10 : 0) \
| ((c2) > tiletable[ 8] ? 0x08 : 0) \
| ((c2) > tiletable[ 9] ? 0x04 : 0) \
| ((c3) > tiletable[10] ? 0x02 : 0) \
| ((c3) > tiletable[11] ? 0x01 : 0) )
int tiletable[] = {
7 * 32 / 12, 4 * 32 / 12, 10 * 32 / 12, 1 * 32 / 12,
3 * 32 / 12, 0 * 32 / 12, 6 * 32 / 12, 9 * 32 / 12,
11 * 32 / 12, 8 * 32 / 12, 2 * 32 / 12, 5 * 32 / 12
};
/*
int tilealltable[] = {
12,18,24,6
};
*/
#define gc(c) ((c) >> 11) /* (((c) >> 11) & 0x1f) */
#define rc(c) (((c) >> 6) & 0x1f)
#define bc(c) (((c) >> 1) & 0x1f)
void crtclr( void );
#ifdef MSC
char *program = "Do-GA C.G.A System Rendering Program for PC-9800 & PC-286" ;
#endif
#ifdef GCC
char *program = "Do-GA C.G.A System Rendering Program for MS-DOS+go32" ;
#endif
/* CRTの初期化 */
void crtinit( line )
int line ;
{
union REGS inregs, outregs;
inregs.h.ah = 0x40;
int86(0x18, &inregs, &outregs);
vline = line ;
graph_init();
}
/* CRTのクリア */
void crtclr()
{
fprintf( stderr, "\x1B[2J" );
graph_cls();
}
/* CRT出力 */
void crtout( framebuf, xlen, y )
unsigned short *framebuf ;
int xlen ;
int y ;
{
int i, n ;
unsigned short cl0, cl1, cl2, cl3;
unsigned short c0, c1, c2, c3;
#ifdef HIVISION
unsigned short cl4, cl5, cl6, cl7, c4,c5,c6,c7 ;
#endif
unsigned short offset ;
unsigned char far *r_vram;
unsigned char far *g_vram;
unsigned char far *b_vram;
#ifdef HIVISION
if (PixelMode == P320x200
|| PixelMode == P640x400
|| PixelMode == P640x480) {
offset = y * 80;
#ifdef GRAPHUPPERRIGHT
if (PixelMode == P320x200) {
offset += 40;
}
#endif
n = xlen / 8;
if (y >= 400) {
return;
}
b_vram = (unsigned char far*)GRAPH_ADDRESS_B + offset ;
r_vram = (unsigned char far*)GRAPH_ADDRESS_R + offset ;
g_vram = (unsigned char far*)GRAPH_ADDRESS_G + offset ;
for (i = 0; i < n; i++ ) {
cl0 = *framebuf++;
cl1 = *framebuf++;
cl2 = *framebuf++;
cl3 = *framebuf++;
cl4 = *framebuf++;
cl5 = *framebuf++;
cl6 = *framebuf++;
cl7 = *framebuf++;
c0 = gc(cl0); /* green */
c1 = gc(cl1);
c2 = gc(cl2);
c3 = gc(cl3);
c4 = gc(cl4);
c5 = gc(cl5);
c6 = gc(cl6);
c7 = gc(cl7);
if (y & 1)
*(g_vram ) = setvalall0(c0, c1, c2, c3,c4,c5,c6,c7);
else
*(g_vram ) = setvalall1(c0, c1, c2, c3,c4,c5,c6,c7);
c0 = rc(cl0); /* red */
c1 = rc(cl1);
c2 = rc(cl2);
c3 = rc(cl3);
c4 = rc(cl4);
c5 = rc(cl5);
c6 = rc(cl6);
c7 = rc(cl7);
if (y & 1)
*(r_vram ) = setvalall0(c0, c1, c2, c3,c4,c5,c6,c7);
else
*(r_vram ) = setvalall1(c0, c1, c2, c3,c4,c5,c6,c7);
c0 = bc(cl0); /* blue */
c1 = bc(cl1);
c2 = bc(cl2);
c3 = bc(cl3);
c4 = bc(cl4);
c5 = bc(cl5);
c6 = bc(cl6);
c7 = bc(cl7);
if (y & 1)
*(b_vram ) = setvalall0(c0, c1, c2, c3,c4,c5,c6,c7);
else
*(b_vram ) = setvalall1(c0, c1, c2, c3,c4,c5,c6,c7);
b_vram++ ;
r_vram++ ;
g_vram++ ;
}
return;
#ifdef GRAPHUPPERRIGHT
} else if ( vline <= 256 ) {
if (y % 4 != 0)
return;
offset = ((y+YPosition) / 4) * 80 * 3 + XPosition / 8 + (80-32);
n = xlen / 8 ;
} else if ( vline <= 512 ) {
if (y % 8 != 0)
return;
offset = ((y+YPosition) / 8) * 80 * 3 + XPosition / 16 + (80-32);
n = xlen / 16 ;
} else if ( vline <= 1024 ) {
if (y % 16 != 0)
return;
offset = ((y+YPosition) / 16) * 80 * 3 + XPosition / 64 + (80-32);
n = xlen / 32 ;
} else if ( vline <= 2048 ) {
if (y % 32 != 0)
return;
offset = ((y+YPosition) / 32) * 80 * 3 + XPosition / 128 + (80-32);
n = xlen / 64 ;
}
#else
} else if ( vline <= 256 ) {
if (y % 2 != 0)
return;
offset = ((y+YPosition) / 2) * 80 * 3 + XPosition / 8;
n = xlen / 4 ;
} else if ( vline <= 512 ) {
if (y % 4 != 0)
return;
offset = ((y+YPosition) / 4) * 80 * 3 + XPosition / 16;
n = xlen / 8 ;
} else if ( vline <= 1024 ) {
if (y % 8 != 0)
return;
offset = ((y+YPosition) / 8) * 80 * 3 + XPosition / 32;
n = xlen / 16 ;
} else if ( vline <= 2048 ) {
if (y % 16 != 0)
return;
offset = ((y+YPosition) / 16) * 80 * 3 + XPosition / 64;
n = xlen / 32 ;
}
#endif
#else
if ( vline == 256 ) {
if (y % 2 != 0)
return;
offset = (y / 2) * 80 * 3;
n = xlen / 4 ;
} else {
if (y % 4 != 0)
return;
offset = (y / 4) * 80 * 3;
n = xlen / 8 ;
}
#endif
b_vram = (unsigned char far*)GRAPH_ADDRESS_B + offset ;
r_vram = (unsigned char far*)GRAPH_ADDRESS_R + offset ;
g_vram = (unsigned char far*)GRAPH_ADDRESS_G + offset ;
for (i = n; i > 0; --i) {
#ifdef HIVISION
#ifdef GRAPHUPPERRIGHT
#define SIZE1 0
#define SIZE2 256
#define SIZE3 512
#define SIZE4 1024
#define SIZE5 2048
#else
#define SIZE1 256
#define SIZE2 512
#define SIZE3 1024
#define SIZE4 2048
#define SIZE5 0
#endif
if (vline <= SIZE1) {
cl0 = *framebuf++;
cl1 = *framebuf++;
cl2 = *framebuf++;
cl3 = *framebuf++;
} else if (vline <= SIZE2) {
cl0 = *framebuf;
cl1 = *(framebuf + 2);
cl2 = *(framebuf + 4);
cl3 = *(framebuf + 6);
framebuf += 8;
} else if (vline <= SIZE3) {
cl0 = *framebuf;
cl1 = *(framebuf + 4);
cl2 = *(framebuf + 8);
cl3 = *(framebuf + 12);
framebuf += 16;
} else if (vline <= SIZE4) {
cl0 = *framebuf;
cl1 = *(framebuf + 8);
cl2 = *(framebuf + 16);
cl3 = *(framebuf + 24);
framebuf += 32;
} else if (vline <= SIZE5) {
cl0 = *framebuf;
cl1 = *(framebuf + 16);
cl2 = *(framebuf + 32);
cl3 = *(framebuf + 48);
framebuf += 64;
}
#undef SIZE1
#undef SIZE2
#undef SIZE3
#undef SIZE4
#undef SIZE5
#else
if ( vline <= 256 ) {
cl0 = *framebuf++;
cl1 = *framebuf++;
cl2 = *framebuf++;
cl3 = *framebuf++;
} else {
cl0 = *framebuf;
cl1 = *(framebuf + 2);
cl2 = *(framebuf + 4);
cl3 = *(framebuf + 6);
framebuf += 8;
}
#endif
c0 = gc(cl0); /* green */
c1 = gc(cl1);
c2 = gc(cl2);
c3 = gc(cl3);
*(g_vram ) = setval0(c0, c1, c2, c3);
*(g_vram + LINE1) = setval1(c0, c1, c2, c3);
*(g_vram + LINE2) = setval2(c0, c1, c2, c3);
c0 = rc(cl0); /* red */
c1 = rc(cl1);
c2 = rc(cl2);
c3 = rc(cl3);
*(r_vram ) = setval1(c0, c1, c2, c3);
*(r_vram + LINE1) = setval2(c0, c1, c2, c3);
*(r_vram + LINE2) = setval0(c0, c1, c2, c3);
c0 = bc(cl0); /* blue */
c1 = bc(cl1);
c2 = bc(cl2);
c3 = bc(cl3);
*(b_vram ) = setval2(c0, c1, c2, c3);
*(b_vram + LINE1) = setval0(c0, c1, c2, c3);
*(b_vram + LINE2) = setval1(c0, c1, c2, c3);
b_vram++ ;
r_vram++ ;
g_vram++ ;
}
}
void crtline( x1, y1, x2, y2 )
int x1, y1, x2, y2 ;
{
#ifdef HIVISION
x1 += XPosition;
y1 += YPosition;
x2 += XPosition;
y2 += YPosition;
if (PixelMode != P320x200
&& PixelMode != P640x400
&& PixelMode != P640x480) {
#ifdef GRAPHUPPERRIGHT
if (vline > 1024) {
x1 = x1 / 8 ;
y1 = y1 / 8 ;
x2 = x2 / 8 ;
y2 = y2 / 8 ;
} else if (vline > 512) {
x1 = x1 / 4 ;
y1 = y1 / 4 ;
x2 = x2 / 4 ;
y2 = y2 / 4 ;
} else if (vline > 256) {
x1 = x1 / 2;
y1 = y1 / 2;
x2 = x2 / 2;
y2 = y2 / 2;
}
x1 += (80-32) * 8;
x2 += (80-32) * 8;
#else
if (vline > 1024) {
x1 = x1 / 4 ;
y1 = y1 / 4 ;
x2 = x2 / 4 ;
y2 = y2 / 4 ;
} else if (vline > 512) {
x1 = x1 / 2 ;
y1 = y1 / 2 ;
x2 = x2 / 2 ;
y2 = y2 / 2 ;
} else if (vline > 256) {
} else {
x1 = x1 * 2 ;
y1 = y1 * 2 ;
x2 = x2 * 2 ;
y2 = y2 * 2 ;
}
#endif
y1 = y1 * 3 / 4 ;
y2 = y2 * 3 / 4 ;
}
#ifdef GRAPHUPPERRIGHT
else if (PixelMode == P320x200 ) {
x1 += 320;
x2 += 320;
}
#endif
#else
if ( vline <= 256 )
{
x1 *= 2 ;
y1 *= 2 ;
x2 *= 2 ;
y2 *= 2 ;
}
y1 = y1 * 3 / 4 ;
y2 = y2 * 3 / 4 ;
#endif
graph_line(x1, y1, x2, y2, 7);
}