src/mame/drivers/megadriv.c
| r9351 | r9352 | |
| 362 | 362 | static bitmap_t* render_bitmap; |
| 363 | 363 | //emu_timer* vblankirq_off_timer; |
| 364 | 364 | |
| 365 | /* Sega CD stuff */ |
| 365 | 366 | static int sega_cd_connected = 0x00; |
| 367 | static UINT16 segacd_cdd_ctrl,segacd_irq_mask; |
| 368 | static UINT8 segacd_cdd_recv[10]; |
| 366 | 369 | |
| 367 | 370 | #ifdef UNUSED_FUNCTION |
| 368 | 371 | /* taken from segaic16.c */ |
| r9351 | r9352 | |
| 3496 | 3499 | // VRES (md reset button interrupt) clear |
| 3497 | 3500 | /**********************************************************************************************/ |
| 3498 | 3501 | |
| 3499 | | static WRITE16_HANDLER( _32x_sh2_master_4014_w ){cpu_set_input_line(_32x_master_cpu,SH2_VRES_IRQ_LEVEL,CLEAR_LINE);} |
| 3502 | static WRITE16_HANDLER( _32x_sh2_master_4014_w ){ cpu_set_input_line(_32x_master_cpu,SH2_VRES_IRQ_LEVEL,CLEAR_LINE);} |
| 3500 | 3503 | static WRITE16_HANDLER( _32x_sh2_slave_4014_w ) { cpu_set_input_line(_32x_slave_cpu, SH2_VRES_IRQ_LEVEL,CLEAR_LINE);} |
| 3501 | 3504 | |
| 3502 | 3505 | /**********************************************************************************************/ |
| r9351 | r9352 | |
| 4295 | 4298 | |
| 4296 | 4299 | static MACHINE_RESET( segacd ) |
| 4297 | 4300 | { |
| 4301 | int i; |
| 4298 | 4302 | cpu_set_input_line(_segacd_68k_cpu, INPUT_LINE_RESET, ASSERT_LINE); |
| 4299 | 4303 | cpu_set_input_line(_segacd_68k_cpu, INPUT_LINE_HALT, ASSERT_LINE); |
| 4300 | 4304 | |
| 4301 | 4305 | 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 |
| 4302 | 4313 | } |
| 4303 | 4314 | |
| 4304 | 4315 | |
| r9351 | r9352 | |
| 4339 | 4350 | segacd_redled = (data >> 8)&1; |
| 4340 | 4351 | segacd_greenled = (data >> 9)&1; |
| 4341 | 4352 | |
| 4342 | | popmessage("%02x %02x",segacd_greenled,segacd_redled); |
| 4353 | //popmessage("%02x %02x",segacd_greenled,segacd_redled); |
| 4343 | 4354 | } |
| 4344 | 4355 | |
| 4345 | 4356 | } |
| r9351 | r9352 | |
| 4414 | 4425 | } |
| 4415 | 4426 | } |
| 4416 | 4427 | |
| 4428 | static READ16_HANDLER( segacd_irq_mask_r ) |
| 4429 | { |
| 4430 | return segacd_irq_mask; |
| 4431 | } |
| 4417 | 4432 | |
| 4433 | static WRITE16_HANDLER( segacd_irq_mask_w ) |
| 4434 | { |
| 4435 | segacd_irq_mask = data & 0x7e; |
| 4436 | |
| 4437 | // check here pending IRQs |
| 4438 | } |
| 4439 | |
| 4440 | static READ16_HANDLER( segacd_cdd_ctrl_r ) |
| 4441 | { |
| 4442 | return segacd_cdd_ctrl; |
| 4443 | } |
| 4444 | |
| 4445 | static 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 */ |
| 4459 | static READ8_HANDLER( segacd_cdd_rx_r ) |
| 4460 | { |
| 4461 | return segacd_cdd_recv[offset] & 0xf; |
| 4462 | } |
| 4463 | |
| 4464 | |
| 4465 | static WRITE8_HANDLER( segacd_cdd_tx_w ) |
| 4466 | { |
| 4467 | printf("CDD Communication write %02x -> [%02x]\n",data,offset); |
| 4468 | } |
| 4469 | |
| 4470 | |
| 4418 | 4471 | static ADDRESS_MAP_START( segacd_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 4419 | 4472 | AM_RANGE(0x000000, 0x07ffff) AM_RAM AM_BASE(&segacd_4meg_prgram) |
| 4420 | 4473 | |
| r9351 | r9352 | |
| 4436 | 4489 | AM_RANGE(0xff8010 ,0xff801f) AM_READWRITE(segacd_comms_sub_part1_r, segacd_comms_sub_part1_w) |
| 4437 | 4490 | AM_RANGE(0xff8020 ,0xff802f) AM_READWRITE(segacd_comms_sub_part2_r, segacd_comms_sub_part2_w) |
| 4438 | 4491 | // 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) |
| 4440 | 4493 | // 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) |
| 4443 | 4497 | // AM_RANGE(0xff804c, 0xff804d) // Font Color |
| 4444 | 4498 | // AM_RANGE(0xff804e, 0xff804f) // Font bit |
| 4445 | 4499 | // AM_RANGE(0xff8050, 0xff8057) // Font data (read only) |