	.386p

INCLUDE	..\common\vgadrvr.inc

_CODE	SEGMENT DWORD PUBLIC 'CODE'

ASSUME	cs:_CODE

	org 0

mspo	EQU	offset	set_page
cco	EQU	offset CCOPY

head	vga_header	<,,6ah,74h,,61h,62h,63h,,,,mspo,mspl,mspo,mspl,cco,ccl>

NUMPAGES	equ	2

setpage	MACRO	srcpage,dstpage	; page to be set is in ah
	IFIDN	<dstpage>,<ah>	; dst == ah
	IFIDN	<srcpage>,<ah>	; dst == ah && src == ah
	mov	al,ah
	shl	ah,4
	or	ah,al
	ELSE			; dst == ah && src != ah
	shl	ah,4
	or	ah,srcpage
	ENDIF
	ELSE			; dst != ah
	IFIDN	<srcpage>,<ah>	; dst != ah && src == ah
	IFDIF	<dstpage>,<al>	; dst != ah && src == ah && dst != al
	mov	al,dstpage
	ENDIF
	shl	al,4
	or	ah,al
	ELSE			; dst != ah && src != ah
	mov	ah,dstpage
	shl	ah,4
	or	ah,srcpage
	ENDIF
	ENDIF

	mov	al,0dh		; register 0dh
	push	dx
	mov	dx,03ceh
	out	dx,ax		; set the page
	pop	dx
	ENDM

set_page PROC NEAR
	push	edx
	mov	ah,al		; page
	shl	al,4
	or	ah,al
	mov	al,0dh		; register 0dh
	mov	dx,03ceh
	out	dx,ax		; set the page
	pop	edx
	ret
mspl	EQU	$ - offset set_page
set_page ENDP

include	ccopy2.asm

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


_CODE	ENDS

	END
