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

📄 hal_splt.c

📁 一个图形显示芯片s1d13505的应用程序
💻 C
字号:
/*
**===========================================================================
**	HAL_SPLT.C
**---------------------------------------------------------------------------
** Copyright (c) 1997, 1998 Epson Research and Development, Inc.
** All Rights Reserved.
**===========================================================================
*/

#include <stdlib.h>

#ifdef INTEL
#include <stdio.h>
#endif

#include "hal.h"
#include "assert.h"
#include "nonsefns.h"

/*-------------------------------------------------------------------------*/

static const char Revision[] = "HAL_SPLT.C=$Revision: 1 $";

/*-------------------------------------------------------------------------*/

int seSplitInit( int seReserved1, DWORD dwScrn1Addr, DWORD dwScrn2Addr )
{
	ASSERT( 0 == seReserved1 );

	/*
	** Wait for the correct time to access the start address registers.
	** (either the start or end of a non-display period)
	**
	** We don't know how to do this - YET!
	*/
	// WHILE (NDP);
	// WHILE (!NDP);

   /*
   ** Convert from byte addr to word addr
   */
   dwScrn1Addr /= 2;
   dwScrn2Addr /= 2;

	/*
	** Write new start address
	*/
	WriteRegister( seReserved1, REG_SCRN1_DISP_START_ADDR0, (BYTE) (dwScrn1Addr & 0xff) );
	WriteRegister( seReserved1, REG_SCRN1_DISP_START_ADDR1, (BYTE) ((dwScrn1Addr >> 8) & 0xff) );
	WriteRegister( seReserved1, REG_SCRN1_DISP_START_ADDR2, (BYTE) ((dwScrn1Addr >> 16) & 0xff) );

	WriteRegister( seReserved1, REG_SCRN2_DISP_START_ADDR0, (BYTE) (dwScrn2Addr & 0xff) );
	WriteRegister( seReserved1, REG_SCRN2_DISP_START_ADDR1, (BYTE) ((dwScrn2Addr >> 8) & 0xff) );
	WriteRegister( seReserved1, REG_SCRN2_DISP_START_ADDR2, (BYTE) ((dwScrn2Addr >> 16) & 0xff) );

	WriteRegister( seReserved1, REG_SCRN1_LINE_COMPARE0, 0xFF );
	WriteRegister( seReserved1, REG_SCRN1_LINE_COMPARE1, 0x03 );

	return ERR_OK;
}

/*-------------------------------------------------------------------------*/

/*
** seSplitScreen()
**
**	This function alters the size of the two visible screens.
**	The whichscreen argument determines which screen will be changed
**	to VisibleScanLines in size. The other screen will be implicitly
**	altered by this action.
*/
int seSplitScreen( int nReserved1, int WhichScreen, long VisibleScanlines )
{
	UINT x, y;
   BYTE regVertNonDisp;


	/*
	** Error checking.
	** Ensure we have a valid 'device' handle.
	** Ensure we have a valid 'WhichScreen'.
	** Ensure we have a valid 'VisibleScanLines' (i.e. >= 0 && <= Panel.x)
	*/

	ASSERT( 0 == nReserved1 );

	if ((SCREEN1 != WhichScreen) && (SCREEN2 != WhichScreen))
		return ERR_HAL_BAD_ARG;

	seGetScreenSize( nReserved1, &x, &y );

	if ((VisibleScanlines < 0) || (VisibleScanlines > (int) y))
		return ERR_HAL_BAD_ARG;

	/*
	** If the user has specified the screen2 size then calculate it.
	*/
	if (SCREEN2 == WhichScreen)
		VisibleScanlines = y - VisibleScanlines;

   do
      regVertNonDisp = ReadRegister(nReserved1, REG_VERT_NONDISP_PERIOD);
   while (regVertNonDisp & 0x80);   /* Get out of current VNDP */

   do
      regVertNonDisp = ReadRegister(nReserved1, REG_VERT_NONDISP_PERIOD);
   while (!(regVertNonDisp & 0x80));   /* Get out of VDP */

	WriteRegister( nReserved1, REG_SCRN1_LINE_COMPARE0, LOBYTE( VisibleScanlines ));
	WriteRegister( nReserved1, REG_SCRN1_LINE_COMPARE1, HIBYTE( VisibleScanlines ));

	return ERR_OK;
}

/*-------------------------------------------------------------------------*/

⌨️ 快捷键说明

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