	name	vesa

	.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	<,0011h,0102h,0104h,0106h,0101h,0103h,0105h,0107h,smo,sml,mspo,mspl,mspo,mspl,cco,ccl>

NUMPAGES	equ	2

setpage	MACRO	page
	push	eax
	push	ebx

	IFDIFI	<page>,<dx>	; dst != dx
	push	edx
	mov	dx,page
	ENDIF

	mov	ax,4f05h
	sub	ebx,ebx
	int	10h

	mov	ax,4f05h
	inc	ebx		; Window B
	int	10h

	IFDIFI	<page>,<dx>	; dst != dx
	pop	edx
	ENDIF
	pop	ebx
	pop	eax
		ENDM

set_mode	PROC NEAR
	cmp	ax,0100h
	jl	set_normal
	push	ebx
	mov	ebx,eax
	mov	ax,4f02h
	int	10h
	cmp	ax,004fh
	jne	local_bad
	xor	eax,eax		; return OK
	pop	ebx
	ret
local_bad:
	mov	eax,1
	pop	ebx
	ret
set_normal:
	int	10h
	sub	eax,eax
	ret
sml	EQU	$ - offset set_mode
set_mode	ENDP


include	vesacopy.asm

copyright db	10, 13, 'VESA 2-page 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
	push	ebx

	mov	dx,ax
	mov	ax,4f05h
	sub	ebx,ebx		; page 0
	int	10h

	mov	ax,4f05h
	inc	ebx		; page 1

	pop	ebx
	pop	edx
	ret
mspl	EQU	$ - offset set_page
set_page	ENDP

_CODE	ENDS
	END
