예제 #1
0
MDFN_FASTCALL uint8 PCECD_Read(uint32 timestamp, 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
 {
  PCECD_Run(timestamp);

  switch(A & 0xf)
  {
   case 0x0:
    ret = 0;
    ret |= PCECD_Drive_GetBSY() ? 0x80 : 0x00;
    ret |= PCECD_Drive_GetREQ() ? 0x40 : 0x00;
    ret |= PCECD_Drive_GetMSG() ? 0x20 : 0x00;
    ret |= PCECD_Drive_GetCD() ? 0x10 : 0x00;
    ret |= PCECD_Drive_GetIO() ? 0x08 : 0x00;
    break;

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

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

   case 0x3: bBRAMEnabled = false;

	     /* switch left/right of digitized cd playback */
	     ret = _Port[0x3];
	     _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();
    else
     ret = 0x00;	// Not sure if it's 0, 0xFF, the last byte read, or something else.

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

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

   case 0xa: 
    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;
  }
 }
예제 #2
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;
 }