;       SCCSID = @(#)d_getver.asm	6.1 91/02/15
;      SCCSID = @(#)d_getver.asm	6.2 90/01/22
; ****************************************************************************
; *									     *
; *			  IBM/Microsoft Confidential			     *
; *									     *
; *		    Copyright (c) IBM Corporation  1987, 1990		     *
; *		    Copyright (c) Microsoft Corp.  1987, 1990		     *
; *			      All Rights Reserved			     *
; *									     *
; ****************************************************************************
;***  d_getver.asm - API stub routine DosGetVersion
;
;	Member of API library
;	Bill Mershon
;	Copyright MicroSoft Corporation, 1986
;	15-Apr-1986
;
;	library routine for API simulator
;
;	Called from dos 2.x,3.x compatible dos 5.x applications
;
;	Special Information
;		none
;
;	Modification History
;
;	13-Jan-87 (billme): Clean up version code; call local version
;	provider (__api_getvrsn) in all cases (since this is smaller).
;

INCLUDE dos2equ.inc

	EXTRN	_api_getvrsn : near

;***	DOSGETVERSION - stub to emulate DOSGETVERSION function call
;
;	simulates DOS 5.0 call from DOS 2.x,3.x environment
;
;	errorcode = unsigned far pascal
;	DosGetVersion (ptr_VersionWord)
;
;	ENTRY:
;		- ptr_VersionWord = pointer to word for version return
;
;	RETURN:
;		AX - 0 (no error)
;
;	EXIT:
;
;	USES:
;		AX
;
;	Pseudo Code:
;		save registers
;		use BP as pointer to stack parameters
;		call local api version keeper
;		restore registers
;		return
;
;	WARNING:
;		may return error code from Dos 2.x, 3.x (see dos manuals)
;
;	EFFECTS:
;		none
;

	title	DOSGETVERSION - stub to emulate DOSGETVERSION function call
;
;	EXTRN	DOSGETVERSION:FAR
;
;	PUSH	@WORD ptr_VersionWord
;	CALL	DOSGETVERSION
;


_TEXT	segment byte public 'CODE'

	assume	CS:_TEXT,DS:NOTHING

	public	DOSGETVERSION

ptr_VersionWord	equ	[BP+6]

DOSGETVERSION	proc	far
	push	bp
	mov	bp,sp
	push	ds

	call	_api_getvrsn		; AH <- major, AL <- minor version
	lds	bp,[ptr_VersionWord]	; DS:BP <- pointer to ret addr
	mov	ds:[bp],ax		; store result
	xor	ax,ax			; no error

	pop	ds
	pop	bp
	ret	4	; clear stack of entry parameters (bytes)
DOSGETVERSION	endp

_TEXT	ends

	end
