⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vesadci.c

📁 超级解霸源代码。纯c语言写的。适合有一定编程基础的开发人员用来学习提高
💻 C
📖 第 1 页 / 共 2 页
字号:
////////////////////////////////////////////////////////
//	Visual DCI Supportd for decoder,and pass
//	     data to myself display handler.
//   Can display on gray,10E/10D,111/110 or YUV mode
//		    Southern.Liang
//		       1996.5.25
////////////////////////////////////////////////////////
//#pragma	option	-zC_TEXT	//This Must in _TEXT segment because the library & Enter point in _TEXT
#include <windows.h>
#include "DOS.H"
#include "DCI.H"
#include "VCDAPI.H"

/////////////////////////////////////
unsigned pascal far __A000H(void);
WORD	Linear;
int	PixelBits=8;
DWORD	ScrWidth=640;
DWORD	ScrHigh=480;
DWORD	LineWidth=0x400;
/////////////////////////////////////
extern	LPDCIOFFSCREEN		DCISurfaceScreenPtr;
HGLOBAL	OffScrSel=0;
#pragma	warn -par
static	void	Align1(void)
{
	asm	nop
	asm	nop
}
DCIRVAL	CALLBACK _loadds BeginAccess(LPVOID lpSurface,LPRECT lpRdst)
{
	return 0;
}
DCIRVAL	CALLBACK _loadds EndAccess(LPVOID lpSurface)
{
	return 0;
}
void	CALLBACK _loadds DestroySurface(LPVOID lpSurface)
{	//may free the lpSurface->dciInfo.dwSelSurface
	if(OffScrSel!=0)//Free the Offscreen.
		{
		GlobalFree(OffScrSel);
		OffScrSel=0;
		}
}
int	DisplayVideo=0;
long	VCDHigh=240;
int	DeleteLine=3;
typedef	struct	VIDEODATAtag
	{
	DWORD	SelfFlags;	//'STH!'
	DWORD	YPlane;		//Video offset
	DWORD	UPlane;
	DWORD	VPlane;
	DWORD	Selector;	//Video Selector
	DWORD	DataStride;
	DWORD	LineWidth;	//352
	DWORD	LineNumber;	//240 or 288
	}VIDEODATA,FAR *LPVIDEODATA;
