home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 March
/
VPR9703A.ISO
/
VPR_DATA
/
DOGA
/
SOURCES
/
REND.LZH
/
REND
/
CRTX68K.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-10-05
|
4KB
|
222 lines
#include <stdio.h>
#include <stdlib.h>
#include <doslib.h>
#include <iocslib.h>
#ifdef HIVISION
extern int XPosition, YPosition;
#endif
static int vline ;
void crtclr( void );
#if (defined(REND030))
char *program = "Do-GA C.G.A System Rendering Program for X68030 & 68882" ;
#elif (defined(RENDXVI))
char *program = "Do-GA C.G.A System Rendering Program for X68000 & 68881/2" ;
#else
char *program = "Do-GA C.G.A System Rendering Program for X68000" ;
#endif
/* CRTの初期化 */
void crtinit( line )
int line ;
{
vline = line ;
CRTMOD( 12 );
}
/* CRTのクリア */
void crtclr()
{
struct FILLPTR fill ;
fprintf( stderr, "\x1B[2J" );
G_CLR_ON() ;
}
/* CRT出力 */
void crtout( framebuf, xlen, y )
short *framebuf ;
int xlen ;
int y ;
{
int i ;
short *p, *p2 ;
int sp ;
#ifndef RENDXVI
sp = SUPER( 0 );
#endif
p = (short *)0xC00000;
#ifdef HIVISION
if (vline <= 256) {
p += ((YPosition+y) * 512 + XPosition) * 2 ;
p2 = p + 512 ;
for (i = xlen ; i > 0; --i)
{
*p2++ = *p++ = *framebuf ;
*p2++ = *p++ = *framebuf++ ;
}
} else if (vline <= 512) {
p += (YPosition + y) * 512 + XPosition;
for (i = xlen ; i > 0; --i)
*p++ = *framebuf++ ;
} else if (vline <= 1024) {
if (y % 2 == 0) {
p += (YPosition + y) * 256 + XPosition/2;
for (i = xlen/2 ; i > 0; --i) {
*p++ = *framebuf++ ;
framebuf++;
}
}
} else if (vline <= 2048) {
if (y % 4 == 0) {
p += (YPosition + y) * 128 + XPosition/4;
for (i = xlen/4; i > 0; --i) {
*p++ = *framebuf;
framebuf+=4;
}
}
}
#else
if ( vline == 512 )
{
p += y * 512;
for( i = 0 ; i < xlen ; ++i )
*p++ = *framebuf++ ;
}
else
{
p += y * 1024;
p2 = p + 512 ;
for( i = 0 ; i < xlen ; ++i )
{
*p2++ = *p++ = *framebuf ;
*p2++ = *p++ = *framebuf++ ;
}
}
#endif
#ifndef RENDXVI
STACK_ADJUST:
SUPER( sp );
#endif
}
void crtline( x1, y1, x2, y2 )
int x1, y1, x2, y2 ;
{
struct LINEPTR line ;
#ifdef HIVISION
x1 += XPosition;
y1 += YPosition;
x2 += XPosition;
y2 += YPosition;
#endif
#ifndef HIVISION
if ( vline == 256 )
{
line.x1 = x1 * 2 ;
line.y1 = y1 * 2 ;
line.x2 = x2 * 2 ;
line.y2 = y2 * 2 ;
}
else
{
line.x1 = x1 ;
line.y1 = y1 ;
line.x2 = x2 ;
line.y2 = y2 ;
}
#else
if (vline <= 256) {
line.x1 = x1 * 2 ;
line.y1 = y1 * 2 ;
line.x2 = x2 * 2 ;
line.y2 = y2 * 2 ;
} else if (vline <= 512) {
line.x1 = x1 ;
line.y1 = y1 ;
line.x2 = x2 ;
line.y2 = y2 ;
} else if (vline <= 1024) {
line.x1 = x1 / 2 ;
line.y1 = y1 / 2 ;
line.x2 = x2 / 2 ;
line.y2 = y2 / 2 ;
} else if (vline <= 2048) {
line.x1 = x1 / 4 ;
line.y1 = y1 / 4 ;
line.x2 = x2 / 4 ;
line.y2 = y2 / 4 ;
}
#endif
line.color = 0xFFFF ;
line.linestyle = 0xFFFF ;
LINE( &line );
}
#ifdef WIREVIEW
void crtlinecolor( x1, y1, x2, y2, color )
int x1, y1, x2, y2 ;
unsigned short color;
{
struct LINEPTR line ;
#ifdef HIVISION
x1 += XPosition;
y1 += YPosition;
x2 += XPosition;
y2 += YPosition;
#endif
#ifndef HIVISION
if ( vline == 256 )
{
line.x1 = x1 * 2 ;
line.y1 = y1 * 2 ;
line.x2 = x2 * 2 ;
line.y2 = y2 * 2 ;
}
else
{
line.x1 = x1 ;
line.y1 = y1 ;
line.x2 = x2 ;
line.y2 = y2 ;
}
#else
if (vline <= 256) {
line.x1 = x1 * 2 ;
line.y1 = y1 * 2 ;
line.x2 = x2 * 2 ;
line.y2 = y2 * 2 ;
} else if (vline <= 512) {
line.x1 = x1 ;
line.y1 = y1 ;
line.x2 = x2 ;
line.y2 = y2 ;
} else if (vline <= 1024) {
line.x1 = x1 / 2 ;
line.y1 = y1 / 2 ;
line.x2 = x2 / 2 ;
line.y2 = y2 / 2 ;
} else if (vline <= 2048) {
line.x1 = x1 / 4 ;
line.y1 = y1 / 4 ;
line.x2 = x2 / 4 ;
line.y2 = y2 / 4 ;
}
#endif
line.color = color;
line.linestyle = 0xFFFF ;
LINE( &line );
}
#endif