home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 March
/
VPR9703A.ISO
/
VPR_DATA
/
DOGA
/
SOURCES
/
REND.LZH
/
REND
/
CRTV70.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-07-29
|
2KB
|
141 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 );
char *program = "Do-GA C.G.A System Rendering Program for V70 on X68000" ;
/* CRTの初期化 */
void crtinit( line )
int line ;
{
vline = line ;
CRTMOD( 12 );
}
/* CRTのクリア */
void crtclr()
{
struct FILLPTR fill ;
fprintf( stderr, "\x1B[2J" );
G_CLR_ON() ;
}
unsigned short swapbyte(data)
unsigned short data;
{
union {
struct {
char c1;
char c2;
} ch;
unsigned short sh;
} swapdata, returndata;
swapdata.sh = data;
returndata.ch.c1 = swapdata.ch.c2;
returndata.ch.c2 = swapdata.ch.c1;
return returndata.sh;
}
/* CRT出力 */
void crtout( framebuf, xlen, y )
unsigned short *framebuf ;
int xlen ;
int y ;
{
int i ;
unsigned short *p, *p2 ;
unsigned short *fbuf;
static unsigned short pvram[1024];
unsigned short *pv, *pv2;
int sp ;
struct PUTPTR ptr;
p = (short *)0xC00000;
pv = pvram;
#ifndef HIVISION
if ( vline == 512 )
#else
if ( vline > 256 )
#endif
{
#ifdef HIVISION
p += (YPosition + y) * 512 + XPosition;
#else
p += y * 512;
#endif
fbuf = framebuf;
for( i = 0 ; i < xlen ; ++i )
{
*pv++ = swapbyte(*fbuf++);
}
B_MEMSET(p, pvram, xlen * 2 - 1);
}
#ifndef HIVISION
else if ( vline == 256 )
#else
else
#endif
{
#ifdef HIVISION
p += ((YPosition+y) * 512 + XPosition) * 2 ;
#else
p += y * 1024;
#endif
p2 = p + 512 ;
pv2 = pv + 512;
fbuf = framebuf;
for (i = 0; i < xlen; ++i) {
*pv2++ = *pv2++ = *pv++ = *pv++ = swapbyte(*fbuf++);
}
B_MEMSET(p, pvram, xlen * 2 * 2 * 2 - 1);
}
}
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 )
#else
if (vline <= 256 )
#endif
{
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 ;
}
line.color = 0xFFFF ;
line.linestyle = 0xFFFF ;
LINE( &line );
}