
#define ONEBYTE		8
#define V_BIOS      0x10	/* Video Bios Int. NO. */
#define BIOS_WORK   0x0040	/* BIOS work data area segment address */

/* Machine type information */
#define DYNAD 0		/* DCGA only */
#define DYNAV 0		/* supports VGA */

/* Display resolution */
#define RES_640_400 0		/* DCGA 640 x 400 / 2 color  */
#define RES_640_480 1		/* VGA  640 x 480 / 16 color */

/* Video Mode information */
#define VMODE_DYNAV	0x62;
#define VMODE_DCGA	0x74;
#define VMODE_UNKNOWN     0xFFFF

#undef LOOK_SMOOTH	/* To look smooth in hard scrolling */
#define	LOOK_SMOOTH
#define WEIGHT 900	/* Display weight to look smooth */

#define G_TOP_DCGA	0xb8000000L
#define G_TOP_VGA   0xa0000000L

#define	G_SEG_DCGA	0xb800
#define G_SEG_VGA   0xa000

#define	G_ID		0xafff0008L
#define	T_ID		0xa0000008L

#define G_WIDTH_B_MAX	80
#define G_WIDTH_B_DCGA	80
#define G_WIDTH_B_VGA	80

#define G_HEIGHT_DCGA	400
#define G_HEIGHT_VGA	480

#define	G_DEPTH		0x2000

#define HIGH_MONO	2
#define ON			1
#define OFF			0
#define ESC			0x1b
#define	V_SHIFT		1
#define	CRT_BIOS	0x10
#define GRAM_BUF	uchar far
#define	MAX_VIEW	16

/* VGA regieters */
#define START_ADDRESS_HIGH  0X0C
#define START_ADDRESS_LOW   0X0D
#define AC_INDEX           0X3C0
#define AC_HPP             0X13 | 0X20
#define OFFSET_REG         0X013

struct VIEW {
	int current;	/* current screen to be saved	*/
	int total;	/* total screen saved			*/
	int page[MAX_VIEW];	/* page numbers for screens		*/
};

struct SCROLL {
	/* output parameter. send to scroll-functions and other device-output-
     * functions
     */
	uint offset;
	/* skipped bytes due to horizontal scroll */
	uint r_line;
	/* number of lines of the second part of screen */
	int x;
	int y;
	/* the current positioin in bitmap. */
	int gw_act, gh_act;
	/* width and height to output on screen */
	BOOL x_lock, y_lock;
	/* permition to scroll horizontal and vertical direction. */
	HUGE_BUF *mptr;
	/* the current position of bitmap pointer */
	int h_spc, v_spc;
	/* h_spc and v_spc is to put at the center of the screen */

};

/* light color element */
struct COLOR_ELEMENT {
	unsigned char r;
	unsigned char g;
	unsigned char b;
};

struct PALETTE {
	struct COLOR_ELEMENT fg;
	struct COLOR_ELEMENT bg;
};

typedef enum {
	BackSpace, SpaceKey,	/* PreviousPart, NextPart   */
	Key_P, Key_N,	/* PreviousPage, NextPage   */
	CaridgeReturn,	/* NextPageDirection        */
	EscapeKey,	/* EscapeQuit               */
	Key_Q,	/* Same as above            */
	Key_B,	/* Another Previous Page	*/
	Key_V,	/* View outline				*/
	Key_C,	/* Comressed View			*/
	Key_R,	/* Reverse					*/
	Key_H,	/* HELP 					*/
	HELP,	/* Help key					*/
	Key_M,	/* Move to a page			*/
	Key_G,	/* Same as above			*/
	ArrowDown, ArrowUp, ArrowLeft, ArrowRight,
	ShiftDown, ShiftUp, ShiftLeft, ShiftRight, LoopEnd
} KeyInput;
