	name	everex

	.386p

INCLUDE	..\common\vgadrvr.inc

_CODE	SEGMENT DWORD PUBLIC 'CODE'

ASSUME	cs:_CODE

	org	0

smo	EQU	offset set_mode
mspo	EQU	offset set_page
cco	EQU	offset CCOPY

head	vga_header	<,,02h,20h,,30h,31h,0,,smo,sml,mspo,mspl,mspo,mspl,cco,ccl>

NUMPAGES	equ	1

setpage	MACRO	page
	IFDIFI	<page>,<ah>	; page != ah
	mov	ah,page
	ENDIF
	xor	ah,2		; invert bit
	mov	al,0eh		; register 0eh
	push	dx
	mov	dx,03c4h
	out	dx,al		; set the page
	inc	dx
	in	al,dx
	and	al,0f0h
	or	al,ah
	out	dx,al
	pop	dx
ENDM

set_mode	PROC NEAR
	xor	ah,ah		; function 0 = set mode
	cmp	al,11h		; is it standard 640x480 mono???
	jne	short local_special
	int	10h
	jmp	short local_ret
local_special:
	push	edx
	push	ebx
	mov	ebx,eax		; mode goes in bx
	mov	ax,70h		; enhanced mode set
	int	10h
	mov	dx,3c4h
	mov	al,0bh
	cli
	out	dx,al
	inc	edx
	in	al,dx		; enable extended registers
	mov	dx,3ceh
	mov	al,6
	out	dx,al
	inc	edx
	in	al,dx
	and	al,0f3h
	or	al,4
	out	dx,al
	sti
	pop	ebx
	pop	edx
local_ret:
	xor	eax,eax		; return OK
	ret
sml	EQU	$ - offset set_mode
set_mode	ENDP

include ccopy1.asm

copyright db	10, 13, 'Everex Viewpoint driver '
include version.asm
include date.asm
	db	10, 13
	db	'Copyright (c) 1992 Starnet Communications '
	db	'Corporation. All rights reserved.',10,13,'$'

set_page	PROC NEAR
	push	edx
	mov	ah,al
	xor	ah,2		; invert bit
	mov	al,0eh		; register 0eh
	mov	dx,03c4h
	out	dx,al		; set the page
	inc	edx
	in	al,dx
	and	al,0f0h
	or	al,ah
	out	dx,al
	pop	edx
	ret
mspl	EQU	$ - offset set_page
set_page	ENDP

_CODE	ENDS
	END
