void LatchDrawTile (unsigned x, unsigned y, unsigned picnum)
{
	unsigned	source, dest;

	dest = bufferofs + ylookup[y]+x;
	source = tileoffsets[picnum];

	EGAWRITEMODE(1);
	EGAMAPMASK(15);

asm	mov	bx,[linewidth]
asm	sub	bx,2

asm	mov	ax,[screenseg]
asm	mov	es,ax
asm	mov	ds,ax

asm	mov	si,[source]
asm	mov	di,[dest]
asm	mov	dx,16

lineloop:
asm	movsb
asm	movsb
asm	add	di,bx

asm	dec	dx
asm	jnz	lineloop

asm	mov	ax,ss
asm	mov	ds,ax					// restore turbo's data segment

	EGAWRITEMODE(0);
}
Beispiel #2
0
void LatchDrawChar (id0_unsigned_t x, id0_unsigned_t y, id0_unsigned_t picnum)
{
	id0_unsigned_t	source, dest;

	dest = bufferofs + ylookup[y]+x;
	source = latchpics[0]+picnum*8;

	BE_ST_EGAUpdateGFXByteInAllPlanesScrToScr(dest, source);
	BE_ST_EGAUpdateGFXByteInAllPlanesScrToScr(dest += linewidth, ++source);
	BE_ST_EGAUpdateGFXByteInAllPlanesScrToScr(dest += linewidth, ++source);
	BE_ST_EGAUpdateGFXByteInAllPlanesScrToScr(dest += linewidth, ++source);
	BE_ST_EGAUpdateGFXByteInAllPlanesScrToScr(dest += linewidth, ++source);
	BE_ST_EGAUpdateGFXByteInAllPlanesScrToScr(dest += linewidth, ++source);
	BE_ST_EGAUpdateGFXByteInAllPlanesScrToScr(dest += linewidth, ++source);
	BE_ST_EGAUpdateGFXByteInAllPlanesScrToScr(dest += linewidth, ++source);
#if 0
	EGAWRITEMODE(1);
	EGAMAPMASK(15);

asm	mov	bx,[linewidth]
asm	dec	bx

asm	mov	ax,[screenseg]
asm	mov	es,ax
asm	mov	ds,ax

asm	mov	si,[source]
asm	mov	di,[dest]

asm	movsb
asm	add	di,bx
asm	movsb
asm	add	di,bx
asm	movsb
asm	add	di,bx
asm	movsb
asm	add	di,bx
asm	movsb
asm	add	di,bx
asm	movsb
asm	add	di,bx
asm	movsb
asm	add	di,bx
asm	movsb

asm	mov	ax,ss
asm	mov	ds,ax					// restore turbo's data segment

	EGAWRITEMODE(0);
#endif
}
Beispiel #3
0
void VW_Bar (id0_unsigned_t x, id0_unsigned_t y, id0_unsigned_t width, id0_unsigned_t height,
	id0_unsigned_t color)
{
	id0_unsigned_t dest,xh,xlb,xhb,maskleft,maskright,mid;

	xh = x+width-1;
	xlb=x/8;
	xhb=xh/8;

	EGAWRITEMODE(2);
	EGAMAPMASK(15);

	maskleft = leftmask[x&7];
	maskright = rightmask[xh&7];

	mid = xhb-xlb-1;
	dest = bufferofs+ylookup[y]+xlb;

	if (xlb==xhb)
	{
		//
		// entire line is in one byte
		//

		maskleft&=maskright;

		do
		{
			BE_ST_EGAUpdateGFXPixel4bpp(dest, color, maskleft);
			dest += linewidth; // down to next line
			--height;
		} while (height);

		return;
	}

	id0_unsigned_t bytesToAdd = linewidth-mid-1;
	do
	{
		//
		// draw left side
		//
		BE_ST_EGAUpdateGFXPixel4bpp(dest++, color, maskleft);

		//
		// draw middle
		//
		BE_ST_EGAUpdateGFXPixel4bppRepeatedly(dest, color, mid, 255); // no masking
		dest += mid;

		//
		// draw right side
		//
		BE_ST_EGAUpdateGFXPixel4bpp(dest, color, maskright);

		dest += bytesToAdd; // move to start of next line
		--height;
	} while (height);
}
Beispiel #4
0
void	VW_ClearVideo (id0_int_t color)
{
	// REFKEEN - A bit of code re-ordering done
	// (originally there was code common to CGA and EGA)
	if (GRMODE == EGAGR)
	{
		EGAWRITEMODE(2);
		EGAMAPMASK(15);

		BE_ST_EGAUpdateGFXBufferFrom4bitsPixel(0, color, 0xffff);

		EGAWRITEMODE(0);
	}
	else if (GRMODE == CGAGR)
	{
		memset(screenseg, color, 0xffff);
	}
}
Beispiel #5
0
void	VW_ClearVideo (id0_int_t color)
{
#if GRMODE == EGAGR
	EGAWRITEMODE(2);
	EGAMAPMASK(15);
#endif

#if GRMODE == EGAGR
	BE_ST_EGAUpdateGFXBufferFrom4bitsPixel(0, color, 0xffff);
#endif
#if GRMODE == CGAGR
	memset(screenseg, color, 0xffff);
#endif


#if GRMODE == EGAGR
	EGAWRITEMODE(0);
#endif
}
Beispiel #6
0
void LatchDrawTile (id0_unsigned_t x, id0_unsigned_t y, id0_unsigned_t picnum)
{
	id0_unsigned_t	source, dest;

	dest = bufferofs + ylookup[y]+x;
	source = tileoffsets[picnum];

	for (int lineCount = 16; lineCount; --lineCount)
	{
		BE_ST_EGAUpdateGFXBufferInAllPlanesScrToScr(dest, source, 2);
		source += 2;
		dest += linewidth;
	}
#if 0
	EGAWRITEMODE(1);
	EGAMAPMASK(15);

asm	mov	bx,[linewidth]
asm	sub	bx,2

asm	mov	ax,[screenseg]
asm	mov	es,ax
asm	mov	ds,ax

asm	mov	si,[source]
asm	mov	di,[dest]
asm	mov	dx,16

lineloop:
asm	movsb
asm	movsb
asm	add	di,bx

asm	dec	dx
asm	jnz	lineloop

asm	mov	ax,ss
asm	mov	ds,ax					// restore turbo's data segment

	EGAWRITEMODE(0);
#endif
}
Beispiel #7
0
void	VW_ClearVideo (id0_int_t color)
{
#if GRMODE == EGAGR
	EGAWRITEMODE(2);
	EGAMAPMASK(15);
#endif

#if GRMODE == EGAGR
	BE_ST_EGAUpdateGFXPixel4bppRepeatedly(0, color, 0xffff, 0xff);
#endif
#if GRMODE == CGAGR
	memset(screenseg, color, 0xffff);
	BE_ST_MarkGfxForPendingUpdate();
#endif


#if GRMODE == EGAGR
	EGAWRITEMODE(0);
#endif
}
void LatchDrawChar (unsigned x, unsigned y, unsigned picnum)
{
	unsigned	source, dest;

	dest = bufferofs + ylookup[y]+x;
	source = latchpics[0]+picnum*8;

	EGAWRITEMODE(1);
	EGAMAPMASK(15);

asm	mov	bx,[linewidth]
asm	dec	bx

asm	mov	ax,[screenseg]
asm	mov	es,ax
asm	mov	ds,ax

asm	mov	si,[source]
asm	mov	di,[dest]

asm	movsb
asm	add	di,bx
asm	movsb
asm	add	di,bx
asm	movsb
asm	add	di,bx
asm	movsb
asm	add	di,bx
asm	movsb
asm	add	di,bx
asm	movsb
asm	add	di,bx
asm	movsb
asm	add	di,bx
asm	movsb

asm	mov	ax,ss
asm	mov	ds,ax					// restore turbo's data segment

	EGAWRITEMODE(0);
}
Beispiel #9
0
void	VW_Startup (void)
{
	id0_int_t i;

	// Originally used for certain ASM code loops (clears direction flag)
	//asm	cld;

	videocard = NOcard/*0*/;

	for (i = 1;i < id0_argc;i++)
		// REFKEEN - Add new /SWMOUSE argument from the 2015 port
		switch (US_CheckParm(id0_argv[i],ParmStrings))
		{
		case 0:
			videocard = EGAcard;
			break;
		case 1:
			if (refkeen_current_gamever == BE_GAMEVER_KDREAMS2015)
				BE_ST_HostGfx_SetAbsMouseCursorToggle(false);
			break;
		}
#if 0
		if (US_CheckParm(id0_argv[i],ParmStrings) == 0)
		{
			videocard = EGAcard;
			break;
		}
#endif

	if (!videocard)
		videocard = VW_VideoID ();

	if (GRMODE == EGAGR)
	{
		grmode = EGAGR;
		if (videocard != EGAcard && videocard != VGAcard)
	Quit ("Improper video card!  If you really have an EGA/VGA card that I am not \n"
		  "detecting, use the -HIDDENCARD command line parameter!");
		EGAWRITEMODE(0);
	}
	else if (GRMODE == CGAGR)
	{
		grmode = CGAGR;
		if (videocard < CGAcard || videocard > VGAcard)
	Quit ("Improper video card!  If you really have a CGA card that I am not \n"
		  "detecting, use the -HIDDENCARD command line parameter!");
		MM_GetPtr ((memptr *)&screenseg,0x10000l);	// grab 64k for floating screen
	}

	cursorvisible = 0;
}
Beispiel #10
0
void VW_Hlin(id0_unsigned_t xl, id0_unsigned_t xh, id0_unsigned_t y, id0_unsigned_t color)
{
  id0_unsigned_t dest,xlb,xhb,maskleft,maskright,mid;

	xlb=xl/8;
	xhb=xh/8;

	EGAWRITEMODE(2);
	EGAMAPMASK(15);

	maskleft = leftmask[xl&7];
	maskright = rightmask[xh&7];

	mid = xhb-xlb-1;
	dest = bufferofs+ylookup[y]+xlb;

  if (xlb==xhb)
  {
  	//
  	// entire line is in one byte
  	//

	maskleft&=maskright;

	BE_ST_EGAUpdateGFXPixel4bpp(dest, color, maskleft);
	return;
  }

	//
	// draw left side
	//
	BE_ST_EGAUpdateGFXPixel4bpp(dest++, color, maskleft);

	//
	// draw middle
	//
	BE_ST_EGAUpdateGFXPixel4bppRepeatedly(dest, color, mid, 255); // no masking
	dest += mid;

	//
	// draw right side
	//
	BE_ST_EGAUpdateGFXPixel4bpp(dest, color, maskright);
}
Beispiel #11
0
void	VW_Startup (void)
{
	id0_int_t i;

	// Originally used for certain ASM code loops (clears direction flag)
	//asm	cld;

	videocard = NOcard/*0*/;

    /*
	for (i = 1;i < id0_argc;i++)
		if (US_CheckParm(id0_argv[i],ParmStrings) == 0)
		{
			videocard = EGAcard;
			break;
		}
*/
	if (!videocard)
		videocard = VW_VideoID ();

#if GRMODE == EGAGR
	grmode = EGAGR;
	if (videocard != EGAcard && videocard != VGAcard)
Quit ("Improper video card!  If you really have an EGA/VGA card that I am not \n"
	  "detecting, use the -HIDDENCARD command line parameter!");
	EGAWRITEMODE(0);
#endif

#if GRMODE == CGAGR
	grmode = CGAGR;
	if (videocard < CGAcard || videocard > VGAcard)
Quit ("Improper video card!  If you really have a CGA card that I am not \n"
	  "detecting, use the -HIDDENCARD command line parameter!");
	MM_GetPtr ((memptr *)&screenseg,0x10000l);	// grab 64k for floating screen
#endif

	cursorvisible = 0;
}
Beispiel #12
0
unsigned BuildCompShape (t_compshape _seg **finalspot)
{
	t_compshape 	_seg *work;
	byte		far *code;
	int			firstline,lastline,x,y;
	unsigned	firstpix,lastpix,width;
	unsigned	totalsize,pixelofs;
	unsigned	buff;


//	MM_GetPtr (&(memptr)work,20000);
	EGAWRITEMODE(0);
	EGAREADMAP(0);		// use ega screen memory for temp buffer
	EGAMAPMASK(1);
	buff = screenloc[1];
	work = (t_compshape _seg *)(0xa000+(buff+15)/16);

//
// find the width of the shape
//
	firstline = -1;
	x=0;
	do
	{
		for (y=0;y<64;y++)
			if (spotvis[y][x] != BACKGROUNDPIX)
			{
				firstline = x;
				break;
			}
		if (++x == 64)
			Quit ("BuildCompShape: No shape data!");
	} while (firstline == -1);

	lastline = -1;
	x=63;
	do
	{
		for (y=0;y<64;y++)
			if (spotvis[y][x] != BACKGROUNDPIX)
			{
				lastline = x;
				break;
			}
		x--;
	} while (lastline == -1);

	width = lastline-firstline+1;

	work->width = width;
	code = (byte far *)&work->codeofs[width];

//
// copy all non background pixels to the work space
//
	pixelofs = FP_OFF(code);

	for (x=firstline;x<=lastline;x++)
		for (y=0;y<64;y++)
			if (spotvis[y][x] != BACKGROUNDPIX)
				*code++ = spotvis[y][x];

//
// start compiling the vertical lines
//
	for (x=firstline;x<=lastline;x++)
	{
		work->codeofs[x-firstline] = FP_OFF(code);

		y=0;
		do
		{
		//
		// scan past black background pixels
		//
			while (spotvis[y][x] == BACKGROUNDPIX && y<64)
				y++;

			if (y>63)		// no more segments
				break;

			firstpix = y+1;		// +1 because width is before codeofs

		//
		// scan past scalable pixels
		//
			while (spotvis[y][x] != BACKGROUNDPIX && y<64)
				y++;

			if (y>63)
				lastpix = 65;
			else
				lastpix = y+1;	// actually one pixel past the last displayed

		//
		// compile the scale call
		//
			*code++ = 0x8b;		// mov bx,[lastpix*2]
			*code++ = 0x1e;
			*((unsigned far *)code)++ = lastpix*2;

			*code++ = 0x8b;		// mov cx,[bx]
			*code++ = 0x0f;

			*code++ = 0xc6;		// move [BYTE bx],0xcb
			*code++ = 0x07;
			*code++ = 0xcb;

			*code++ = 0xa1;		// mov ax,[firstpix*2]	/*************
			*((unsigned far *)code)++ = firstpix*2;

			*code++ = 0x36;		// mov [ss:0],ax
			*code++ = 0xa3;
			*code++ = 0x00;
			*code++ = 0x00;

			*code++ = 0x8e;		// mov ds,dx	(mov ds,cs)
			*code++ = 0xda;

			*code++ = 0xbe;		// mov si,OFFSET pixelofs-firstpixel
			*((unsigned far *)code)++ = pixelofs-firstpix;

			*code++ = 0xff;		// call [DWORD bp]
			*code++ = 0x5e;
			*code++ = 0x00;

			*code++ = 0x8e;		// mov ds,[bp+2]
			*code++ = 0x5e;
			*code++ = 0x02;

			*code++ = 0x89;		// mov [bx],cx
			*code++ = 0x0f;

			pixelofs += (lastpix-firstpix);
		} while (y<63);

	//
	// retf
	//
		*code++ = 0xcb;
	}


//
// copy the final shape to a properly sized buffer
//
	totalsize = FP_OFF(code);

	if (totalsize >= (PAGELEN*2))
		Quit("BuildCompShape(): Shape is too complex!");

	MM_GetPtr ((memptr *)finalspot,totalsize);
	_fmemcpy ((byte _seg *)(*finalspot),(byte _seg *)work,totalsize);
//	MM_FreePtr (&(memptr)work);

	return totalsize;
}