Previous 15994 Revisions Next

r9352 Sunday 10th October, 2010 at 11:05:16 UTC by Angelo Salese
[Mega CD]: Implemented bare minimum CDD / HOCK support, allows it to play the BGM
[src/mame/drivers]megadriv.c

src/mame/drivers/megadriv.c
r9351r9352
362362static bitmap_t* render_bitmap;
363363//emu_timer* vblankirq_off_timer;
364364
365/* Sega CD stuff */
365366static int sega_cd_connected = 0x00;
367static UINT16 segacd_cdd_ctrl,segacd_irq_mask;
368static UINT8 segacd_cdd_recv[10];
366369
367370#ifdef UNUSED_FUNCTION
368371/* taken from segaic16.c */
r9351r9352
34963499// VRES (md reset button interrupt) clear
34973500/**********************************************************************************************/
34983501
3499static WRITE16_HANDLER( _32x_sh2_master_4014_w ){cpu_set_input_line(_32x_master_cpu,SH2_VRES_IRQ_LEVEL,CLEAR_LINE);}
3502static WRITE16_HANDLER( _32x_sh2_master_4014_w ){ cpu_set_input_line(_32x_master_cpu,SH2_VRES_IRQ_LEVEL,CLEAR_LINE);}
35003503static WRITE16_HANDLER( _32x_sh2_slave_4014_w ) { cpu_set_input_line(_32x_slave_cpu, SH2_VRES_IRQ_LEVEL,CLEAR_LINE);}
35013504
35023505/**********************************************************************************************/
r9351r9352
42954298
42964299static MACHINE_RESET( segacd )
42974300{
4301   int i;
42984302   cpu_set_input_line(_segacd_68k_cpu, INPUT_LINE_RESET, ASSERT_LINE);
42994303   cpu_set_input_line(_segacd_68k_cpu, INPUT_LINE_HALT, ASSERT_LINE);
43004304
43014305   segacd_hint_register = 0xffff; // -1
4306
4307   for(i=0;i<10;i++)
4308   {
4309      segacd_cdd_recv[i] = 0;
4310   }
4311
4312   segacd_cdd_recv[9] = 0xf; // default checksum
43024313}
43034314
43044315
r9351r9352
43394350      segacd_redled = (data >> 8)&1;
43404351      segacd_greenled = (data >> 9)&1;
43414352
4342      popmessage("%02x %02x",segacd_greenled,segacd_redled);
4353      //popmessage("%02x %02x",segacd_greenled,segacd_redled);
43434354   }
43444355
43454356}
r9351r9352
44144425   }
44154426}
44164427
4428static READ16_HANDLER( segacd_irq_mask_r )
4429{
4430   return segacd_irq_mask;
4431}
44174432
4433static WRITE16_HANDLER( segacd_irq_mask_w )
4434{
4435   segacd_irq_mask = data & 0x7e;
4436
4437   // check here pending IRQs
4438}
4439
4440static READ16_HANDLER( segacd_cdd_ctrl_r )
4441{
4442   return segacd_cdd_ctrl;
4443}
4444
4445static WRITE16_HANDLER( segacd_cdd_ctrl_w )
4446{
4447   segacd_cdd_ctrl = data;
4448
4449   if(segacd_cdd_ctrl & 4 && segacd_irq_mask & 0x10) // HOst ClocK
4450   {
4451      // TODO: this shouldn't be instant, CDD should first fill receive data.
4452      segacd_cdd_ctrl &= 0x103; // clear HOCK flag
4453      // export status
4454      cputag_set_input_line(space->machine, "segacd_68k", 4, HOLD_LINE);
4455   }
4456}
4457
4458/* 68k <- CDD communication comms are 4-bit wide */
4459static READ8_HANDLER( segacd_cdd_rx_r )
4460{
4461   return segacd_cdd_recv[offset] & 0xf;
4462}
4463
4464
4465static WRITE8_HANDLER( segacd_cdd_tx_w )
4466{
4467   printf("CDD Communication write %02x -> [%02x]\n",data,offset);
4468}
4469
4470
44184471static ADDRESS_MAP_START( segacd_map, ADDRESS_SPACE_PROGRAM, 16 )
44194472   AM_RANGE(0x000000, 0x07ffff) AM_RAM AM_BASE(&segacd_4meg_prgram)
44204473
r9351r9352
44364489   AM_RANGE(0xff8010 ,0xff801f) AM_READWRITE(segacd_comms_sub_part1_r, segacd_comms_sub_part1_w)
44374490   AM_RANGE(0xff8020 ,0xff802f) AM_READWRITE(segacd_comms_sub_part2_r, segacd_comms_sub_part2_w)
44384491//   AM_RANGE(0xff8030, 0xff8031) // Timer W/INT3
4439//   AM_RANGE(0xff8032, 0xff8033) // IRQ Mask
4492   AM_RANGE(0xff8032, 0xff8033) AM_READWRITE(segacd_irq_mask_r,segacd_irq_mask_w)
44404493//   AM_RANGE(0xff8034, 0xff8035) // CD Fader
4441//   AM_RANGE(0xff8036, 0xff8037) // CDD Control
4442//   AM_RANGE(0xff8038, 0xff804b) // CDD Communication ports 0-9
4494   AM_RANGE(0xff8036, 0xff8037) AM_READWRITE(segacd_cdd_ctrl_r,segacd_cdd_ctrl_w)
4495   AM_RANGE(0xff8038, 0xff8041) AM_READ8(segacd_cdd_rx_r,0xffff)
4496   AM_RANGE(0xff8042, 0xff804b) AM_WRITE8(segacd_cdd_tx_w,0xffff)
44434497//   AM_RANGE(0xff804c, 0xff804d) // Font Color
44444498//   AM_RANGE(0xff804e, 0xff804f) // Font bit
44454499//   AM_RANGE(0xff8050, 0xff8057) // Font data (read only)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team