	title	ATXT - distinguish which processor is whom
	include dos.mac

	PSEG

;; This is callable from C and returns a boolean value.	 The codes are
;;	0 - an 8088
;;	1 - a 286
;; other codes may be added
	public	_ATXT
	if	LPROG
_ATXT	proc	far
	else
_ATXT	proc	near
	endif

; push the SP.	If we are an 8086/8088, we will have the new SP; 
; if we are an 80286 we will have the old sp

	push	bx

	mov	bx,sp	; save current sp

	push	sp	; push it (this is the test!)

; if sp = tos we are an 8088

	pop	ax	; get the value we just pushed
	cmp	ax,bx	; is it same as sp before push?
	je	L286	; yes, we pushed current SP and we are an 80286
	; it is different, it was incremented before pushing, we are
	; an 8088
	xor	ax,ax	; set ax to 0
	jmp	return
L286:	mov	ax,1	; set ax to 1, meaning '286
return: pop	bx	; restore bx
	ret
_ATXT	ENDP
	ENDPS
	end
