Previous 15994 Revisions Next

r9086 Friday 10th September, 2010 at 13:10:24 UTC by Angelo Salese
[PCE]: Added CD interface port ADPCM RAM 0x0a r/w routing, fixes Akumajou Dracula X going nuts after the intro
[src/mess/machine]pce.c

src/mess/machine/pce.c
r9085r9086
8686   UINT8   *adpcm_ram;
8787   int      bram_locked;
8888   int      adpcm_read_ptr;
89   UINT8   adpcm_read_buf;
8990   int      adpcm_write_ptr;
91   UINT8   adpcm_write_buf;
9092   int      adpcm_length;
9193   int      adpcm_clock_count;
9294   int      adpcm_clock_divider;
r9085r9086
112114   int      data_buffer_size;
113115   int      data_buffer_index;
114116   int      data_transferred;
117   /* Arcade Card specific */
115118   UINT8   *acard_ram;
116119   UINT8   acard_latch;
117120   UINT8   acard_ctrl;
r9085r9086
331334
332335   for(joy_i=0;joy_i<5;joy_i++)
333336      joy_6b_packet[joy_i] = 0;
337
338   pce_cd.adpcm_read_buf = 0;
339   pce_cd.adpcm_write_buf = 0;
340
341   // TODO: add CD-DA stop command here
334342}
335343
336344/* todo: how many input ports does the PCE have? */
r9085r9086
10801088   }
10811089}
10821090
1091static void pce_cd_set_adpcm_ram_byte(running_machine *machine, UINT8 val)
1092{
1093   if(pce_cd.adpcm_write_buf > 0)
1094   {
1095      pce_cd.adpcm_write_buf--;
1096   }
1097   else
1098   {
1099      pce_cd.adpcm_ram[pce_cd.adpcm_write_ptr] = val;
1100      pce_cd.adpcm_write_ptr = ((pce_cd.adpcm_write_ptr + 1) & 0xffff);
1101      //TODO: length + 1
1102   }
1103}
1104
10831105WRITE8_HANDLER( pce_cd_intf_w )
10841106{
10851107   pce_cd_update(space->machine);
r9085r9086
11271149   case 0x08:   /* ADPCM address (LSB) / CD data */
11281150      break;
11291151   case 0x09:   /* ADPCM address (MSB) */
1152      break;
11301153   case 0x0A:   /* ADPCM RAM data port */
1154      pce_cd_set_adpcm_ram_byte(space->machine, data);
11311155      break;
11321156   case 0x0B:   /* ADPCM DMA control */
11331157      if ( ! ( pce_cd.regs[0x0B] & 0x02 ) && ( data & 0x02 ) )
r9085r9086
11601184      if ( data & 0x08 )
11611185      {
11621186         pce_cd.adpcm_read_ptr = ( pce_cd.regs[0x09] << 8 ) | pce_cd.regs[0x08];
1187         pce_cd.adpcm_read_buf = 2;
11631188      }
1164      if ( ( data & 0x03 ) == 0x03 )
1189      if ( ( data & 0x02 ) == 0x02 )
11651190      {
11661191         pce_cd.adpcm_write_ptr = ( pce_cd.regs[0x09] << 8 ) | pce_cd.regs[0x08];
1192         pce_cd.adpcm_write_buf = data & 1;
11671193      }
11681194      break;
11691195   case 0x0E:   /* ADPCM playback rate */
r9085r9086
12161242   }
12171243}
12181244
1245static UINT8 pce_cd_get_adpcm_ram_byte(running_machine *machine)
1246{
1247   if(pce_cd.adpcm_read_buf > 0)
1248   {
1249      pce_cd.adpcm_read_buf--;
1250      return 0;
1251   }
1252   else
1253   {
1254      UINT8 res;
1255
1256      res = pce_cd.adpcm_ram[pce_cd.adpcm_read_ptr];
1257      pce_cd.adpcm_read_ptr = ((pce_cd.adpcm_read_ptr + 1) & 0xffff);
1258
1259      return res;
1260   }
1261}
1262
12191263READ8_HANDLER( pce_cd_intf_r )
12201264{
12211265   UINT8 data = pce_cd.regs[offset & 0x0F];
r9085r9086
12621306      data = pce_cd_get_cd_data_byte(space->machine);
12631307      break;
12641308   case 0x0A:   /* ADPCM RAM data port */
1309      data = pce_cd_get_adpcm_ram_byte(space->machine);
12651310      break;
12661311   case 0x0B:   /* ADPCM DMA control */
12671312      break;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team