	name	trident

	.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	<,,5bh,5fh,,5dh,0,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
;	push	ebx
	xor	ah,ah		; function 0 = set mode
;	mov	bl,al		; save mode
	int	10h
	; read the mode back from BIOS to make sure we actually changed
	; it
;	mov	ah,0fh
;	int	10h		; get current mode
;	cmp	al,bl
;	jnz	local_bad
	push	edx
	mov	edx,3c4h
	mov	al,0bh
	cli
	out	dx,al
	inc	edx
	in	al,dx		; enable extended registers
	mov	edx,3ceh
	mov	al,6
	out	dx,al
	inc	edx
	in	al,dx
	and	al,0f3h
	or	al,4
	out	dx,al
	sti
	pop	edx
;	pop	ebx
	xor	eax,eax		; return OK
	ret
;local_bad:
;	mov	ax,08002h	; non-supported mode
;	ret
sml	EQU	$ - offset set_mode
set_mode	ENDP

copyright db	10, 13, 'Trident TVGA 8800 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		; page
	xor	ah,2		; invert bit
	mov	al,0eh		; register 0eh
	mov	dx,03c4h
	out	dx,al		; set the page
	inc	dx
	in	al,dx
	and	al,0f0h
	or	al,ah
	out	dx,al
	pop	edx
	ret
mspl	EQU	$ - offset set_page
set_page ENDP

include	ccopy1.asm

_CODE	ENDS

	END