extern	int	VESAColor;	//Color bits
extern	int	DCIType;	//If now be 640x480 and had DCI Primary 64K/32K
//////////////////////////////////////////////////////////
void	PASCAL near DrawYVU16Color(void);
void	PASCAL near DrawYVU15Color(void);
void	PASCAL near DrawS3BankColor(void);
void	PASCAL near Draw15BitsBanking(void);
void	PASCAL near Draw640x240Banking64K(void);
void	PASCAL near Draw640x240Banking64KLinear(void);
void	PASCAL near Draw640x240Banking32K(void);
void	PASCAL near Draw640x240Banking32KLinear(void);
void	PASCAL _huge DrawYUVDCI(LPDCISURFACEINFO lpSurface);
//////////////////////////////////////////////////////////
extern	int	BankingFlags;	//No 128K Buffer use banking.
////// This function Complied with Fastest mode BP no saved
void	PASCAL	DrawGrayScale(void)
{	//Gray scale
	int	Count=0;
	int	Line=0;

	asm	mov	es,OffScrSel;
	asm	xor	di,di
	Count=0;
	if(DeleteLine==5)
		{
		/////////////352x240/////////////
		_DX=Linear;
		__emit__(0x26,0x66,0x8B,0x75,0x04);//asm mov esi,es:[di+4]
		asm	mov	ds,es:[di+0x10]
		asm	mov	es,dx
		_EDI=0;
		_DX=200;
		MoveVideoData240:
		////// 352 bytes 32 times.
		asm	inc	Count
		asm	cmp	Count,5
		asm	je	DrawMix2Lines240
		////// 352 bytes 32 times.
		asm	mov	cx,32
		LoopLine240:
		__emit__(0x66,0x67,0xA5);	//asm	movsd//32bit addr
		__emit__(0x66,0x67,0xA5);	//asm	movsd//32bit addr
		__emit__(0x67,0x8B,0x06);	//asm	mov	ax,[esi]
		asm	or	ax,0x0101
		asm	add	al,ah
		asm	rcr	al,1
		__emit__(0x67,0x8A,0x66,0x02);	//asm	mov	ah,[esi+2]
		asm	mov	es:[di],ax	//asm	stosw
		asm	add	di,2
		_ESI+=3;
		asm	dec	cx		//asm	loop	LoopLine240
		asm	jnz	LoopLine240
		////////////Delete line/////////
		_ESI+=800;
		asm	dec	dx
		asm	jnz	MoveVideoData240
		goto	RETURN;
		DrawMix2Lines240:
		Count=0;
		Line=32;
		LoopDeleteLine240:
		asm	mov	cx,4
		Mix2Pixel240:
			__emit__(0x67,0x8B,0x06);//asm	mov	ax,[esi]
			__emit__(0x67,0x8B,0x9E,0x80,0x04,0x00,0x00);//asm mov	bx,[esi+0x480]
			asm	or	ax,0x0101
			asm	or	bx,0x0101
			asm	add	ax,bx
			asm	rcr	ax,1
			asm	mov	es:[di],ax	//asm	stosw
			asm	add	di,2
			_ESI+=2;
			asm	dec	cx
			asm	jnz	Mix2Pixel240
		////////////////////
		__emit__(0x67,0x8B,0x06);//asm	mov	ax,[esi]
		__emit__(0x67,0x8B,0x9E,0x80,0x04,0x00,0x00);//asm mov	bx,[esi+0x480]
		asm	or	ax,0x0101
		asm	or	bx,0x0101
		asm	add	ax,bx
		asm	rcr	ax,1
		asm	add	al,ah
		asm	rcr	al,1
		__emit__(0x67,0x8B,0x5E,0x02);//asm	mov	bl,[esi+2]
		__emit__(0x67,0x8A,0xA6,0x82,0x04,0x00,0x00);//asm mov	ah,[esi+0x480+2]
		asm	or	bl,1
		asm	or	ah,1
		asm	add	ah,bl
		asm	rcr	ah,1
		asm	mov	es:[di],ax	//asm	stosw
		asm	add	di,2
		_ESI+=3;
		asm	dec	Line		//asm	loop	LoopLine240
		asm	jnz	LoopDeleteLine240
		////////////Delete line/////////
		_ESI+=(800+0x480);
		asm	dec	dx
		asm	jz	NextRet240
		asm	jmp	MoveVideoData240
		NextRet240:
		}
	else	{
		int	Times=0;
		/////////////352x288/////////
		_DX=Linear;
		__emit__(0x26,0x66,0x8B,0x75,0x04);//asm mov esi,es:[di+4]
		asm	mov	ds,es:[di+0x10]
		asm	mov	es,dx
		_EDI=0;
		_DX=200;//for(i=0;i<200;i++)
		MoveVideoData288:
		////// 352 bytes 32 times.
		asm	inc	Count
		asm	cmp	Count,2
		asm	ja	DrawMix2Lines288
		////// 352 bytes 32 times.
		asm	mov	cx,32
		LoopLine288:
		__emit__(0x66,0x67,0xA5);	//asm	movsd//32bit addr
		__emit__(0x66,0x67,0xA5);	//asm	movsd//32bit addr
		__emit__(0x67,0x8B,0x06);	//asm	mov	ax,[esi]
		asm	or	ax,0x0101
		asm	add	al,ah
		asm	rcr	al,1
		__emit__(0x67,0x8A,0x66,0x02);	//asm	mov	ah,[esi+2]
		asm	mov	es:[di],ax	//asm	stosw
		asm	add	di,2
		_ESI+=3;
		asm	dec	cx		//asm	loop	LoopLine288
		asm	jnz	LoopLine288
		////////////Delete line/////////
		_ESI+=800;
		asm	dec	dx
		asm	jnz	MoveVideoData288
		goto	RETURN;
		DrawMix2Lines288:
		Times++;
		if(Times<8)
			{
			if(Count==4)
				Count=0;
			}
		else	{
			Count=0;
			}
		if(Times==11) Times=0;
		Line=32;
		LoopDeleteLine288:
		asm	mov	cx,4
		Mix2Pixel288:
			__emit__(0x67,0x8B,0x06);//asm	mov	ax,[esi]
			__emit__(0x67,0x8B,0x9E,0x80,0x04,0x00,0x00);//asm mov	bx,[esi+0x480]
			asm	or	ax,0x0101
			asm	or	bx,0x0101
			asm	add	ax,bx
			asm	rcr	ax,1
			asm	mov	es:[di],ax	//asm	stosw
			asm	add	di,2
			_ESI+=2;
			asm	dec	cx
			asm	jnz	Mix2Pixel288
		__emit__(0x67,0x8B,0x06);//asm	mov	ax,[esi]
		__emit__(0x67,0x8B,0x9E,0x80,0x04,0x00,0x00);//asm mov	bx,[esi+0x480]
		asm	or	ax,0x0101
		asm	or	bx,0x0101
		asm	add	ax,bx
		asm	rcr	ax,1
		asm	add	al,ah
		asm	rcr	al,1
		__emit__(0x67,0x8B,0x5E,0x02);//asm	mov	bl,[esi+2]
		__emit__(0x67,0x8A,0xA6,0x82,0x04,0x00,0x00);//asm mov	ah,[esi+0x480+2]
		asm	or	bl,1
		asm	or	ah,1
		asm	add	ah,bl
		asm	rcr	ah,1
		asm	mov	es:[di],ax	//asm	stosw
		asm	add	di,2
		_ESI+=3;
		asm	dec	Line		//asm	loop	LoopLine288
		asm	jnz	LoopDeleteLine288
		////////////Delete line/////////
		_ESI+=(800+0x480);
		asm	dec	dx
		asm	jz	NextRet288
		asm	jmp	MoveVideoData288
		NextRet288:
		}
	RETURN:
	_AX=0;	//return 0;
}
int	DisplayPreView=1;
int	CapturePictureFlags=0;
void	PASCAL _huge DrawYVURGB(LPDCISURFACEINFO lpSurface)
{
	if(!DisplayVideo)
		{
		if(DisplayPreView) PreViewPicture();
		if(CapturePictureFlags) DecodeCapturePicture();
		_AX=0;
		return;
		}
	if(VESAColor==8)
		{//Draw Gray Scale
		DrawGrayScale();
		_AX=0;
		return;
		}
	if(VESAColor==16)
		{//Draw  VESA 64K 320x200
		if(BankingFlags)
			{//S3 no 128K Video Buffer
			DrawS3BankColor();
			_AX=0;
			return;
			}
		else 	{//Normal 128K Video Buffer
			DrawYVU16Color();
			_AX=0;
			return;
			}
		}
	if(VESAColor==15)
		{//Draw  VESA 32K 320x200
		if(BankingFlags)
			{//S3 no 128K Video Buffer
			Draw15BitsBanking();
			_AX=0;
			return;
			}
		else 	{//Normal 128K Video Buffer
			DrawYVU15Color();
			_AX=0;
			return;
			}
		}
	if(VESAColor==163)
		{//Draw S3 86xx 320x200 Banking
		DrawS3BankColor();
		_AX=0;
		return;
		}
	if(VESAColor==64)
		{//640 x 240 VESA 111 640x480 64KC modify
		if(DCIType==1) Draw640x240Banking64KLinear();
		else Draw640x240Banking64K();
		_AX=0;
		return;
		}
	if(VESAColor==32)
		{//640 x 240 VESA 110 640x480 32KC modify
		if(DCIType==1) Draw640x240Banking32KLinear();
		else Draw640x240Banking32K();
		_AX=0;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -