hal_mem.c

来自「epson 13506 driver code」· C语言 代码 · 共 138 行

C
138
字号
/*
**===========================================================================
** HAL_MEM.C - This module contains the memory access funtions for the HAL.
**---------------------------------------------------------------------------
** Copyright (c) 1997, 2001 Epson Research and Development, Inc.
** All Rights Reserved.
**===========================================================================
*/

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

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

static const char Revision[] = "HAL_MEM.C=$Revision: 12 $";

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

/*
**	seReadDisplayByte()
*/
unsigned seReadDisplayByte(DWORD offset)
{
#ifdef INTEL_DOS
   return _READXB(_DispLinearAddress + offset);
#else
	return *((BYTE *) _DispLinearAddress + offset);
#endif
}

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

/*
**	seWriteDisplayBytes()
*/
void seWriteDisplayBytes(DWORD offset, unsigned val, DWORD count)
{
#ifndef INTEL_DOS
   BYTE *bpt;
#endif

#ifdef INTEL_DOS
   _asmWriteBytes(_DispLinearAddress + offset, val, count);
#else
	bpt = (BYTE *) (_DispLinearAddress + offset);

	while (count > 0)
	{
		*bpt = (BYTE) val;
		bpt++;
		count--;
	}
#endif
}

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

/*
** seReadDisplayWord()
*/
unsigned seReadDisplayWord(DWORD offset)
{
#ifdef INTEL_DOS
   return _READXW(_DispLinearAddress + offset);
#else
	return *((WORD *) (_DispLinearAddress + offset));
#endif
}

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

/*
** seWriteDisplayWords()
*/
void seWriteDisplayWords(DWORD offset, unsigned val, DWORD count)
{
#ifndef INTEL_DOS
   WORD *wpt;
#endif

#ifdef INTEL_DOS
   _asmWriteWords(_DispLinearAddress + offset, val, count);
#else
	wpt = (WORD *) (_DispLinearAddress + offset);

	while (count > 0)
	{
		*wpt = (WORD) val;
		wpt++;
		count--;
	}
#endif
}

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

/*
** seReadDisplayDword()
*/
DWORD seReadDisplayDword(DWORD offset)
{
#ifdef INTEL_DOS
   return _asmReadDword(_DispLinearAddress + offset);
#else
	return *((DWORD *) (_DispLinearAddress + offset));
#endif
}

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

/*
** seWriteDisplayDwords()
*/
void seWriteDisplayDwords(DWORD offset, DWORD val, DWORD count)
{
#ifndef INTEL_DOS
   DWORD *dwpt;
#endif

#ifdef INTEL_DOS
   _asmWriteDwords(_DispLinearAddress + offset, val, count);
#else
	dwpt = (DWORD *) (_DispLinearAddress + offset);

	while (count > 0)
	{
		*dwpt = val;
		dwpt++;
		count--;
	}
#endif
}

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


⌨️ 快捷键说明

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