#include "atari.h"
#include "cpu.h"
#include "mem.h"

static char *rcsid = "$Id: supercart.c,v 1.4 1998/02/17 thor,david Exp $";

extern int cart_type;

int SwapIn0(mtype byte)
{

  switch(CartType()) {
  case OSS_SUPERCART:
    ChangeMapping(TRUE,FALSE,FALSE,TRUE);
    break;
  case DB_SUPERCART:
    ChangeMapping(TRUE,FALSE,FALSE,TRUE);
    break;
  }

  return FALSE;
}

int SwapIn1(mtype byte)
{

  switch(CartType()) {
  case DB_SUPERCART:
    ChangeMapping(FALSE,TRUE,FALSE,TRUE);
    break;
  }

  return FALSE;
}

int SwapIn3(mtype byte)
{

  switch(CartType()) {
  case OSS_SUPERCART:
    ChangeMapping(FALSE,FALSE,TRUE,TRUE);
    break;
  }

  return FALSE;
}

int SwapIn4(mtype byte)
{

  switch(CartType()) {
  case OSS_SUPERCART:
    ChangeMapping(FALSE,TRUE,FALSE,TRUE);
    break;
  }

  return FALSE;
}

int SwapIn6(mtype byte)
{

  switch(CartType()) {
  case DB_SUPERCART:
    ChangeMapping(FALSE,FALSE,TRUE,TRUE);
    break;
  }

  return FALSE;
}

int SwapIn7(mtype byte)
{

  switch(CartType()) {
  case OSS_SUPERCART:
    ChangeMapping(FALSE,FALSE,TRUE,TRUE);
    break;
  }
  return FALSE;
}

int SwapIn8(mtype byte)
{

  switch(CartType()) {
  case OSS_SUPERCART:
    TurnOffCart();
    break;
  case DB_SUPERCART:
    ChangeMapping(TRUE,FALSE,FALSE,TRUE);
    break;
  }

  return FALSE;
}

int SwapIn9(mtype byte)
{
 
  switch(CartType()) {
  case DB_SUPERCART:
    ChangeMapping(FALSE,TRUE,FALSE,TRUE);
    break;
  }

  return FALSE;
}

int SwapInE(mtype byte)
{

  switch(CartType()) {
  case DB_SUPERCART:
    ChangeMapping(FALSE,FALSE,TRUE,TRUE);
    break;
  }

  return FALSE;
}

void Init_Super(int argc,char **argv,int base)
{
  SetHW(base+0x0,0xff0f,NULL,&SwapIn0);
  SetHW(base+0x1,0xff0f,NULL,&SwapIn1);
  SetHW(base+0x3,0xff0f,NULL,&SwapIn3);
  SetHW(base+0x4,0xff0f,NULL,&SwapIn4);
  SetHW(base+0x6,0xff0f,NULL,&SwapIn6);
  SetHW(base+0x7,0xff0f,NULL,&SwapIn7);
  SetHW(base+0x8,0xff0f,NULL,&SwapIn8);
  SetHW(base+0x9,0xff0f,NULL,&SwapIn9);
  SetHW(base+0xe,0xff0f,NULL,&SwapInE);
}

