Esempio n. 1
0
static uint32 PCECD_GetRegister(const std::string &name, std::string *special)
{
 uint32 value = 0xDEADBEEF;

 if(name == "BSY")
  value = SCSICD_GetBSY();
 else if(name == "REQ")
  value = SCSICD_GetREQ();
 else if(name == "MSG")
  value = SCSICD_GetMSG();
 else if(name == "CD")
  value = SCSICD_GetCD();
 else if(name == "IO")
  value = SCSICD_GetIO();
 else if(name == "SEL")
  value = SCSICD_GetSEL();
 else
  value = ADPCM_GetRegister(name, special);
 return(value);
}
Esempio n. 2
0
MDFN_FASTCALL uint8 PCECD_Read(uint32 timestamp, uint32 A, int32 &next_event, const bool PeekMode)
{
 uint8 ret = 0;

 if((A & 0x18c0) == 0x18c0)
 {
  switch (A & 0x18cf)
  {
   case 0x18c1: ret = 0xaa; break;
   case 0x18c2:	ret = 0x55; break;
   case 0x18c3: ret = 0x00; break;
   case 0x18c5:	ret = 0xaa; break;
   case 0x18c6: ret = 0x55; break;
   case 0x18c7:	ret = 0x03; break;
  }
 }
 else
 {
  if(!PeekMode)
   PCECD_Run(timestamp);

  switch(A & 0xf)
  {
   case 0x0:
    ret = 0;
    ret |= SCSICD_GetBSY() ? 0x80 : 0x00;
    ret |= SCSICD_GetREQ() ? 0x40 : 0x00;
    ret |= SCSICD_GetMSG() ? 0x20 : 0x00;
    ret |= SCSICD_GetCD() ? 0x10 : 0x00;
    ret |= SCSICD_GetIO() ? 0x08 : 0x00;
    break;

   case 0x1: ret = SCSICD_GetDB();
	     break;

   case 0x2: ret = _Port[2];
	     break;

   case 0x3: bBRAMEnabled = false;

	     /* switch left/right of digitized cd playback */
	     ret = _Port[0x3];
	     if(!PeekMode)
	      _Port[0x3] ^= 2;
	     break;

   case 0x4: ret = _Port[4];
	     break;

   case 0x5: if(_Port[0x3] & 0x2)
	      ret = RawPCMVolumeCache[1] & 0xff;	// Right
	     else
	      ret = RawPCMVolumeCache[0] & 0xff;	// Left
	     break;

   case 0x6: if(_Port[0x3] & 0x2)
	      ret = ((uint16)RawPCMVolumeCache[1]) >> 8;	// Right
	     else
	      ret = ((uint16)RawPCMVolumeCache[0]) >> 8;	// Left
	     break;

   case 0x7:
    if(SubChannelFIFO.CanRead() > 0)
     ret = SubChannelFIFO.ReadByte(PeekMode);
    else
     ret = 0x00;	// Not sure if it's 0, 0xFF, the last byte read, or something else.

    if(!PeekMode)
    {
     if(SubChannelFIFO.CanRead() == 0)
     {
      _Port[0x3] &= ~0x10;
      update_irq_state();
     }
    }
    break;

   case 0x8:
    ret = read_1808(timestamp, PeekMode);
    break;

   case 0xa: 
    if(!PeekMode)
    {
     ADPCM_DEBUG("ReadBuffer\n");
     ADPCM.ReadPending = 19 * 3; //24 * 3;
    }

    ret = ADPCM.ReadBuffer;

    break;

   case 0xb: 
    ret = _Port[0xb];
    break;

   case 0xc:
    //printf("ADPCM Status Read: %d\n", timestamp);
    ret = 0x00;

    ret |= (ADPCM.EndReached) ? 0x01 : 0x00;
    ret |= (ADPCM.Playing) ? 0x08 : 0x00;
    ret |= (ADPCM.WritePending > 0) ? 0x04 : 0x00;
    ret |= (ADPCM.ReadPending > 0) ? 0x80 : 0x00;
    break;   

   case 0xd: 
    ret = ADPCM.LastCmd;
    break;
  }
 }
Esempio n. 3
0
uint8 PCECD_Read(uint32 A)
{
 uint8 ret = 0;

 if((A & 0x18c0) == 0x18c0)
 {
  switch (A & 0x18cf)
  {
   case 0x18c1: ret = 0xaa; break;
   case 0x18c2:	ret = 0x55; break;
   case 0x18c3: ret = 0x00; break;
   case 0x18c5:	ret = 0xaa; break;
   case 0x18c6: ret = 0x55; break;
   case 0x18c7:	ret = 0x03; break;
  }
 }
 else switch(A & 0xf)
 {
  case 0x0:
   ret = 0;
   ret |= SCSICD_GetBSY() ? 0x80 : 0x00;
   ret |= SCSICD_GetREQ() ? 0x40 : 0x00;
   ret |= SCSICD_GetMSG() ? 0x20 : 0x00;
   ret |= SCSICD_GetCD() ? 0x10 : 0x00;
   ret |= SCSICD_GetIO() ? 0x08 : 0x00;
   break;

  case 0x1: ret = SCSICD_GetDB(); break;

  case 0x2: ret = _Port[2]; break; //ret = _Port[2] & 0x7f; ret |= SCSICD_GetACK() ? 0x80 : 0x00; break;

  case 0x3:
   bBRAMEnabled = FALSE;

   /* switch left/right of digitized cd playback */
   ret = _Port[0x3];
   if(!PCE_InDebug)
    _Port[0x3] ^= 2;
   break;

  case 0x4: ret = _Port[4]; break;

  case 0x5:
   if(_Port[0x3] & 0x2)
    ret = RawPCMVolumeCache[1]&0xff;	// Right
   else
    ret = RawPCMVolumeCache[0]&0xff;	// Left
   break;

  case 0x6:
   if(_Port[0x3] & 0x2)
    ret = ((uint16)RawPCMVolumeCache[1]) >> 8;	// Right
   else
    ret = ((uint16)RawPCMVolumeCache[0]) >> 8;	// Left
   break;

  case 0x7: 
   if(!PCE_InDebug)
   {
    _Port[0x3] &= ~0x10;
    update_irq_state();
   }
   ret = SubChannelData;
   break;

  case 0x8:
   ret = read_1808();
   break;

  case 0xa: 
   ret = ADPCM_ReadBuffer();
   break;

  case 0xb: 
   ret = _Port[0xb];
   break;

  case 0xc:
   ret = 0x00;

   ret |= ADPCM_IsPlaying() ? 0x8 : 0x1;
   ret |= ADPCM_IsWritePending() ? 0x04 : 0x00;
   ret |= ADPCM_IsBusyReading() ? 0x80 : 0x00;
   break;   

  case 0xd: 
   ret = ADPCM_Read180D();
   break;
 }
Esempio n. 4
0
uint32 PCECD_GetRegister(const unsigned int id, char *special, const uint32 special_len)
{
 uint32 value = 0xDEADBEEF;

 switch(id)
 {
  case CD_GSREG_BSY:
	value = SCSICD_GetBSY();
	break;

  case CD_GSREG_REQ:
	value = SCSICD_GetREQ();
	break;

  case CD_GSREG_MSG:
	value = SCSICD_GetMSG();
	break;

  case CD_GSREG_CD:
	value = SCSICD_GetCD();
	break;

  case CD_GSREG_IO:
	value = SCSICD_GetIO();
	break;

  case CD_GSREG_SEL:
	value = SCSICD_GetSEL();
	break;

  case CD_GSREG_ADPCM_CONTROL:
	value = ADPCM.LastCmd;
	break;

  case CD_GSREG_ADPCM_FREQ:
	value = ADPCM.SampleFreq;
	break;

  case CD_GSREG_ADPCM_CUR:
	value = MSM5205.GetSample();
	break;

  case CD_GSREG_ADPCM_WRADDR:
	value = ADPCM.WriteAddr;
	break;

  case CD_GSREG_ADPCM_RDADDR:
	value = ADPCM.ReadAddr;
	break;

  case CD_GSREG_ADPCM_LENGTH:
	value = ADPCM.LengthCount;
	break;

  case CD_GSREG_ADPCM_PLAYNIBBLE:
	value = (bool)(ADPCM.PlayNibble);
	break;

  case CD_GSREG_ADPCM_PLAYING:
	value = ADPCM.Playing;
	break;

  case CD_GSREG_ADPCM_HALFREACHED:
	value = ADPCM.HalfReached;
	break;

  case CD_GSREG_ADPCM_ENDREACHED:
	value = ADPCM.EndReached;
	break;
 }

 return(value);
}