include	clib.inc

PPROC	emminit
	xor	ax,ax
	mov	es,ax
	mov	bx,67h*4+2
	mov	ax,es:[bx]
	mov	es,ax
	mov	bx,10
	mov	ax,es:[bx]
	cmp	ax,'ME'
	jne	emminit_err
	mov	ax,es:[bx+2]
	cmp	ax,'XM'
	jne	emminit_err
	mov	ah,46h		; get EMM version
	int	67h
	test	ah,ah
	jnz	emminit_err
	cmp	al,40h		; 4.0
	jb      emminit_err
	mov	ax,1
    emminit_end:
	test	ax,ax
	ret
    emminit_err:
	xor	ax,ax
	jmp	emminit_end
PEND	emminit

	END
