src/mame/drivers/megadriv.c
| r9357 | r9358 | |
| 322 | 322 | static UINT16* _32x_palette_lookup; |
| 323 | 323 | /* SegaCD! */ |
| 324 | 324 | static cpu_device *_segacd_68k_cpu; |
| 325 | static emu_timer *segacd_gfx_conversion_timer; |
| 326 | |
| 325 | 327 | /* SVP (virtua racing) */ |
| 326 | 328 | static cpu_device *_svp_cpu; |
| 327 | 329 | |
| r9357 | r9358 | |
| 4110 | 4112 | static int segacd_cdc_regaddress; |
| 4111 | 4113 | static int segacd_cdc_destination_device; |
| 4112 | 4114 | static UINT8 segacd_cdc_registers[0x10]; |
| 4115 | int segacd_conversion_active = 0; |
| 4113 | 4116 | |
| 4114 | 4117 | static WRITE16_HANDLER( segacd_cdc_mode_address_w ) |
| 4115 | 4118 | { |
| r9357 | r9358 | |
| 4271 | 4274 | } |
| 4272 | 4275 | |
| 4273 | 4276 | |
| 4277 | static TIMER_CALLBACK( segacd_gfx_conversion_timer_callback ) |
| 4278 | { |
| 4279 | // todo irqmask |
| 4280 | |
| 4281 | printf("segacd_gfx_conversion_timer_callback\n"); |
| 4282 | |
| 4283 | if (segacd_irq_mask & 0x02) |
| 4284 | cputag_set_input_line(machine, "segacd_68k", 1, HOLD_LINE); |
| 4285 | |
| 4286 | segacd_conversion_active = 0; |
| 4287 | } |
| 4288 | |
| 4289 | |
| 4290 | |
| 4274 | 4291 | /* main CPU map set up in INIT */ |
| 4275 | 4292 | void segacd_init_main_cpu( running_machine* machine ) |
| 4276 | 4293 | { |
| r9357 | r9358 | |
| 4303 | 4320 | |
| 4304 | 4321 | memory_install_read16_handler (space, 0x0000070, 0x0000073, 0, 0, scd_hint_vector_r ); |
| 4305 | 4322 | |
| 4323 | segacd_gfx_conversion_timer = timer_alloc(machine, segacd_gfx_conversion_timer_callback, 0); |
| 4324 | timer_adjust_oneshot(segacd_gfx_conversion_timer, attotime_never, 0); |
| 4306 | 4325 | |
| 4307 | 4326 | } |
| 4308 | 4327 | |
| r9357 | r9358 | |
| 4579 | 4598 | } |
| 4580 | 4599 | } |
| 4581 | 4600 | |
| 4601 | int segacd_stampsize; |
| 4582 | 4602 | |
| 4603 | static READ16_HANDLER( segacd_stampsize_r ) |
| 4604 | { |
| 4605 | UINT16 retdata = 0x0000; |
| 4606 | |
| 4607 | retdata |= segacd_conversion_active<<15; |
| 4608 | |
| 4609 | retdata |= segacd_stampsize & 0x7; |
| 4610 | |
| 4611 | return retdata; |
| 4612 | |
| 4613 | } |
| 4614 | |
| 4615 | static WRITE16_HANDLER( segacd_stampsize_w ) |
| 4616 | { |
| 4617 | printf("segacd_stampsize_w %04x %04x\n",data, mem_mask); |
| 4618 | if (ACCESSING_BITS_0_7) |
| 4619 | { |
| 4620 | segacd_stampsize = data & 0x07; |
| 4621 | if (data & 0xf8) |
| 4622 | printf(" unused bits (LSB) set in stampsize!\n"); |
| 4623 | |
| 4624 | if (data&1) printf(" Repeat On\n"); |
| 4625 | else printf(" Repeat Off\n"); |
| 4626 | |
| 4627 | if (data&2) printf(" 32x32 dots\n"); |
| 4628 | else printf(" 16x16 dots\n"); |
| 4629 | |
| 4630 | if (data&4) printf(" 16x16 screens\n"); |
| 4631 | else printf(" 1x1 screen\n"); |
| 4632 | |
| 4633 | |
| 4634 | } |
| 4635 | |
| 4636 | if (ACCESSING_BITS_8_15) |
| 4637 | { |
| 4638 | if (data&0xff00) printf(" unused bits (MSB) set in stampsize!\n"); |
| 4639 | } |
| 4640 | } |
| 4641 | |
| 4642 | // this triggers the conversion operation, which will cause an IRQ1 when finished |
| 4643 | WRITE16_HANDLER( segacd_trace_vector_base_address_w ) |
| 4644 | { |
| 4645 | if (segacd_ram_mode==1) |
| 4646 | { |
| 4647 | printf("ILLEGAL: segacd_trace_vector_base_address_w %04x %04x in mode 1!\n",data,mem_mask); |
| 4648 | } |
| 4649 | |
| 4650 | printf("segacd_trace_vector_base_address_w %04x %04x\n",data,mem_mask); |
| 4651 | |
| 4652 | segacd_conversion_active = 1; |
| 4653 | |
| 4654 | timer_adjust_oneshot(segacd_gfx_conversion_timer, ATTOTIME_IN_HZ(1), 0); |
| 4655 | } |
| 4656 | |
| 4583 | 4657 | static ADDRESS_MAP_START( segacd_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 4584 | 4658 | AM_RANGE(0x000000, 0x07ffff) AM_RAM AM_BASE(&segacd_4meg_prgram) |
| 4585 | 4659 | |
| r9357 | r9358 | |
| 4609 | 4683 | // AM_RANGE(0xff804c, 0xff804d) // Font Color |
| 4610 | 4684 | // AM_RANGE(0xff804e, 0xff804f) // Font bit |
| 4611 | 4685 | // AM_RANGE(0xff8050, 0xff8057) // Font data (read only) |
| 4612 | | // AM_RANGE(0xff8058, 0xff8059) // Stamp size |
| 4686 | AM_RANGE(0xff8058, 0xff8059) AM_READWRITE(segacd_stampsize_r, segacd_stampsize_w) // Stamp size |
| 4613 | 4687 | // AM_RANGE(0xff805a, 0xff805b) // Stamp map base address |
| 4614 | 4688 | // AM_RANGE(0xff805c, 0xff805d) // Image buffer V cell size |
| 4615 | 4689 | // AM_RANGE(0xff805e, 0xff805f) // Image buffer start address |
| 4616 | 4690 | // AM_RANGE(0xff8060, 0xff8061) // Image buffer offset |
| 4617 | 4691 | // AM_RANGE(0xff8062, 0xff8063) // Image buffer H dot size |
| 4618 | 4692 | // AM_RANGE(0xff8064, 0xff8065) // Image buffer V dot size |
| 4619 | | // AM_RANGE(0xff8066, 0xff8067) // Trace vector base address |
| 4693 | AM_RANGE(0xff8066, 0xff8067) AM_WRITE(segacd_trace_vector_base_address_w)// Trace vector base address |
| 4620 | 4694 | // AM_RANGE(0xff8068, 0xff8069) // Subcode address |
| 4621 | 4695 | |
| 4622 | 4696 | // AM_RANGE(0xff8100, 0xff817f) // Subcode buffer area |