	.MODEL  TINY
	.486
	INCLUDE DOS.INC

	.DATA

INT6OLD	DD		?
M86	DB		"This is a 8080(8086) machine.",13,10,"$"
M186	DB		"This is a 186 machine.",13,10,"$"
M286	DB		"This is a 286 machine.",13,10,"$"
M386	DB		"This is a 386 machine.",13,10,"$"
M486	DB		"This is a 486 machine.",13,10,"$"
M586	DB		"This is a Pentium machine.",13,10,"$"
MHELL	DB		"Unknown machine!",13,10,"$"
INVALID	DB		0

	.CODE

INT6	PROC NEAR
	MOV		INVALID, 1
	PUSH		BP
	MOV		BP, SP
	ADD		WORD PTR SS:[BP+2], 3
	POP		BP
	IRET
INT6	ENDP

	.STARTUP

	@GETINT		6
	MOV		WORD PTR INT6OLD, BX
	MOV		WORD PTR INT6OLD+2, ES
	@SETINT		6, INT6
	PUSH		SP
	POP		AX
	CMP		AX, SP
	JE		@@NOT86
	LEA		DX, M86
	JMP		@@DONE
@@NOT86:
	XADD		DX, DX
	CMP		INVALID, 0
	JNE		@@NOT486
	PUSHFD
	POP		EAX
	MOV		ECX, EAX
	XOR		EAX, 200000H
	PUSH		EAX
	POPFD
	PUSHFD
	POP		EAX
	PUSH		ECX
	POPFD
	AND		EAX, 200000H
	AND		ECX, 200000H
	CMP		EAX, ECX
	JE		@@486
	LEA		DX, M586
	JMP		@@DONE
@@486:
	LEA		DX, M486
	JMP		@@DONE
@@NOT486:
	MOV		INVALID, 0
	MOV		EDX, CR0
	CMP		INVALID, 0
	JNE		@@NOT386
	LEA		DX, M386
	JMP		@@DONE
@@NOT386:
	MOV		INVALID, 0
	SMSW		DX
	CMP		INVALID, 0
	JNE		@@NOT286
	LEA		DX, M286
	JMP		@@DONE
@@NOT286:
	MOV		INVALID, 0
	SHL		DX, 5
	CMP		INVALID, 0
	JNE		@@NOT186
	LEA		DX, M186
	JMP		@@DONE
@@NOT186:
	LEA		DX, MHELL
@@DONE:
	MOV		AH, 9
	INT		21H
	@SETINT		6, INT6OLD
	@EXIT		0
	END
