*
 * Module i8086.h  V011HM01 === 012490
 *
 * 012490 011H01 sbw  Added __rol__, __ror__, __sel__, __inportw__, and
 *			 __outportw__.
 *
 *
 *
 *    PROPRIETARY PROGRAM MATERIAL
 * REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
 * OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
 *
 * COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
 * COPYRIGHT (C) 1990 UNISYS CORPORATION
 *
 *


struct XREG
	{
	short ax,bx,cx,dx,si,di;
	};

struct HREG
	{
	unsigned char al,ah,bl,bh,cl,ch,dl,dh;
	};

union	REGS	{
	struct	XREG	x;
	struct	HREG	h;
	};

struct	SREGS	{
	short	es;
	short	cs;
	short	ss;
	short	ds;
	};


define	segmentof(farptr) ((unsigned)((unsigned long)(farptr) >> 16))
define	addressat(segment) ((void *far)((unsigned long)(segment) << 16))


int	peek(unsigned segment, unsigned offset);
void	poke(unsigned segment, unsigned offset, int value);
int	peekb(unsigned segment, unsigned offset);
void	pokeb(unsigned segment, unsigned offset, char value);
int	inport(int portid);
int	inportb(int portid);
void	outport(int portid, int value);
void	outportb(int portid, char value);
void	movmem(void *source, void *destination, unsigned length);
void	setmem(void *destination, unsigned length, char value);
void	disable();
void	enable(void);


*
 *  011H01  sbw
 *
 *  These are inline functions.  These prototypes just clean up
 *  some syntax checks and code generation.  All inline functions
 *  assume C calling sequence: for 'p' environments, redefine
 *  with an ellipsis to force C calling sequence.
 *
 *

void		__cli__( void ) ;  * Clear interrupts  *
void		__sti__( void ) ;  * Enable interrupts *

void		__int__( int intnumber ) ;  * Generate an interrupt *

unsigned char	__inportb__( unsigned port ) ;  * Port byte input          *
unsigned	__inportw__( unsigned port ) ;  * Port word input and +  *
								     *  |  *
void		__outportb__( unsigned port, unsigned char value ) ; * out *
void		__outportw__( unsigned port, unsigned      value ) ; * put *

*
 *  Rotate a 16 bit pattern left or right.
 *
 *

unsigned	__rol__( unsigned pattern, unsigned char count ) ;
unsigned	__ror__( unsigned pattern, unsigned char count ) ;

*
 *  __sel__: Selector of a far pointer VARIABLE ONLY  Do not use with a
 *  a pointer expression.  (May also be used with a long or unsigned long
 *  argument to acquire the most significant 16 bits).
 *
 *

unsigned	__sel__( void * far pointer ) ;



define	disable()	__cli__()		* Clear interrupt flag *
define	enable()	__sti__()		* Set interrupt flag *
define	inportb(portid)	__inportb__(portid)	* Byte IN instruction *
define	outportb(portid, v) __outportb__(portid, v)* Byte OUT instruction *
define	geninterrupt(i)	__int__(i)		* Interrupt instruction *

define	poke(a, b, c)	(*(int *far)(segmentof(a) + (b)) = (int)(c))
define	pokeb(a, b, c)	(*(char *far)(segmentof(a) + (b)) = (char)(c))
define	peek(a, b)	(*(int *far)(segmentof(a) + (b)))
define	peekb(a, b)	(*(char *far)(segmentof(a) + (b)))


MMMNMMMM