/*
 *  This file is part of ixemul.library for the Amiga.
 *  Copyright (C) 1994  Rafael W. Luebbert
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Library General Public
 *  License as published by the Free Software Foundation; either
 *  version 2 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public
 *  License along with this library; if not, write to the Free
 *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *  $Id: hwck.c,v 1.3 1994/10/18 09:12:51 rluebbert Exp $
 *
 *  $Log: hwck.c,v $
 * Revision 1.3  1994/10/18  09:12:51  rluebbert
 * Check for math emulation code (881 || 882) in 040s.  Assume no FPU otherwise.
 * No 040 FPU instruction support yet.
 *
 * Revision 1.2  1994/06/22  14:56:04  rluebbert
 * added struct ExecBase **4
 *
 * Revision 1.1  1994/06/19  15:11:39  rluebbert
 * Initial revision
 *
 */

#include <exec/execbase.h>

struct ExecBase *SysBase;

int
check_hardware (void)
{
SysBase = *(struct ExecBase **)4;
#if defined (m68020) || defined (m68030) || defined (m68040) || defined (m68060)
if ( (SysBase->AttnFlags & AFF_68020) || (SysBase->AttnFlags & AFF_68030) ||
	(SysBase->AttnFlags & AFF_68040) );
else
   {
   ix_panic("This ixemul version requires a 68020/30/40.");
   return 0;
   }
#endif
#ifdef __HAVE_68881
if( (SysBase->AttnFlags & AFF_68881) || (SysBase->AttnFlags & AFF_68882));
else
	{
	if( (SysBase->AttnFlags & AFF_68040)
		ix_panic("68040 math emulation code not found.");
	else
		ix_panic("This ixemul version requires an FPU.");
	return 0;
	}
#endif
return 1;
}

int betterthan68000()
{
SysBase = *(struct ExecBase **)4;
if ( (SysBase->AttnFlags & AFF_68020) || (SysBase->AttnFlags & AFF_68030) ||
	(SysBase->AttnFlags & AFF_68040) )
	return 1;
return 0;
}

int gotanfpu()
{
SysBase = *(struct ExecBase **)4;
if ( (SysBase->AttnFlags & AFF_68881) || (SysBase->AttnFlags & AFF_68882))
	return 1;
return 0;
}
