| Previous | 15994 Revisions | Next |
| r14861 Friday 6th April, 2012 at 07:00:32 UTC by Miodrag Milanović |
|---|
| Sync with MAME r15883 (no whatsnew) |
| [src/emu] | devcb.h device.c device.h machine.c machine.h memory.c memory.h |
| [src/emu/debug] | debugcmd.c |
| [src/emu/machine] | 6821pia.h 6840ptm.h microtch.c nvram.c |
| [src/emu/sound] | spu.c |
| [src/mame/audio] | atarijsa.c dcs.c mcr.c segasnd.c taito_en.c |
| [src/mame/drivers] | actfancr.c adp.c cave.c cd32.c cischeat.c cps1.c cps2.c cvs.c ddragon.c dec0.c espial.c fcrash.c galaxia.c hng64.c meritm.c mpu4.c mpu4vid.c namconb1.c neogeo.c quasar.c r2dtank.c renegade.c segac2.c seibuspi.c sshangha.c stepstag.c tetrisp2.c tmaster.c wecleman.c xain.c |
| [src/mame/includes] | cave.h cischeat.h cps1.h cvs.h dec0.h espial.h hng64.h mpu4.h namconb1.h neogeo.h renegade.h seibuspi.h sshangha.h tetrisp2.h wecleman.h xain.h |
| [src/mame/machine] | leland.c psx.c qix.c s24fd.c |
| [src/mame/video] | cischeat.c neogeo.c sei_crtc.c |
| [src/mess/drivers] | apollo.c dectalk.c ht68k.c ng_aes.c pes.c psx.c sgi_ip2.c v1050.c |
| [src/mess/machine] | msx.c oric.c pc_lpt.c s100_wunderbus.c thomson.c |
| [src/mess/machine/ti99] | tn_ide.c |
| r14860 | r14861 | |
|---|---|---|
| 548 | 548 | |
| 549 | 549 | /* update the OKI bank */ |
| 550 | 550 | if (oki6295 != NULL) |
| 551 | memory_set_bank(space->machine(), "bank12", ( | |
| 551 | memory_set_bank(space->machine(), "bank12", ( | |
| 552 | 552 | |
| 553 | 553 | /* update the bank */ |
| 554 | 554 | memcpy(bank_base, &bank_source_data[0x1000 * ((data >> 6) & 3)], 0x1000); |
| r14860 | r14861 | |
| 572 | 572 | |
| 573 | 573 | /* update the OKI bank */ |
| 574 | 574 | if (oki6295 != NULL) |
| 575 | memory_set_bank(space->machine(), "bank12", ( | |
| 575 | memory_set_bank(space->machine(), "bank12", ( | |
| 576 | 576 | |
| 577 | 577 | /* update the volumes */ |
| 578 | 578 | ym2151_volume = ((data >> 1) & 7) * 100 / 7; |
| r14860 | r14861 | |
| 681 | 681 | if ((data&1) == 0) devtag_reset(space->machine(), "ymsnd"); |
| 682 | 682 | |
| 683 | 683 | /* update the OKI bank */ |
| 684 | memory_set_bank(space->machine(), "bank12", ( | |
| 684 | memory_set_bank(space->machine(), "bank12", ( | |
| 685 | 685 | |
| 686 | 686 | /* update the bank */ |
| 687 | 687 | memcpy(bank_base, &bank_source_data[0x1000 * ((data >> 6) & 3)], 0x1000); |
| r14860 | r14861 | |
| 705 | 705 | */ |
| 706 | 706 | |
| 707 | 707 | /* update the OKI bank */ |
| 708 | memory_set_bank(space->machine(), "bank12", ( | |
| 708 | memory_set_bank(space->machine(), "bank12", ( | |
| 709 | 709 | memory_set_bank(space->machine(), "bank14", data >> 6); |
| 710 | 710 | |
| 711 | 711 | /* update the volumes */ |
| r14860 | r14861 | |
|---|---|---|
| 736 | 736 | assert(usb->cpu != NULL); |
| 737 | 737 | |
| 738 | 738 | /* allocate RAM */ |
| 739 | usb->program_ram = (UINT8 *)memory | |
| 739 | usb->program_ram = (UINT8 *)machine.memory(). | |
| 740 | 740 | usb->work_ram = auto_alloc_array(machine, UINT8, 0x400); |
| 741 | 741 | |
| 742 | 742 | /* create a sound stream */ |
| r14860 | r14861 | |
|---|---|---|
| 305 | 305 | { |
| 306 | 306 | /* Sound cpu program loads to 0xc00000 so we use a bank */ |
| 307 | 307 | UINT16 *ROM = (UINT16 *)machine.region("audiocpu")->base(); |
| 308 | UINT16 *sound_ram = (UINT16 *)memory | |
| 308 | UINT16 *sound_ram = (UINT16 *)machine.memory(). | |
| 309 | 309 | memory_set_bankptr(machine, "bank1",&ROM[0x80000]); |
| 310 | 310 | memory_set_bankptr(machine, "bank2",&ROM[0x90000]); |
| 311 | 311 | memory_set_bankptr(machine, "bank3",&ROM[0xa0000]); |
| r14860 | r14861 | |
| 319 | 319 | machine.device("audiocpu")->reset(); |
| 320 | 320 | //cputag_set_input_line(machine, "audiocpu", INPUT_LINE_RESET, ASSERT_LINE); |
| 321 | 321 | |
| 322 | f3_shared_ram = (UINT32 *)memory | |
| 322 | f3_shared_ram = (UINT32 *)machine.memory(). | |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | static const es5505_interface es5505_taito_f3_config = |
| r14860 | r14861 | |
|---|---|---|
| 943 | 943 | memset(&dcs, 0, sizeof(dcs)); |
| 944 | 944 | dcs.sram = NULL; |
| 945 | 945 | |
| 946 | dcs.internal_program_ram = (UINT32 *)memory_get_shared(machine, "dcsint"); | |
| 947 | dcs.external_program_ram = (UINT32 *)memory_get_shared(machine, "dcsext"); | |
| 946 | dcs.internal_program_ram = (UINT32 *)machine.memory().shared("dcsint")->ptr(); | |
| 947 | dcs.external_program_ram = (UINT32 *)machine.memory().shared("dcsext")->ptr(); | |
| 948 | 948 | |
| 949 | 949 | /* find the DCS CPU and the sound ROMs */ |
| 950 | 950 | dcs.cpu = machine.device<adsp21xx_device>("dcs"); |
| r14860 | r14861 | |
| 982 | 982 | int soundbank_words; |
| 983 | 983 | |
| 984 | 984 | memset(&dcs, 0, sizeof(dcs)); |
| 985 | dcs.internal_program_ram = (UINT32 *)memory_get_shared(machine, "dcsint"); | |
| 986 | dcs.external_program_ram = (UINT32 *)memory_get_shared(machine, "dcsext"); | |
| 985 | dcs.internal_program_ram = (UINT32 *)machine.memory().shared("dcsint")->ptr(); | |
| 986 | dcs.external_program_ram = (UINT32 *)machine.memory().shared("dcsext")->ptr(); | |
| 987 | 987 | |
| 988 | 988 | /* find the DCS CPU and the sound ROMs */ |
| 989 | 989 | dcs.cpu = machine.device<adsp21xx_device>("dcs2"); |
| r14860 | r14861 | |
|---|---|---|
| 533 | 533 | /* low bytes. */ |
| 534 | 534 | pia6821_device *pia = downcast<pia6821_device *>(device); |
| 535 | 535 | if (ACCESSING_BITS_8_15) |
| 536 | return pia->read_alt(* | |
| 536 | return pia->read_alt(* | |
| 537 | 537 | else |
| 538 | return pia->read_alt(* | |
| 538 | return pia->read_alt(* | |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | static WRITE16_DEVICE_HANDLER( csdeluxe_pia_w ) |
| 542 | 542 | { |
| 543 | 543 | pia6821_device *pia = downcast<pia6821_device *>(device); |
| 544 | 544 | if (ACCESSING_BITS_8_15) |
| 545 | pia->write_alt(* | |
| 545 | pia->write_alt(* | |
| 546 | 546 | else |
| 547 | pia->write_alt(* | |
| 547 | pia->write_alt(* | |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 |
| r14860 | r14861 | |
|---|---|---|
| 156 | 156 | { |
| 157 | 157 | int i; |
| 158 | 158 | |
| 159 | s24_fd1094_cpuregion = (UINT16*)memory | |
| 159 | s24_fd1094_cpuregion = (UINT16*)machine.memory(). | |
| 160 | 160 | s24_fd1094_cpuregionsize = 0x40000; |
| 161 | 161 | s24_fd1094_key = machine.region("fd1094key")->base(); |
| 162 | 162 |
| r14860 | r14861 | |
|---|---|---|
| 28 | 28 | { |
| 29 | 29 | psx_state *p_psx = machine.driver_data<psx_state>(); |
| 30 | 30 | |
| 31 | p_psx->m_p_n_psxram = (UINT32 *)memory_get_shared(machine, "share1", p_psx->m_n_psxramsize); | |
| 31 | memory_share *share = machine.memory().shared("share1"); | |
| 32 | p_psx->m_p_n_psxram = (UINT32 *)share->ptr(); | |
| 33 | p_psx->m_n_psxramsize = share->bytes(); | |
| 32 | 34 | } |
| 33 | 35 | |
| 34 | 36 | WRITE32_HANDLER( psx_com_delay_w ) |
| r14860 | r14861 | |
|---|---|---|
| 326 | 326 | { |
| 327 | 327 | leland_state *state = machine.driver_data<leland_state>(); |
| 328 | 328 | /* allocate extra stuff */ |
| 329 | state->m_battery_ram = reinterpret_cast<UINT8 *>(memory | |
| 329 | state->m_battery_ram = reinterpret_cast<UINT8 *>(machine.memory(). | |
| 330 | 330 | |
| 331 | 331 | /* start scanline interrupts going */ |
| 332 | 332 | state->m_master_int_timer = machine.scheduler().timer_alloc(FUNC(leland_interrupt_callback)); |
| r14860 | r14861 | |
| 376 | 376 | { |
| 377 | 377 | leland_state *state = machine.driver_data<leland_state>(); |
| 378 | 378 | /* set the odd data banks */ |
| 379 | state->m_battery_ram = reinterpret_cast<UINT8 *>(memory | |
| 379 | state->m_battery_ram = reinterpret_cast<UINT8 *>(machine.memory(). | |
| 380 | 380 | state->m_extra_tram = auto_alloc_array(machine, UINT8, ATAXX_EXTRA_TRAM_SIZE); |
| 381 | 381 | |
| 382 | 382 | /* start scanline interrupts going */ |
| r14860 | r14861 | |
|---|---|---|
| 472 | 472 | static TIMER_CALLBACK( pia_w_callback ) |
| 473 | 473 | { |
| 474 | 474 | pia6821_device *device = (pia6821_device *)ptr; |
| 475 | device->write(* | |
| 475 | device->write(* | |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 |
| r14860 | r14861 | |
|---|---|---|
| 43 | 43 | UINT32 m_bg_fore_layer_position; |
| 44 | 44 | UINT8 m_alpha_table[8192]; |
| 45 | 45 | UINT8 m_sprite_bpp; |
| 46 | DECLARE_READ32_MEMBER(ejanhs_speedup_r); | |
| 46 | 47 | }; |
| 47 | 48 | |
| 48 | 49 |
| r14860 | r14861 | |
|---|---|---|
| 245 | 245 | DECLARE_READ8_MEMBER(mpu4_ym2413_r); |
| 246 | 246 | DECLARE_READ8_MEMBER(crystal_sound_r); |
| 247 | 247 | DECLARE_WRITE8_MEMBER(crystal_sound_w); |
| 248 | DECLARE_WRITE8_MEMBER(ic3ss_w); | |
| 248 | 249 | }; |
| 249 | 250 | |
| 250 | 251 | /* mpu4.c, used by mpu4vid.c */ |
| r14860 | r14861 | |
| 260 | 261 | |
| 261 | 262 | MACHINE_CONFIG_EXTERN( mod2 ); |
| 262 | 263 | |
| 263 | WRITE8_HANDLER( ic3ss_w ); | |
| 264 | ||
| 265 | 264 | extern MACHINE_START( mod2 ); |
| 266 | 265 | extern const ay8910_interface ay8910_config; |
| 267 | 266 |
| r14860 | r14861 | |
|---|---|---|
| 153 | 153 | DECLARE_WRITE16_MEMBER(qsound_sharedram2_w); |
| 154 | 154 | DECLARE_WRITE8_MEMBER(qsound_banksw_w); |
| 155 | 155 | DECLARE_READ16_MEMBER(sf2mdt_r); |
| 156 | DECLARE_READ16_MEMBER(cps1_dsw_r); | |
| 157 | DECLARE_WRITE16_MEMBER(cps1_coinctrl_w); | |
| 158 | DECLARE_READ16_MEMBER(qsound_sharedram1_r); | |
| 159 | DECLARE_WRITE16_MEMBER(qsound_sharedram1_w); | |
| 156 | 160 | }; |
| 157 | 161 | |
| 158 | 162 | /*----------- defined in drivers/cps1.c -----------*/ |
| 159 | 163 | |
| 160 | 164 | ADDRESS_MAP_EXTERN( qsound_sub_map, 8 ); |
| 161 | 165 | |
| 162 | READ16_HANDLER( qsound_sharedram1_r ); | |
| 163 | WRITE16_HANDLER( qsound_sharedram1_w ); | |
| 164 | ||
| 165 | READ16_HANDLER( cps1_dsw_r ); | |
| 166 | WRITE16_HANDLER( cps1_coinctrl_w ); | |
| 167 | 166 | INTERRUPT_GEN( cps1_interrupt ); |
| 168 | 167 | |
| 169 | 168 | GFXDECODE_EXTERN( cps1 ); |
| r14860 | r14861 | |
|---|---|---|
| 35 | 35 | |
| 36 | 36 | required_device<cpu_device> m_maincpu; |
| 37 | 37 | required_device<cpu_device> m_mcu; |
| 38 | DECLARE_READ32_MEMBER(randgen_r); | |
| 39 | DECLARE_WRITE32_MEMBER(srand_w); | |
| 38 | 40 | }; |
| 39 | 41 | |
| 40 | 42 |
| r14860 | r14861 | |
|---|---|---|
| 31 | 31 | DECLARE_READ16_MEMBER(deco_71_r); |
| 32 | 32 | DECLARE_READ8_MEMBER(sshangha_sound_shared_r); |
| 33 | 33 | DECLARE_WRITE8_MEMBER(sshangha_sound_shared_w); |
| 34 | DECLARE_WRITE16_MEMBER(paletteram16_xbgr_word_be_sprites2_w); | |
| 35 | DECLARE_WRITE16_MEMBER(paletteram16_xbgr_word_be_sprites_w); | |
| 36 | DECLARE_WRITE16_MEMBER(paletteram16_xbgr_word_be_tilelow_w); | |
| 37 | DECLARE_WRITE16_MEMBER(paletteram16_xbgr_word_be_tilehigh_w); | |
| 34 | 38 | }; |
| 35 | 39 | |
| 36 | 40 |
| r14860 | r14861 | |
|---|---|---|
| 32 | 32 | device_t *m_audiocpu; |
| 33 | 33 | DECLARE_WRITE8_MEMBER(espial_master_interrupt_mask_w); |
| 34 | 34 | DECLARE_WRITE8_MEMBER(espial_master_soundlatch_w); |
| 35 | DECLARE_WRITE8_MEMBER(espial_sound_nmi_mask_w); | |
| 35 | 36 | }; |
| 36 | 37 | |
| 37 | 38 | /*----------- defined in video/espial.c -----------*/ |
| r14860 | r14861 | |
|---|---|---|
| 47 | 47 | DECLARE_WRITE8_MEMBER(multiply_w); |
| 48 | 48 | DECLARE_WRITE16_MEMBER(hotchase_soundlatch_w); |
| 49 | 49 | DECLARE_WRITE8_MEMBER(hotchase_sound_control_w); |
| 50 | DECLARE_WRITE16_MEMBER(wecleman_soundlatch_w); | |
| 50 | 51 | }; |
| 51 | 52 | |
| 52 | 53 |
| r14860 | r14861 | |
|---|---|---|
| 57 | 57 | DECLARE_WRITE16_MEMBER(tetrisp2_coincounter_w); |
| 58 | 58 | DECLARE_WRITE16_MEMBER(nndmseal_coincounter_w); |
| 59 | 59 | DECLARE_WRITE16_MEMBER(nndmseal_b20000_w); |
| 60 | DECLARE_WRITE16_MEMBER(tetrisp2_systemregs_w); | |
| 61 | DECLARE_READ16_MEMBER(tetrisp2_nvram_r); | |
| 62 | DECLARE_WRITE16_MEMBER(tetrisp2_nvram_w); | |
| 60 | 63 | }; |
| 61 | 64 | |
| 62 | WRITE16_HANDLER( tetrisp2_systemregs_w ); | |
| 63 | READ16_HANDLER( tetrisp2_nvram_r ); | |
| 64 | WRITE16_HANDLER( tetrisp2_nvram_w ); | |
| 65 | ||
| 66 | 65 | /*----------- defined in video/tetrisp2.c -----------*/ |
| 67 | 66 | |
| 68 | 67 | WRITE16_HANDLER( tetrisp2_palette_w ); |
| r14860 | r14861 | |
|---|---|---|
| 44 | 44 | DECLARE_WRITE16_MEMBER(bigrun_soundbank_w); |
| 45 | 45 | DECLARE_READ16_MEMBER(f1gpstr2_io_r); |
| 46 | 46 | DECLARE_WRITE16_MEMBER(f1gpstr2_io_w); |
| 47 | DECLARE_READ16_MEMBER(scudhamm_motor_status_r); | |
| 48 | DECLARE_READ16_MEMBER(scudhamm_motor_pos_r); | |
| 49 | DECLARE_READ16_MEMBER(scudhamm_analog_r); | |
| 47 | 50 | }; |
| 48 | 51 | |
| 49 | 52 | |
| 50 | /*----------- defined in drivers/cischeat.c -----------*/ | |
| 51 | ||
| 52 | READ16_HANDLER( scudhamm_motor_pos_r ); | |
| 53 | READ16_HANDLER( scudhamm_motor_status_r ); | |
| 54 | READ16_HANDLER( scudhamm_analog_r ); | |
| 55 | ||
| 56 | ||
| 57 | 53 | /*----------- defined in video/cischeat.c -----------*/ |
| 58 | 54 | |
| 59 | 55 | WRITE16_HANDLER( cischeat_scrollram_0_w ); |
| r14860 | r14861 | |
|---|---|---|
| 27 | 27 | DECLARE_WRITE16_MEMBER(midres_sound_w); |
| 28 | 28 | DECLARE_WRITE16_MEMBER(unmapped_w); |
| 29 | 29 | DECLARE_WRITE8_MEMBER(automat_adpcm_w); |
| 30 | DECLARE_READ16_MEMBER(slyspy_controls_r); | |
| 31 | DECLARE_READ16_MEMBER(slyspy_protection_r); | |
| 32 | DECLARE_WRITE16_MEMBER(slyspy_state_w); | |
| 33 | DECLARE_READ16_MEMBER(slyspy_state_r); | |
| 30 | 34 | }; |
| 31 | 35 | |
| 32 | 36 |
| r14860 | r14861 | |
|---|---|---|
| 69 | 69 | DECLARE_WRITE8_MEMBER(cvs_speech_rom_address_hi_w); |
| 70 | 70 | DECLARE_READ8_MEMBER(cvs_speech_command_r); |
| 71 | 71 | DECLARE_WRITE8_MEMBER(audio_command_w); |
| 72 | DECLARE_READ8_MEMBER(cvs_video_or_color_ram_r); | |
| 73 | DECLARE_WRITE8_MEMBER(cvs_video_or_color_ram_w); | |
| 74 | DECLARE_READ8_MEMBER(cvs_bullet_ram_or_palette_r); | |
| 75 | DECLARE_WRITE8_MEMBER(cvs_bullet_ram_or_palette_w); | |
| 76 | DECLARE_READ8_MEMBER(cvs_s2636_0_or_character_ram_r); | |
| 77 | DECLARE_WRITE8_MEMBER(cvs_s2636_0_or_character_ram_w); | |
| 78 | DECLARE_READ8_MEMBER(cvs_s2636_1_or_character_ram_r); | |
| 79 | DECLARE_WRITE8_MEMBER(cvs_s2636_1_or_character_ram_w); | |
| 80 | DECLARE_READ8_MEMBER(cvs_s2636_2_or_character_ram_r); | |
| 81 | DECLARE_WRITE8_MEMBER(cvs_s2636_2_or_character_ram_w); | |
| 72 | 82 | }; |
| 73 | 83 | |
| 74 | 84 | |
| r14860 | r14861 | |
| 77 | 87 | MACHINE_START( cvs ); |
| 78 | 88 | MACHINE_RESET( cvs ); |
| 79 | 89 | |
| 80 | READ8_HANDLER( cvs_video_or_color_ram_r ); | |
| 81 | WRITE8_HANDLER( cvs_video_or_color_ram_w ); | |
| 82 | ||
| 83 | READ8_HANDLER( cvs_bullet_ram_or_palette_r ); | |
| 84 | WRITE8_HANDLER( cvs_bullet_ram_or_palette_w ); | |
| 85 | ||
| 86 | READ8_HANDLER( cvs_s2636_0_or_character_ram_r ); | |
| 87 | WRITE8_HANDLER( cvs_s2636_0_or_character_ram_w ); | |
| 88 | READ8_HANDLER( cvs_s2636_1_or_character_ram_r ); | |
| 89 | WRITE8_HANDLER( cvs_s2636_1_or_character_ram_w ); | |
| 90 | READ8_HANDLER( cvs_s2636_2_or_character_ram_r ); | |
| 91 | WRITE8_HANDLER( cvs_s2636_2_or_character_ram_w ); | |
| 92 | ||
| 93 | 90 | /*----------- defined in video/cvs.c -----------*/ |
| 94 | 91 | |
| 95 | 92 | WRITE8_HANDLER( cvs_scroll_w ); |
| r14860 | r14861 | |
|---|---|---|
| 39 | 39 | DECLARE_WRITE8_MEMBER(xain_irqB_clear_w); |
| 40 | 40 | DECLARE_READ8_MEMBER(xain_68705_r); |
| 41 | 41 | DECLARE_WRITE8_MEMBER(xain_68705_w); |
| 42 | DECLARE_READ8_MEMBER(xain_68705_port_a_r); | |
| 43 | DECLARE_WRITE8_MEMBER(xain_68705_port_a_w); | |
| 44 | DECLARE_WRITE8_MEMBER(xain_68705_ddr_a_w); | |
| 45 | DECLARE_READ8_MEMBER(xain_68705_port_b_r); | |
| 46 | DECLARE_WRITE8_MEMBER(xain_68705_port_b_w); | |
| 47 | DECLARE_WRITE8_MEMBER(xain_68705_ddr_b_w); | |
| 48 | DECLARE_READ8_MEMBER(xain_68705_port_c_r); | |
| 49 | DECLARE_WRITE8_MEMBER(xain_68705_port_c_w); | |
| 50 | DECLARE_WRITE8_MEMBER(xain_68705_ddr_c_w); | |
| 51 | DECLARE_READ8_MEMBER(mcu_comm_reset_r); | |
| 42 | 52 | }; |
| 43 | 53 | |
| 44 | 54 |
| r14860 | r14861 | |
|---|---|---|
| 46 | 46 | DECLARE_WRITE8_MEMBER(bankswitch_w); |
| 47 | 47 | DECLARE_WRITE8_MEMBER(renegade_coin_counter_w); |
| 48 | 48 | void mcu_process_command(); |
| 49 | DECLARE_READ8_MEMBER(renegade_68705_port_a_r); | |
| 50 | DECLARE_WRITE8_MEMBER(renegade_68705_port_a_w); | |
| 51 | DECLARE_WRITE8_MEMBER(renegade_68705_ddr_a_w); | |
| 52 | DECLARE_READ8_MEMBER(renegade_68705_port_b_r); | |
| 53 | DECLARE_WRITE8_MEMBER(renegade_68705_port_b_w); | |
| 54 | DECLARE_WRITE8_MEMBER(renegade_68705_ddr_b_w); | |
| 55 | DECLARE_READ8_MEMBER(renegade_68705_port_c_r); | |
| 56 | DECLARE_WRITE8_MEMBER(renegade_68705_port_c_w); | |
| 57 | DECLARE_WRITE8_MEMBER(renegade_68705_ddr_c_w); | |
| 49 | 58 | }; |
| 50 | 59 | |
| 51 | 60 |
| r14860 | r14861 | |
|---|---|---|
| 123 | 123 | DECLARE_READ8_MEMBER(audio_cpu_bank_select_8000_bfff_r); |
| 124 | 124 | DECLARE_WRITE16_MEMBER(system_control_w); |
| 125 | 125 | DECLARE_WRITE16_MEMBER(watchdog_w); |
| 126 | DECLARE_READ16_MEMBER(neogeo_unmapped_r); | |
| 126 | 127 | }; |
| 127 | 128 | |
| 128 | 129 | |
| r14860 | r14861 | |
| 133 | 134 | void neogeo_set_display_counter_lsb(address_space *space, UINT16 data); |
| 134 | 135 | void neogeo_acknowledge_interrupt(running_machine &machine, UINT16 data); |
| 135 | 136 | void neogeo_set_main_cpu_bank_address(address_space *space, UINT32 bank_address); |
| 136 | READ16_HANDLER( neogeo_unmapped_r ); | |
| 137 | 137 | DEVICE_IMAGE_LOAD( neo_cartridge ); |
| 138 | 138 | |
| 139 | 139 |
| r14860 | r14861 | |
|---|---|---|
| 128 | 128 | DECLARE_READ8_MEMBER(hng64_comm_memory_r); |
| 129 | 129 | DECLARE_WRITE8_MEMBER(hng64_comm_memory_w); |
| 130 | 130 | DECLARE_WRITE8_MEMBER(hng64_comm_io_mmu); |
| 131 | DECLARE_WRITE32_MEMBER(trap_write); | |
| 132 | DECLARE_WRITE32_MEMBER(hng64_3d_1_w); | |
| 133 | DECLARE_WRITE32_MEMBER(activate_3d_buffer); | |
| 134 | DECLARE_READ8_MEMBER(hng64_comm_shared_r); | |
| 135 | DECLARE_WRITE8_MEMBER(hng64_comm_shared_w); | |
| 131 | 136 | }; |
| 132 | 137 | |
| 133 | 138 |
| r14860 | r14861 | |
|---|---|---|
| 139 | 139 | DECLARE_WRITE8_MEMBER(sailormn_rombank_w); |
| 140 | 140 | DECLARE_WRITE8_MEMBER(sailormn_okibank0_w); |
| 141 | 141 | DECLARE_WRITE8_MEMBER(sailormn_okibank1_w); |
| 142 | DECLARE_WRITE16_MEMBER(donpachi_videoregs_w); | |
| 142 | 143 | }; |
| 143 | 144 | |
| 144 | 145 | /*----------- defined in video/cave.c -----------*/ |
| r14860 | r14861 | |
|---|---|---|
| 1441 | 1441 | |
| 1442 | 1442 | popmessage("Cmd: %04X Pos:%04X Lim:%04X Inp:%04X", |
| 1443 | 1443 | state->m_scudhamm_motor_command, |
| 1444 | scudhamm_motor_pos_r(space,0,0xffff), | |
| 1445 | scudhamm_motor_status_r(space,0,0xffff), | |
| 1446 | scudhamm_analog_r(space,0,0xffff) ); | |
| 1444 | state->scudhamm_motor_pos_r(*space,0,0xffff), | |
| 1445 | state->scudhamm_motor_status_r(*space,0,0xffff), | |
| 1446 | state->scudhamm_analog_r(*space,0,0xffff) ); | |
| 1447 | 1447 | } |
| 1448 | 1448 | #endif |
| 1449 | 1449 |
| r14860 | r14861 | |
|---|---|---|
| 208 | 208 | |
| 209 | 209 | static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri) |
| 210 | 210 | { |
| 211 | UINT16 *spriteram16 = reinterpret_cast<UINT16 *>(memory | |
| 211 | UINT16 *spriteram16 = reinterpret_cast<UINT16 *>(machine.memory(). | |
| 212 | 212 | int offs,fx,fy,x,y,color,sprite; |
| 213 | 213 | int dx,dy,ax,ay; |
| 214 | 214 |
| r14860 | r14861 | |
|---|---|---|
| 795 | 795 | |
| 796 | 796 | READ16_HANDLER( neogeo_video_register_r ) |
| 797 | 797 | { |
| 798 | neogeo_state *state = space->machine().driver_data<neogeo_state>(); | |
| 798 | 799 | UINT16 ret; |
| 799 | 800 | |
| 800 | 801 | /* accessing the LSB only is not mapped */ |
| 801 | 802 | if (mem_mask == 0x00ff) |
| 802 | ret = neogeo_unmapped_r(space, 0, 0xffff) & 0x00ff; | |
| 803 | ret = state->neogeo_unmapped_r(*space, 0, 0xffff) & 0x00ff; | |
| 803 | 804 | else |
| 804 | 805 | { |
| 805 | 806 | switch (offset) |
| r14860 | r14861 | |
|---|---|---|
| 528 | 528 | |
| 529 | 529 | READ8_MEMBER(mpu4_state::bankswitch_r) |
| 530 | 530 | { |
| 531 | return memory | |
| 531 | return machine().memory(). | |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | |
| r14860 | r14861 | |
| 1614 | 1614 | /* This is a bit of a cheat - since we don't clock into the OKI chip directly, we need to |
| 1615 | 1615 | calculate the oscillation frequency in advance. We're running the timer for interrupt |
| 1616 | 1616 | purposes, but the frequency calculation is done by plucking the values out as they are written.*/ |
| 1617 | WRITE8_ | |
| 1617 | WRITE8_M | |
| 1618 | 1618 | { |
| 1619 | device_t *ic3ss = space->machine().device("ptm_ic3ss"); | |
| 1620 | mpu4_state *state = space->machine().driver_data<mpu4_state>(); | |
| 1619 | device_t *ic3ss = machine().device("ptm_ic3ss"); | |
| 1621 | 1620 | downcast<ptm6840_device *>(ic3ss)->write(offset,data); |
| 1622 | device_t *msm6376 = | |
| 1621 | device_t *msm6376 = | |
| 1623 | 1622 | |
| 1624 | 1623 | if (offset == 3) |
| 1625 | 1624 | { |
| 1626 | | |
| 1625 | | |
| 1627 | 1626 | } |
| 1628 | 1627 | if (offset == 6) |
| 1629 | 1628 | { |
| 1630 | | |
| 1629 | | |
| 1631 | 1630 | } |
| 1632 | 1631 | if (offset == 7) |
| 1633 | 1632 | { |
| 1634 | | |
| 1633 | | |
| 1635 | 1634 | } |
| 1636 | 1635 | |
| 1637 | float num = (1720000/((state->m_t3l + 1)*(state->m_t3h + 1))); | |
| 1638 | float denom1 = ((state->m_t3h *(state->m_t3l + 1)+ 1)/(2*(state->m_t1 + 1))); | |
| 1636 | float num = (1720000/((m_t3l + 1)*(m_t3h + 1))); | |
| 1637 | float denom1 = ((m_t3h *(m_t3l + 1)+ 1)/(2*(m_t1 + 1))); | |
| 1639 | 1638 | |
| 1640 | 1639 | int denom2 = denom1 +0.5;//need to round up, this gives same precision as chip |
| 1641 | 1640 | int freq=num*denom2; |
| r14860 | r14861 | |
| 2598 | 2597 | |
| 2599 | 2598 | void mpu4_install_mod4oki_space(address_space *space) |
| 2600 | 2599 | { |
| 2600 | mpu4_state *state = space->machine().driver_data<mpu4_state>(); | |
| 2601 | 2601 | pia6821_device *pia_ic4ss = space->machine().device<pia6821_device>("pia_ic4ss"); |
| 2602 | 2602 | ptm6840_device *ptm_ic3ss = space->machine().device<ptm6840_device>("ptm_ic3ss"); |
| 2603 | 2603 | |
| 2604 | 2604 | space->install_readwrite_handler(0x0880, 0x0883, 0, 0, read8_delegate(FUNC(pia6821_device::read), pia_ic4ss), write8_delegate(FUNC(pia6821_device::write), pia_ic4ss)); |
| 2605 | 2605 | space->install_read_handler(0x08c0, 0x08c7, 0, 0, read8_delegate(FUNC(ptm6840_device::read), ptm_ic3ss)); |
| 2606 | space->install_ | |
| 2606 | space->install_ | |
| 2607 | 2607 | } |
| 2608 | 2608 | |
| 2609 | 2609 | void mpu4_install_mod4bwb_space(address_space *space) |
| r14860 | r14861 | |
|---|---|---|
| 823 | 823 | return result<<24; |
| 824 | 824 | } /* gunbulet_gun_r */ |
| 825 | 825 | |
| 826 | static | |
| 827 | READ32_HANDLER( randgen_r ) | |
| 826 | READ32_MEMBER(namconb1_state::randgen_r) | |
| 828 | 827 | { |
| 829 | return | |
| 828 | return | |
| 830 | 829 | } /* randgen_r */ |
| 831 | 830 | |
| 832 | static | |
| 833 | WRITE32_HANDLER( srand_w ) | |
| 831 | WRITE32_MEMBER(namconb1_state::srand_w) | |
| 834 | 832 | { |
| 835 | 833 | /** |
| 836 | 834 | * Used to seed the hardware random number generator. |
| r14860 | r14861 | |
| 857 | 855 | AM_RANGE(0x000000, 0x0fffff) AM_ROM |
| 858 | 856 | AM_RANGE(0x100000, 0x10001f) AM_READ_LEGACY(gunbulet_gun_r) |
| 859 | 857 | AM_RANGE(0x1c0000, 0x1cffff) AM_RAM |
| 860 | AM_RANGE(0x1e4000, 0x1e4003) AM_READWRITE | |
| 858 | AM_RANGE(0x1e4000, 0x1e4003) AM_READWRITE | |
| 861 | 859 | AM_RANGE(0x200000, 0x207fff) AM_READWRITE_LEGACY(namconb_share_r, namconb_share_w) |
| 862 | 860 | AM_RANGE(0x208000, 0x2fffff) AM_RAM |
| 863 | 861 | AM_RANGE(0x400000, 0x40001f) AM_READWRITE_LEGACY(namconb_cpureg_r, namconb1_cpureg_w) |
| r14860 | r14861 | |
| 874 | 872 | static ADDRESS_MAP_START( namconb2_am, AS_PROGRAM, 32, namconb1_state ) |
| 875 | 873 | AM_RANGE(0x000000, 0x0fffff) AM_ROM |
| 876 | 874 | AM_RANGE(0x1c0000, 0x1cffff) AM_RAM |
| 877 | AM_RANGE(0x1e4000, 0x1e4003) AM_READWRITE | |
| 875 | AM_RANGE(0x1e4000, 0x1e4003) AM_READWRITE | |
| 878 | 876 | AM_RANGE(0x200000, 0x207fff) AM_READWRITE_LEGACY(namconb_share_r, namconb_share_w) |
| 879 | 877 | AM_RANGE(0x208000, 0x2fffff) AM_RAM |
| 880 | 878 | AM_RANGE(0x400000, 0x4fffff) AM_ROM AM_REGION("data", 0) |
| r14860 | r14861 | |
|---|---|---|
| 381 | 381 | |
| 382 | 382 | static ADDRESS_MAP_START( fcrash_map, AS_PROGRAM, 16, cps_state ) |
| 383 | 383 | AM_RANGE(0x000000, 0x1fffff) AM_ROM |
| 384 | AM_RANGE(0x800030, 0x800031) AM_WRITE | |
| 384 | AM_RANGE(0x800030, 0x800031) AM_WRITE | |
| 385 | 385 | AM_RANGE(0x800100, 0x80013f) AM_RAM AM_BASE(m_cps_a_regs) /* CPS-A custom */ |
| 386 | 386 | AM_RANGE(0x800140, 0x80017f) AM_RAM AM_BASE(m_cps_b_regs) /* CPS-B custom */ |
| 387 | 387 | AM_RANGE(0x880000, 0x880001) AM_READ_PORT("IN1") /* Player input ports */ |
| 388 | 388 | AM_RANGE(0x880006, 0x880007) AM_WRITE_LEGACY(fcrash_soundlatch_w) /* Sound command */ |
| 389 | AM_RANGE(0x880008, 0x88000f) AM_READ | |
| 389 | AM_RANGE(0x880008, 0x88000f) AM_READ | |
| 390 | 390 | AM_RANGE(0x890000, 0x890001) AM_WRITENOP // palette related? |
| 391 | 391 | AM_RANGE(0x900000, 0x92ffff) AM_RAM_WRITE_LEGACY(cps1_gfxram_w) AM_BASE_SIZE(m_gfxram, m_gfxram_size) |
| 392 | 392 | AM_RANGE(0xff0000, 0xffffff) AM_RAM |
| r14860 | r14861 | |
| 409 | 409 | AM_RANGE(0x000000, 0x3fffff) AM_ROM |
| 410 | 410 | AM_RANGE(0x800000, 0x800007) AM_READ_PORT("IN1") /* Player input ports */ |
| 411 | 411 | /* forgottn, willow, cawing, nemo, varth read from 800010. Probably debug input leftover from development */ |
| 412 | AM_RANGE(0x800018, 0x80001f) AM_READ | |
| 412 | AM_RANGE(0x800018, 0x80001f) AM_READ | |
| 413 | 413 | AM_RANGE(0x800020, 0x800021) AM_READNOP /* ? Used by Rockman ? not mapped according to PAL */ |
| 414 | AM_RANGE(0x800030, 0x800037) AM_WRITE | |
| 414 | AM_RANGE(0x800030, 0x800037) AM_WRITE | |
| 415 | 415 | /* Forgotten Worlds has dial controls on B-board mapped at 800040-80005f. See DRIVER_INIT */ |
| 416 | 416 | AM_RANGE(0x800100, 0x80013f) AM_WRITE_LEGACY(cps1_cps_a_w) AM_BASE(m_cps_a_regs) /* CPS-A custom */ |
| 417 | 417 | AM_RANGE(0x800140, 0x80017f) AM_READWRITE_LEGACY(cps1_cps_b_r, cps1_cps_b_w) AM_BASE(m_cps_b_regs) /* CPS-B custom */ |
| r14860 | r14861 | |
|---|---|---|
| 115 | 115 | |
| 116 | 116 | /******************************************************************************/ |
| 117 | 117 | |
| 118 | INLINE void set_color_888(running_machine &machine, pen_t color, int rshift, int gshift, int bshift, UINT32 data) | |
| 118 | INLINE void sshangha_set_color_888(running_machine &machine, pen_t color, int rshift, int gshift, int bshift, UINT32 data) | |
| 119 | 119 | { |
| 120 | 120 | palette_set_color_rgb(machine, color, (data >> rshift) & 0xff, (data >> gshift) & 0xff, (data >> bshift) & 0xff); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | |
| 124 | WRITE16_ | |
| 124 | WRITE16_M | |
| 125 | 125 | { |
| 126 | sshangha_state *state = space->machine().driver_data<sshangha_state>(); | |
| 127 | COMBINE_DATA(&state->m_sprite_paletteram2[offset]); | |
| 128 | set_color_888(space->machine(), (offset/2)+0x100, 0, 8, 16, state->m_sprite_paletteram2[(offset) | 1] | (state->m_sprite_paletteram2[(offset) & ~1] << 16) ); | |
| 126 | COMBINE_DATA(&m_sprite_paletteram2[offset]); | |
| 127 | sshangha_set_color_888(machine(), (offset/2)+0x100, 0, 8, 16, m_sprite_paletteram2[(offset) | 1] | (m_sprite_paletteram2[(offset) & ~1] << 16) ); | |
| 129 | 128 | } |
| 130 | 129 | |
| 131 | WRITE16_ | |
| 130 | WRITE16_M | |
| 132 | 131 | { |
| 133 | 132 | // hack??? we have to call this otherwise the sprite colours for some selected tiles are wrong (most noticeable on the 2nd level of quest mode) |
| 134 | 133 | // however if we simply mirror the memory both ways the how to play screen ends up with bad colours |
| r14860 | r14861 | |
| 137 | 136 | // maybe related to sprite DMA on the original, or the apparent lack of a 2nd sprite controller on the bootleg. |
| 138 | 137 | paletteram16_xbgr_word_be_sprites2_w(space,offset,data,mem_mask); |
| 139 | 138 | |
| 140 | sshangha_state *state = space->machine().driver_data<sshangha_state>(); | |
| 141 | COMBINE_DATA(&state->m_sprite_paletteram[offset]); | |
| 142 | set_color_888(space->machine(), (offset/2)+0x000, 0, 8, 16, state->m_sprite_paletteram[(offset) | 1] | (state->m_sprite_paletteram[(offset) & ~1] << 16) ); | |
| 139 | COMBINE_DATA(&m_sprite_paletteram[offset]); | |
| 140 | sshangha_set_color_888(machine(), (offset/2)+0x000, 0, 8, 16, m_sprite_paletteram[(offset) | 1] | (m_sprite_paletteram[(offset) & ~1] << 16) ); | |
| 143 | 141 | } |
| 144 | 142 | |
| 145 | WRITE16_ | |
| 143 | WRITE16_M | |
| 146 | 144 | { |
| 147 | sshangha_state *state = space->machine().driver_data<sshangha_state>(); | |
| 148 | COMBINE_DATA(&state->m_tile_paletteram1[offset]); | |
| 149 | set_color_888(space->machine(), (offset/2)+0x200, 0, 8, 16, state->m_tile_paletteram1[(offset) | 1] | (state->m_tile_paletteram1[(offset) & ~1] << 16) ); | |
| 145 | COMBINE_DATA(&m_tile_paletteram1[offset]); | |
| 146 | sshangha_set_color_888(machine(), (offset/2)+0x200, 0, 8, 16, m_tile_paletteram1[(offset) | 1] | (m_tile_paletteram1[(offset) & ~1] << 16) ); | |
| 150 | 147 | } |
| 151 | 148 | |
| 152 | WRITE16_ | |
| 149 | WRITE16_M | |
| 153 | 150 | { |
| 154 | sshangha_state *state = space->machine().driver_data<sshangha_state>(); | |
| 155 | COMBINE_DATA(&state->m_tile_paletteram2[offset]); | |
| 156 | set_color_888(space->machine(), (offset/2)+0x300, 0, 8, 16, state->m_tile_paletteram2[(offset) | 1] | (state->m_tile_paletteram2[(offset) & ~1] << 16) ); | |
| 151 | COMBINE_DATA(&m_tile_paletteram2[offset]); | |
| 152 | sshangha_set_color_888(machine(), (offset/2)+0x300, 0, 8, 16, m_tile_paletteram2[(offset) | 1] | (m_tile_paletteram2[(offset) & ~1] << 16) ); | |
| 157 | 153 | } |
| 158 | 154 | |
| 159 | 155 | static ADDRESS_MAP_START( sshangha_map, AS_PROGRAM, 16, sshangha_state ) |
| r14860 | r14861 | |
| 177 | 173 | AM_RANGE(0x370000, 0x370001) AM_READ(deco_71_r) |
| 178 | 174 | AM_RANGE(0x370000, 0x370007) AM_WRITENOP |
| 179 | 175 | |
| 180 | AM_RANGE(0x380000, 0x3803ff) AM_RAM_WRITE_LEGACY(paletteram16_xbgr_word_be_sprites_w) AM_BASE(m_sprite_paletteram) | |
| 181 | AM_RANGE(0x380400, 0x3807ff) AM_RAM_WRITE_LEGACY(paletteram16_xbgr_word_be_tilehigh_w) AM_BASE(m_tile_paletteram2) | |
| 182 | AM_RANGE(0x380800, 0x380bff) AM_RAM_WRITE_LEGACY(paletteram16_xbgr_word_be_sprites2_w) AM_BASE(m_sprite_paletteram2) | |
| 183 | AM_RANGE(0x380c00, 0x380fff) AM_RAM_WRITE_LEGACY(paletteram16_xbgr_word_be_tilelow_w) AM_BASE(m_tile_paletteram1) | |
| 176 | AM_RANGE(0x380000, 0x3803ff) AM_RAM_WRITE(paletteram16_xbgr_word_be_sprites_w) AM_BASE(m_sprite_paletteram) | |
| 177 | AM_RANGE(0x380400, 0x3807ff) AM_RAM_WRITE(paletteram16_xbgr_word_be_tilehigh_w) AM_BASE(m_tile_paletteram2) | |
| 178 | AM_RANGE(0x380800, 0x380bff) AM_RAM_WRITE(paletteram16_xbgr_word_be_sprites2_w) AM_BASE(m_sprite_paletteram2) | |
| 179 | AM_RANGE(0x380c00, 0x380fff) AM_RAM_WRITE(paletteram16_xbgr_word_be_tilelow_w) AM_BASE(m_tile_paletteram1) | |
| 184 | 180 | AM_RANGE(0x381000, 0x383fff) AM_RAM // unused palette area |
| 185 | 181 | |
| 186 | 182 | AM_RANGE(0xfec000, 0xff3fff) AM_RAM |
| r14860 | r14861 | |
| 204 | 200 | |
| 205 | 201 | AM_RANGE(0x340000, 0x340fff) AM_RAM // original spriteram |
| 206 | 202 | |
| 207 | AM_RANGE(0x380000, 0x3803ff) AM_RAM_WRITE_LEGACY(paletteram16_xbgr_word_be_sprites_w) AM_BASE(m_sprite_paletteram) | |
| 208 | AM_RANGE(0x380400, 0x3807ff) AM_RAM_WRITE_LEGACY(paletteram16_xbgr_word_be_tilehigh_w) AM_BASE(m_tile_paletteram2) | |
| 209 | AM_RANGE(0x380800, 0x380bff) AM_RAM_WRITE_LEGACY(paletteram16_xbgr_word_be_sprites2_w) AM_BASE(m_sprite_paletteram2) | |
| 210 | AM_RANGE(0x380c00, 0x380fff) AM_RAM_WRITE_LEGACY(paletteram16_xbgr_word_be_tilelow_w) AM_BASE(m_tile_paletteram1) | |
| 203 | AM_RANGE(0x380000, 0x3803ff) AM_RAM_WRITE(paletteram16_xbgr_word_be_sprites_w) AM_BASE(m_sprite_paletteram) | |
| 204 | AM_RANGE(0x380400, 0x3807ff) AM_RAM_WRITE(paletteram16_xbgr_word_be_tilehigh_w) AM_BASE(m_tile_paletteram2) | |
| 205 | AM_RANGE(0x380800, 0x380bff) AM_RAM_WRITE(paletteram16_xbgr_word_be_sprites2_w) AM_BASE(m_sprite_paletteram2) | |
| 206 | AM_RANGE(0x380c00, 0x380fff) AM_RAM_WRITE(paletteram16_xbgr_word_be_tilelow_w) AM_BASE(m_tile_paletteram1) | |
| 211 | 207 | AM_RANGE(0x381000, 0x383fff) AM_RAM // unused palette area |
| 212 | 208 | |
| 213 | 209 | AM_RANGE(0x3c0000, 0x3c0fff) AM_RAM AM_SHARE("spriteram") // bootleg spriteram |
| r14860 | r14861 | |
|---|---|---|
| 813 | 813 | static ADDRESS_MAP_START( cps2_map, AS_PROGRAM, 16, cps_state ) |
| 814 | 814 | AM_RANGE(0x000000, 0x3fffff) AM_ROM /* 68000 ROM */ |
| 815 | 815 | AM_RANGE(0x400000, 0x40000b) AM_RAM AM_BASE_SIZE(m_output, m_output_size) /* CPS2 object output */ |
| 816 | AM_RANGE(0x618000, 0x619fff) AM_READWRITE | |
| 816 | AM_RANGE(0x618000, 0x619fff) AM_READWRITE | |
| 817 | 817 | AM_RANGE(0x662000, 0x662001) AM_RAM /* Network adapter related, accessed in SSF2TB */ |
| 818 | 818 | AM_RANGE(0x662008, 0x662009) AM_RAM /* Network adapter related, accessed in SSF2TB */ |
| 819 | 819 | AM_RANGE(0x662020, 0x662021) AM_RAM /* Network adapter related, accessed in SSF2TB */ |
| r14860 | r14861 | |
| 844 | 844 | static ADDRESS_MAP_START( dead_cps2_map, AS_PROGRAM, 16, cps_state ) |
| 845 | 845 | AM_RANGE(0x000000, 0x3fffff) AM_ROM /* 68000 ROM */ |
| 846 | 846 | AM_RANGE(0x400000, 0x40000b) AM_RAM AM_BASE_SIZE(m_output, m_output_size) /* CPS2 object output */ |
| 847 | AM_RANGE(0x618000, 0x619fff) AM_READWRITE | |
| 847 | AM_RANGE(0x618000, 0x619fff) AM_READWRITE | |
| 848 | 848 | AM_RANGE(0x662000, 0x662001) AM_RAM /* Network adapter related, accessed in SSF2TB */ |
| 849 | 849 | AM_RANGE(0x662008, 0x662009) AM_RAM /* Network adapter related, accessed in SSF2TB */ |
| 850 | 850 | AM_RANGE(0x662020, 0x662021) AM_RAM /* Network adapter related, accessed in SSF2TB */ |
| r14860 | r14861 | |
|---|---|---|
| 276 | 276 | adp_state *state = device->machine().driver_data<adp_state>(); |
| 277 | 277 | if (channel == 0) |
| 278 | 278 | { |
| 279 | state->m_microtouch->rx(* | |
| 279 | state->m_microtouch->rx(* | |
| 280 | 280 | } |
| 281 | 281 | } |
| 282 | 282 |
| r14860 | r14861 | |
|---|---|---|
| 492 | 492 | WEC Le Mans 24 Main CPU Handlers |
| 493 | 493 | ***************************************************************************/ |
| 494 | 494 | |
| 495 | static WRITE16_HANDLER( wecleman_soundlatch_w ); | |
| 496 | ||
| 497 | ||
| 498 | 495 | static ADDRESS_MAP_START( wecleman_map, AS_PROGRAM, 16, wecleman_state ) |
| 499 | 496 | AM_RANGE(0x000000, 0x03ffff) AM_ROM // ROM (03c000-03ffff used as RAM sometimes!) |
| 500 | 497 | AM_RANGE(0x040494, 0x040495) AM_WRITE_LEGACY(wecleman_videostatus_w) AM_BASE(m_videostatus) // cloud blending control (HACK) |
| r14860 | r14861 | |
| 507 | 504 | AM_RANGE(0x110000, 0x110fff) AM_RAM_WRITE_LEGACY(wecleman_paletteram16_SSSSBBBBGGGGRRRR_word_w) AM_SHARE("paletteram") |
| 508 | 505 | AM_RANGE(0x124000, 0x127fff) AM_RAM AM_SHARE("share1") // Shared with main CPU |
| 509 | 506 | AM_RANGE(0x130000, 0x130fff) AM_RAM AM_BASE(m_spriteram) // Sprites |
| 510 | AM_RANGE(0x140000, 0x140001) AM_WRITE | |
| 507 | AM_RANGE(0x140000, 0x140001) AM_WRITE | |
| 511 | 508 | AM_RANGE(0x140002, 0x140003) AM_WRITE(selected_ip_w) // Selects accelerator / wheel / .. |
| 512 | 509 | AM_RANGE(0x140004, 0x140005) AM_WRITE(irqctrl_w) // Main CPU controls the other CPUs |
| 513 | 510 | AM_RANGE(0x140006, 0x140007) AM_WRITENOP // Watchdog reset |
| r14860 | r14861 | |
| 582 | 579 | ***************************************************************************/ |
| 583 | 580 | |
| 584 | 581 | /* 140001.b */ |
| 585 | WRITE16_ | |
| 582 | WRITE16_M | |
| 586 | 583 | { |
| 587 | wecleman_state *state = space->machine().driver_data<wecleman_state>(); | |
| 588 | 584 | if (ACCESSING_BITS_0_7) |
| 589 | 585 | { |
| 590 | state->soundlatch_w(*space, 0, data & 0xFF); | |
| 591 | cputag_set_input_line(space->machine(), "audiocpu", 0, HOLD_LINE); | |
| 586 | soundlatch_w(*&space, 0, data & 0xFF); | |
| 587 | cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE); | |
| 592 | 588 | } |
| 593 | 589 | } |
| 594 | 590 |
| r14860 | r14861 | |
|---|---|---|
| 401 | 401 | ---- ---- ---- --1- Up Limit |
| 402 | 402 | ---- ---- ---- ---0 Down Limit */ |
| 403 | 403 | |
| 404 | READ16_ | |
| 404 | READ16_M | |
| 405 | 405 | { |
| 406 | cischeat_state *state = space->machine().driver_data<cischeat_state>(); | |
| 407 | return state->m_scudhamm_motor_command; // Motor Status | |
| 406 | return m_scudhamm_motor_command; // Motor Status | |
| 408 | 407 | } |
| 409 | 408 | |
| 410 | 409 | |
| 411 | READ16_ | |
| 410 | READ16_M | |
| 412 | 411 | { |
| 413 | 412 | return 0x00 << 8; |
| 414 | 413 | } |
| r14860 | r14861 | |
| 428 | 427 | } |
| 429 | 428 | |
| 430 | 429 | |
| 431 | READ16_ | |
| 430 | READ16_M | |
| 432 | 431 | { |
| 433 | cischeat_state *state = space->machine().driver_data<cischeat_state>(); | |
| 434 | int i=input_port_read(space->machine(), "IN1"),j; | |
| 432 | int i=input_port_read(machine(), "IN1"),j; | |
| 435 | 433 | |
| 436 | if ((i^state->m_prev)&0x4000) { | |
| 437 | if (i<state->m_prev) state->m_prev-=0x8000; | |
| 438 | else state->m_prev+=0x8000; | |
| 434 | if ((i^m_prev)&0x4000) { | |
| 435 | if (i<m_prev) m_prev-=0x8000; | |
| 436 | else m_prev+=0x8000; | |
| 439 | 437 | } |
| 440 | 438 | |
| 441 | j=i-state->m_prev; | |
| 442 | state->m_prev=i; | |
| 439 | j=i-m_prev; | |
| 440 | m_prev=i; | |
| 443 | 441 | |
| 444 | 442 | /* effect of hammer collision 'accelerometer': |
| 445 | 443 | $00 - $09 - no hit |
| r14860 | r14861 | |
| 504 | 502 | AM_RANGE(0x100014, 0x100015) AM_DEVREADWRITE8("oki1", okim6295_device, read, write, 0x00ff) // Sound |
| 505 | 503 | AM_RANGE(0x100018, 0x100019) AM_DEVREADWRITE8("oki2", okim6295_device, read, write, 0x00ff) // |
| 506 | 504 | AM_RANGE(0x10001c, 0x10001d) AM_WRITE(scudhamm_enable_w) // ? |
| 507 | AM_RANGE(0x100040, 0x100041) AM_READ_LEGACY(scudhamm_analog_r) AM_WRITENOP // A / D | |
| 508 | AM_RANGE(0x100044, 0x100045) AM_READ_LEGACY(scudhamm_motor_pos_r) // Motor Position | |
| 509 | AM_RANGE(0x100050, 0x100051) AM_READ_LEGACY(scudhamm_motor_status_r) AM_WRITE(scudhamm_motor_command_w) // Motor Limit Switches | |
| 505 | AM_RANGE(0x100040, 0x100041) AM_READ(scudhamm_analog_r) AM_WRITENOP // A / D | |
| 506 | AM_RANGE(0x100044, 0x100045) AM_READ(scudhamm_motor_pos_r) // Motor Position | |
| 507 | AM_RANGE(0x100050, 0x100051) AM_READ(scudhamm_motor_status_r) AM_WRITE(scudhamm_motor_command_w) // Motor Limit Switches | |
| 510 | 508 | AM_RANGE(0x10005c, 0x10005d) AM_READ_PORT("IN2") // 2 x DSW |
| 511 | 509 | ADDRESS_MAP_END |
| 512 | 510 |
| r14860 | r14861 | |
|---|---|---|
| 85 | 85 | galaxia_state *state = space->machine().driver_data<galaxia_state>(); |
| 86 | 86 | // space->machine().primary_screen->update_partial(space->machine().primary_screen->vpos()); |
| 87 | 87 | state->m_bg_tilemap->mark_tile_dirty(offset); |
| 88 | cvs_video_or_color_ram_w(space, offset, data); | |
| 88 | state->cvs_video_or_color_ram_w(*space, offset, data); | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | static WRITE8_HANDLER(galaxia_scroll_w) |
| r14860 | r14861 | |
| 130 | 130 | AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_DEVREADWRITE_LEGACY("s2636_0", s2636_work_ram_r, s2636_work_ram_w) |
| 131 | 131 | AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_DEVREADWRITE_LEGACY("s2636_1", s2636_work_ram_r, s2636_work_ram_w) |
| 132 | 132 | AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_DEVREADWRITE_LEGACY("s2636_2", s2636_work_ram_r, s2636_work_ram_w) |
| 133 | AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READ | |
| 133 | AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READ | |
| 134 | 134 | AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM |
| 135 | 135 | AM_RANGE(0x2000, 0x33ff) AM_ROM |
| 136 | 136 | AM_RANGE(0x7214, 0x7214) AM_READ_PORT("IN0") |
| r14860 | r14861 | |
| 140 | 140 | AM_RANGE(0x0000, 0x13ff) AM_ROM |
| 141 | 141 | AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_RAM |
| 142 | 142 | AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_DEVREADWRITE_LEGACY("s2636_0", s2636_work_ram_r, s2636_work_ram_w) |
| 143 | AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READ | |
| 143 | AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READ | |
| 144 | 144 | AM_RANGE(0x1c00, 0x1cff) AM_MIRROR(0x6000) AM_RAM AM_BASE(m_bullet_ram) |
| 145 | 145 | AM_RANGE(0x2000, 0x33ff) AM_ROM |
| 146 | 146 | ADDRESS_MAP_END |
| r14860 | r14861 | |
|---|---|---|
| 284 | 284 | |
| 285 | 285 | ***************************************************************************/ |
| 286 | 286 | |
| 287 | READ8_ | |
| 287 | READ8_M | |
| 288 | 288 | { |
| 289 | xain_state *state = space->machine().driver_data<xain_state>(); | |
| 290 | return (state->m_port_a_out & state->m_ddr_a) | (state->m_port_a_in & ~state->m_ddr_a); | |
| 289 | return (m_port_a_out & m_ddr_a) | (m_port_a_in & ~m_ddr_a); | |
| 291 | 290 | } |
| 292 | 291 | |
| 293 | WRITE8_ | |
| 292 | WRITE8_M | |
| 294 | 293 | { |
| 295 | xain_state *state = space->machine().driver_data<xain_state>(); | |
| 296 | state->m_port_a_out = data; | |
| 294 | m_port_a_out = data; | |
| 297 | 295 | } |
| 298 | 296 | |
| 299 | WRITE8_ | |
| 297 | WRITE8_M | |
| 300 | 298 | { |
| 301 | xain_state *state = space->machine().driver_data<xain_state>(); | |
| 302 | state->m_ddr_a = data; | |
| 299 | m_ddr_a = data; | |
| 303 | 300 | } |
| 304 | 301 | |
| 305 | READ8_ | |
| 302 | READ8_M | |
| 306 | 303 | { |
| 307 | xain_state *state = space->machine().driver_data<xain_state>(); | |
| 308 | return (state->m_port_b_out & state->m_ddr_b) | (state->m_port_b_in & ~state->m_ddr_b); | |
| 304 | return (m_port_b_out & m_ddr_b) | (m_port_b_in & ~m_ddr_b); | |
| 309 | 305 | } |
| 310 | 306 | |
| 311 | WRITE8_ | |
| 307 | WRITE8_M | |
| 312 | 308 | { |
| 313 | xain_state *state = space->machine().driver_data<xain_state>(); | |
| 314 | if ((state->m_ddr_b & 0x02) && (~data & 0x02)) | |
| 309 | if ((m_ddr_b & 0x02) && (~data & 0x02)) | |
| 315 | 310 | { |
| 316 | | |
| 311 | | |
| 317 | 312 | } |
| 318 | 313 | /* Rising edge of PB1 */ |
| 319 | else if (( | |
| 314 | else if (( | |
| 320 | 315 | { |
| 321 | state->m_mcu_accept = 1; | |
| 322 | cputag_set_input_line(space->machine(), "mcu", 0, CLEAR_LINE); | |
| 316 | m_mcu_accept = 1; | |
| 317 | cputag_set_input_line(machine(), "mcu", 0, CLEAR_LINE); | |
| 323 | 318 | } |
| 324 | 319 | |
| 325 | 320 | /* Rising edge of PB2 */ |
| 326 | if (( | |
| 321 | if (( | |
| 327 | 322 | { |
| 328 | state->m_mcu_ready = 0; | |
| 329 | state->m_from_mcu = state->m_port_a_out; | |
| 323 | m_mcu_ready = 0; | |
| 324 | m_from_mcu = m_port_a_out; | |
| 330 | 325 | } |
| 331 | 326 | |
| 332 | | |
| 327 | | |
| 333 | 328 | } |
| 334 | 329 | |
| 335 | WRITE8_ | |
| 330 | WRITE8_M | |
| 336 | 331 | { |
| 337 | xain_state *state = space->machine().driver_data<xain_state>(); | |
| 338 | state->m_ddr_b = data; | |
| 332 | m_ddr_b = data; | |
| 339 | 333 | } |
| 340 | 334 | |
| 341 | READ8_ | |
| 335 | READ8_M | |
| 342 | 336 | { |
| 343 | xain_state *state = space->machine().driver_data<xain_state>(); | |
| 344 | state->m_port_c_in = 0; | |
| 337 | m_port_c_in = 0; | |
| 345 | 338 | |
| 346 | if (!state->m_mcu_accept) | |
| 347 | state->m_port_c_in |= 0x01; | |
| 348 | if (state->m_mcu_ready) | |
| 349 | state->m_port_c_in |= 0x02; | |
| 339 | if (!m_mcu_accept) | |
| 340 | m_port_c_in |= 0x01; | |
| 341 | if (m_mcu_ready) | |
| 342 | m_port_c_in |= 0x02; | |
| 350 | 343 | |
| 351 | return ( | |
| 344 | return ( | |
| 352 | 345 | } |
| 353 | 346 | |
| 354 | WRITE8_ | |
| 347 | WRITE8_M | |
| 355 | 348 | { |
| 356 | xain_state *state = space->machine().driver_data<xain_state>(); | |
| 357 | state->m_port_c_out = data; | |
| 349 | m_port_c_out = data; | |
| 358 | 350 | } |
| 359 | 351 | |
| 360 | WRITE8_ | |
| 352 | WRITE8_M | |
| 361 | 353 | { |
| 362 | xain_state *state = space->machine().driver_data<xain_state>(); | |
| 363 | state->m_ddr_c = data; | |
| 354 | m_ddr_c = data; | |
| 364 | 355 | } |
| 365 | 356 | |
| 366 | 357 | static CUSTOM_INPUT( mcu_status_r ) |
| r14860 | r14861 | |
| 383 | 374 | return res; |
| 384 | 375 | } |
| 385 | 376 | |
| 386 | READ8_ | |
| 377 | READ8_M | |
| 387 | 378 | { |
| 388 | xain_state *state = space->machine().driver_data<xain_state>(); | |
| 389 | state->m_mcu_ready = 1; | |
| 390 | state->m_mcu_accept = 1; | |
| 379 | m_mcu_ready = 1; | |
| 380 | m_mcu_accept = 1; | |
| 391 | 381 | |
| 392 | if (space->machine().device("mcu") != NULL) | |
| 393 | cputag_set_input_line(space->machine(), "mcu", 0, CLEAR_LINE); | |
| 382 | if (machine().device("mcu") != NULL) | |
| 383 | cputag_set_input_line(machine(), "mcu", 0, CLEAR_LINE); | |
| 394 | 384 | |
| 395 | 385 | return 0xff; |
| 396 | 386 | } |
| r14860 | r14861 | |
| 411 | 401 | AM_RANGE(0x3a04, 0x3a04) AM_READ(xain_68705_r) |
| 412 | 402 | AM_RANGE(0x3a04, 0x3a05) AM_WRITE_LEGACY(xain_scrollxP0_w) |
| 413 | 403 | AM_RANGE(0x3a05, 0x3a05) AM_READ_PORT("VBLANK") |
| 414 | AM_RANGE(0x3a06, 0x3a06) AM_READ | |
| 404 | AM_RANGE(0x3a06, 0x3a06) AM_READ | |
| 415 | 405 | AM_RANGE(0x3a06, 0x3a07) AM_WRITE_LEGACY(xain_scrollyP0_w) |
| 416 | 406 | AM_RANGE(0x3a08, 0x3a08) AM_WRITE(xain_sound_command_w) |
| 417 | 407 | AM_RANGE(0x3a09, 0x3a0c) AM_WRITE(xain_main_irq_w) |
| r14860 | r14861 | |
| 435 | 425 | |
| 436 | 426 | static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, xain_state ) |
| 437 | 427 | ADDRESS_MAP_GLOBAL_MASK(0x7ff) |
| 438 | AM_RANGE(0x0000, 0x0000) AM_READWRITE_LEGACY(xain_68705_port_a_r, xain_68705_port_a_w) | |
| 439 | AM_RANGE(0x0001, 0x0001) AM_READWRITE_LEGACY(xain_68705_port_b_r, xain_68705_port_b_w) | |
| 440 | AM_RANGE(0x0002, 0x0002) AM_READWRITE_LEGACY(xain_68705_port_c_r, xain_68705_port_c_w) | |
| 441 | AM_RANGE(0x0004, 0x0004) AM_WRITE_LEGACY(xain_68705_ddr_a_w) | |
| 442 | AM_RANGE(0x0005, 0x0005) AM_WRITE_LEGACY(xain_68705_ddr_b_w) | |
| 443 | AM_RANGE(0x0006, 0x0006) AM_WRITE_LEGACY(xain_68705_ddr_c_w) | |
| 428 | AM_RANGE(0x0000, 0x0000) AM_READWRITE(xain_68705_port_a_r, xain_68705_port_a_w) | |
| 429 | AM_RANGE(0x0001, 0x0001) AM_READWRITE(xain_68705_port_b_r, xain_68705_port_b_w) | |
| 430 | AM_RANGE(0x0002, 0x0002) AM_READWRITE(xain_68705_port_c_r, xain_68705_port_c_w) | |
| 431 | AM_RANGE(0x0004, 0x0004) AM_WRITE(xain_68705_ddr_a_w) | |
| 432 | AM_RANGE(0x0005, 0x0005) AM_WRITE(xain_68705_ddr_b_w) | |
| 433 | AM_RANGE(0x0006, 0x0006) AM_WRITE(xain_68705_ddr_c_w) | |
| 444 | 434 | // AM_RANGE(0x0008, 0x0008) AM_READWRITE_LEGACY(m68705_tdr_r, m68705_tdr_w) |
| 445 | 435 | // AM_RANGE(0x0009, 0x0009) AM_READWRITE_LEGACY(m68705_tcr_r, m68705_tcr_w) |
| 446 | 436 | AM_RANGE(0x0010, 0x007f) AM_RAM |
| r14860 | r14861 | |
|---|---|---|
| 289 | 289 | |
| 290 | 290 | ***************************************************************************/ |
| 291 | 291 | |
| 292 | READ8_ | |
| 292 | READ8_M | |
| 293 | 293 | { |
| 294 | renegade_state *state = space->machine().driver_data<renegade_state>(); | |
| 295 | return (state->m_port_a_out & state->m_ddr_a) | (state->m_port_a_in & ~state->m_ddr_a); | |
| 294 | return (m_port_a_out & m_ddr_a) | (m_port_a_in & ~m_ddr_a); | |
| 296 | 295 | } |
| 297 | 296 | |
| 298 | WRITE8_ | |
| 297 | WRITE8_M | |
| 299 | 298 | { |
| 300 | renegade_state *state = space->machine().driver_data<renegade_state>(); | |
| 301 | state->m_port_a_out = data; | |
| 299 | m_port_a_out = data; | |
| 302 | 300 | } |
| 303 | 301 | |
| 304 | WRITE8_ | |
| 302 | WRITE8_M | |
| 305 | 303 | { |
| 306 | renegade_state *state = space->machine().driver_data<renegade_state>(); | |
| 307 | state->m_ddr_a = data; | |
| 304 | m_ddr_a = data; | |
| 308 | 305 | } |
| 309 | 306 | |
| 310 | READ8_ | |
| 307 | READ8_M | |
| 311 | 308 | { |
| 312 | renegade_state *state = space->machine().driver_data<renegade_state>(); | |
| 313 | return (state->m_port_b_out & state->m_ddr_b) | (state->m_port_b_in & ~state->m_ddr_b); | |
| 309 | return (m_port_b_out & m_ddr_b) | (m_port_b_in & ~m_ddr_b); | |
| 314 | 310 | } |
| 315 | 311 | |
| 316 | WRITE8_ | |
| 312 | WRITE8_M | |
| 317 | 313 | { |
| 318 | renegade_state *state = space->machine().driver_data<renegade_state>(); | |
| 319 | if ((state->m_ddr_b & 0x02) && (~data & 0x02) && (state->m_port_b_out & 0x02)) | |
| 314 | if ((m_ddr_b & 0x02) && (~data & 0x02) && (m_port_b_out & 0x02)) | |
| 320 | 315 | { |
| 321 | | |
| 316 | | |
| 322 | 317 | |
| 323 | if (state->m_main_sent) | |
| 324 | cputag_set_input_line(space->machine(), "mcu", 0, CLEAR_LINE); | |
| 318 | if (m_main_sent) | |
| 319 | cputag_set_input_line(machine(), "mcu", 0, CLEAR_LINE); | |
| 325 | 320 | |
| 326 | | |
| 321 | | |
| 327 | 322 | } |
| 328 | if (( | |
| 323 | if (( | |
| 329 | 324 | { |
| 330 | state->m_from_mcu = state->m_port_a_out; | |
| 331 | state->m_mcu_sent = 1; | |
| 325 | m_from_mcu = m_port_a_out; | |
| 326 | m_mcu_sent = 1; | |
| 332 | 327 | } |
| 333 | 328 | |
| 334 | | |
| 329 | | |
| 335 | 330 | } |
| 336 | 331 | |
| 337 | WRITE8_ | |
| 332 | WRITE8_M | |
| 338 | 333 | { |
| 339 | renegade_state *state = space->machine().driver_data<renegade_state>(); | |
| 340 | state->m_ddr_b = data; | |
| 334 | m_ddr_b = data; | |
| 341 | 335 | } |
| 342 | 336 | |
| 343 | 337 | |
| 344 | READ8_ | |
| 338 | READ8_M | |
| 345 | 339 | { |
| 346 | renegade_state *state = space->machine().driver_data<renegade_state>(); | |
| 347 | state->m_port_c_in = 0; | |
| 348 | if (state->m_main_sent) | |
| 349 | state->m_port_c_in |= 0x01; | |
| 350 | if (!state->m_mcu_sent) | |
| 351 | state->m_port_c_in |= 0x02; | |
| 340 | m_port_c_in = 0; | |
| 341 | if (m_main_sent) | |
| 342 | m_port_c_in |= 0x01; | |
| 343 | if (!m_mcu_sent) | |
| 344 | m_port_c_in |= 0x02; | |
| 352 | 345 | |
| 353 | return ( | |
| 346 | return ( | |
| 354 | 347 | } |
| 355 | 348 | |
| 356 | WRITE8_ | |
| 349 | WRITE8_M | |
| 357 | 350 | { |
| 358 | renegade_state *state = space->machine().driver_data<renegade_state>(); | |
| 359 | state->m_port_c_out = data; | |
| 351 | m_port_c_out = data; | |
| 360 | 352 | } |
| 361 | 353 | |
| 362 | WRITE8_ | |
| 354 | WRITE8_M | |
| 363 | 355 | { |
| 364 | renegade_state *state = space->machine().driver_data<renegade_state>(); | |
| 365 | state->m_ddr_c = data; | |
| 356 | m_ddr_c = data; | |
| 366 | 357 | } |
| 367 | 358 | |
| 368 | 359 | |
| r14860 | r14861 | |
| 683 | 674 | |
| 684 | 675 | static ADDRESS_MAP_START( renegade_mcu_map, AS_PROGRAM, 8, renegade_state ) |
| 685 | 676 | ADDRESS_MAP_GLOBAL_MASK(0x7ff) |
| 686 | AM_RANGE(0x0000, 0x0000) AM_READWRITE_LEGACY(renegade_68705_port_a_r, renegade_68705_port_a_w) | |
| 687 | AM_RANGE(0x0001, 0x0001) AM_READWRITE_LEGACY(renegade_68705_port_b_r, renegade_68705_port_b_w) | |
| 688 | AM_RANGE(0x0002, 0x0002) AM_READWRITE_LEGACY(renegade_68705_port_c_r, renegade_68705_port_c_w) | |
| 689 | AM_RANGE(0x0004, 0x0004) AM_WRITE_LEGACY(renegade_68705_ddr_a_w) | |
| 690 | AM_RANGE(0x0005, 0x0005) AM_WRITE_LEGACY(renegade_68705_ddr_b_w) | |
| 691 | AM_RANGE(0x0006, 0x0006) AM_WRITE_LEGACY(renegade_68705_ddr_c_w) | |
| 677 | AM_RANGE(0x0000, 0x0000) AM_READWRITE(renegade_68705_port_a_r, renegade_68705_port_a_w) | |
| 678 | AM_RANGE(0x0001, 0x0001) AM_READWRITE(renegade_68705_port_b_r, renegade_68705_port_b_w) | |
| 679 | AM_RANGE(0x0002, 0x0002) AM_READWRITE(renegade_68705_port_c_r, renegade_68705_port_c_w) | |
| 680 | AM_RANGE(0x0004, 0x0004) AM_WRITE(renegade_68705_ddr_a_w) | |
| 681 | AM_RANGE(0x0005, 0x0005) AM_WRITE(renegade_68705_ddr_b_w) | |
| 682 | AM_RANGE(0x0006, 0x0006) AM_WRITE(renegade_68705_ddr_c_w) | |
| 692 | 683 | // AM_RANGE(0x0008, 0x0008) AM_READWRITE_LEGACY(m68705_tdr_r, m68705_tdr_w) |
| 693 | 684 | // AM_RANGE(0x0009, 0x0009) AM_READWRITE_LEGACY(m68705_tcr_r, m68705_tcr_w) |
| 694 | 685 | AM_RANGE(0x0010, 0x007f) AM_RAM |
| r14860 | r14861 | |
|---|---|---|
| 286 | 286 | { |
| 287 | 287 | meritm_state *state = machine.driver_data<meritm_state>(); |
| 288 | 288 | for(int i = 0; i < count; i++) |
| 289 | state->m_microtouch->rx(*memory | |
| 289 | state->m_microtouch->rx(*machine.memory(). | |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | WRITE8_MEMBER(meritm_state::microtouch_tx) |
| r14860 | r14861 | |
|---|---|---|
| 410 | 410 | |
| 411 | 411 | static WRITE8_DEVICE_HANDLER( pia_comp_w ) |
| 412 | 412 | { |
| 413 | downcast<pia6821_device *>(device)->write(* | |
| 413 | downcast<pia6821_device *>(device)->write(* | |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 |
| r14860 | r14861 | |
|---|---|---|
| 1448 | 1448 | cd32_state *state = machine.driver_data<cd32_state>(); |
| 1449 | 1449 | UINT8 data8 = data & 0xff; |
| 1450 | 1450 | if ( data8 != 0x00 ) |
| 1451 | state->m_microtouch->rx(*memory | |
| 1451 | state->m_microtouch->rx(*machine.memory(). | |
| 1452 | 1452 | } |
| 1453 | 1453 | |
| 1454 | 1454 | WRITE8_MEMBER (cd32_state::microtouch_tx) |
| r14860 | r14861 | |
|---|---|---|
| 444 | 444 | * |
| 445 | 445 | *************************************/ |
| 446 | 446 | |
| 447 | READ16_ | |
| 447 | READ16_M | |
| 448 | 448 | { |
| 449 | neogeo_state *state = space->machine().driver_data<neogeo_state>(); | |
| 450 | 449 | UINT16 ret; |
| 451 | 450 | |
| 452 | 451 | /* unmapped memory returns the last word on the data bus, which is almost always the opcode |
| 453 | 452 | of the next instruction due to prefetch */ |
| 454 | 453 | |
| 455 | 454 | /* prevent recursion */ |
| 456 | if ( | |
| 455 | if ( | |
| 457 | 456 | ret = 0xffff; |
| 458 | 457 | else |
| 459 | 458 | { |
| 460 | state->m_recurse = 1; | |
| 461 | ret = space->read_word(cpu_get_pc(&space->device())); | |
| 462 | state->m_recurse = 0; | |
| 459 | m_recurse = 1; | |
| 460 | ret = space.read_word(cpu_get_pc(&space.device())); | |
| 461 | m_recurse = 0; | |
| 463 | 462 | } |
| 464 | 463 | |
| 465 | 464 | return ret; |
| r14860 | r14861 | |
| 1092 | 1091 | AM_RANGE(0x2ffff0, 0x2fffff) AM_WRITE(main_cpu_bank_select_w) |
| 1093 | 1092 | AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01ff7e) AM_READ_PORT("IN0") |
| 1094 | 1093 | AM_RANGE(0x300080, 0x300081) AM_MIRROR(0x01ff7e) AM_READ_PORT("IN4") |
| 1095 | AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01ffe0) AM_READ | |
| 1094 | AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01ffe0) AM_READ | |
| 1096 | 1095 | AM_RANGE(0x320000, 0x320001) AM_MIRROR(0x01fffe) AM_READ_PORT("IN3") AM_WRITE(audio_command_w) |
| 1097 | 1096 | AM_RANGE(0x340000, 0x340001) AM_MIRROR(0x01fffe) AM_READ_PORT("IN1") |
| 1098 | AM_RANGE(0x360000, 0x37ffff) AM_READ | |
| 1097 | AM_RANGE(0x360000, 0x37ffff) AM_READ | |
| 1099 | 1098 | AM_RANGE(0x380000, 0x380001) AM_MIRROR(0x01fffe) AM_READ_PORT("IN2") |
| 1100 | 1099 | AM_RANGE(0x380000, 0x38007f) AM_MIRROR(0x01ff80) AM_WRITE(io_control_w) |
| 1101 | AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READ | |
| 1100 | AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READ | |
| 1102 | 1101 | AM_RANGE(0x3c0000, 0x3c0007) AM_MIRROR(0x01fff8) AM_READ_LEGACY(neogeo_video_register_r) |
| 1103 | 1102 | AM_RANGE(0x3c0000, 0x3c000f) AM_MIRROR(0x01fff0) AM_WRITE_LEGACY(neogeo_video_register_w) |
| 1104 | AM_RANGE(0x3e0000, 0x3fffff) AM_READ | |
| 1103 | AM_RANGE(0x3e0000, 0x3fffff) AM_READ | |
| 1105 | 1104 | AM_RANGE(0x400000, 0x401fff) AM_MIRROR(0x3fe000) AM_READWRITE_LEGACY(neogeo_paletteram_r, neogeo_paletteram_w) |
| 1106 | 1105 | AM_RANGE(0x800000, 0x800fff) AM_READWRITE(memcard_r, memcard_w) |
| 1107 | 1106 | AM_RANGE(0xc00000, 0xc1ffff) AM_MIRROR(0x0e0000) AM_ROMBANK(NEOGEO_BANK_BIOS) |
| 1108 | 1107 | AM_RANGE(0xd00000, 0xd0ffff) AM_MIRROR(0x0f0000) AM_RAM_WRITE(save_ram_w) AM_BASE_LEGACY(&save_ram) |
| 1109 | AM_RANGE(0xe00000, 0xffffff) AM_READ | |
| 1108 | AM_RANGE(0xe00000, 0xffffff) AM_READ | |
| 1110 | 1109 | ADDRESS_MAP_END |
| 1111 | 1110 | |
| 1112 | 1111 |
| r14860 | r14861 | |
|---|---|---|
| 268 | 268 | static WRITE8_HANDLER( darktowr_bankswitch_w ) |
| 269 | 269 | { |
| 270 | 270 | ddragon_state *state = space->machine().driver_data<ddragon_state>(); |
| 271 | int oldbank = | |
| 271 | int oldbank = | |
| 272 | 272 | int newbank = (data & 0xe0) >> 5; |
| 273 | 273 | |
| 274 | 274 | state->m_scrollx_hi = (data & 0x01); |
| r14860 | r14861 | |
|---|---|---|
| 2004 | 2004 | AM_RANGE(0xff8002, 0xff8003) AM_DEVREADWRITE8("acia6850_1", acia6850_device, data_read, data_write, 0xff) |
| 2005 | 2005 | AM_RANGE(0xff9000, 0xff900f) AM_DEVREADWRITE8("6840ptm_68k", ptm6840_device, read, write, 0xff) |
| 2006 | 2006 | AM_RANGE(0xffa040, 0xffa04f) AM_DEVREAD8("ptm_ic3ss", ptm6840_device, read,0xff) // 6840PTM on sampled sound board |
| 2007 | AM_RANGE(0xffa040, 0xffa04f) AM_WRITE8 | |
| 2007 | AM_RANGE(0xffa040, 0xffa04f) AM_WRITE8 | |
| 2008 | 2008 | AM_RANGE(0xffa060, 0xffa067) AM_DEVREADWRITE8("pia_ic4ss", pia6821_device, read, write,0x00ff) // PIA6821 on sampled sound board |
| 2009 | 2009 | AM_RANGE(0xffd000, 0xffd00f) AM_READWRITE_LEGACY(characteriser16_r, characteriser16_w) |
| 2010 | 2010 | // AM_RANGE(0xfff000, 0xffffff) AM_NOP /* Possible bug, reads and writes here */ |
| r14860 | r14861 | |
| 2061 | 2061 | AM_RANGE(0xe01000, 0xe0100f) AM_DEVREADWRITE8("6840ptm_68k", ptm6840_device, read, write, 0x00ff) |
| 2062 | 2062 | AM_RANGE(0xe02000, 0xe02007) AM_DEVREADWRITE8("pia_ic4ss", pia6821_device, read, write, 0xff00) |
| 2063 | 2063 | AM_RANGE(0xe03000, 0xe0300f) AM_DEVREAD8("ptm_ic3ss", ptm6840_device, read,0xff00) // 6840PTM on sampled sound board |
| 2064 | AM_RANGE(0xe03000, 0xe0300f) AM_WRITE8 | |
| 2064 | AM_RANGE(0xe03000, 0xe0300f) AM_WRITE8 | |
| 2065 | 2065 | AM_RANGE(0xe04000, 0xe0400f) AM_READWRITE_LEGACY(bwb_characteriser16_r, bwb_characteriser16_w)//AM_READWRITE_LEGACY(adpcm_r, adpcm_w) CHR ? |
| 2066 | 2066 | ADDRESS_MAP_END |
| 2067 | 2067 |
| r14860 | r14861 | |
|---|---|---|
| 2032 | 2032 | |
| 2033 | 2033 | #ifdef UNUSED_FUNCTION |
| 2034 | 2034 | // causes input problems? |
| 2035 | READ32_ | |
| 2035 | READ32_M | |
| 2036 | 2036 | { |
| 2037 | seibuspi_state *state = space->machine().driver_data<seibuspi_state>(); | |
| 2038 | // mame_printf_debug("%08x\n",cpu_get_pc(&space->device())); | |
| 2039 | if (cpu_get_pc(&space->device())==0x03032c7) device_spin_until_interrupt(&space->device()); // idle | |
| 2040 | return state->m_spimainram[(0x002d224-0x800)/4]; | |
| 2037 | // mame_printf_debug("%08x\n",cpu_get_pc(&space.device())); | |
| 2038 | if (cpu_get_pc(&space.device())==0x03032c7) device_spin_until_interrupt(&space.device()); // idle | |
| 2039 | return m_spimainram[(0x002d224-0x800)/4]; | |
| 2041 | 2040 | } |
| 2042 | 2041 | #endif |
| 2043 | 2042 |
| r14860 | r14861 | |
|---|---|---|
| 64 | 64 | WRITE8_MEMBER(actfancr_state::actfancr_buffer_spriteram_w) |
| 65 | 65 | { |
| 66 | 66 | |
| 67 | UINT8 *src = reinterpret_cast<UINT8 *>(memory | |
| 67 | UINT8 *src = reinterpret_cast<UINT8 *>(machine().memory(). | |
| 68 | 68 | // copy to a 16-bit region for our sprite draw code too |
| 69 | 69 | for (int i=0;i<0x800/2;i++) |
| 70 | 70 | { |
| r14860 | r14861 | |
|---|---|---|
| 244 | 244 | |
| 245 | 245 | |
| 246 | 246 | |
| 247 | READ16_ | |
| 247 | READ16_M | |
| 248 | 248 | { |
| 249 | 249 | static const char *const dswname[] = { "IN0", "DSWA", "DSWB", "DSWC" }; |
| 250 | int in = input_port_read( | |
| 250 | int in = input_port_read( | |
| 251 | 251 | return (in << 8) | 0xff; |
| 252 | 252 | } |
| 253 | 253 | |
| r14860 | r14861 | |
| 301 | 301 | soundlatch2_w(space, 0, data & 0xff); |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | WRITE16_ | |
| 304 | WRITE16_M | |
| 305 | 305 | { |
| 306 | 306 | if (ACCESSING_BITS_8_15) |
| 307 | 307 | { |
| 308 | coin_counter_w(space->machine(), 0, data & 0x0100); | |
| 309 | coin_counter_w(space->machine(), 1, data & 0x0200); | |
| 310 | coin_lockout_w(space->machine(), 0, ~data & 0x0400); | |
| 311 | coin_lockout_w(space->machine(), 1, ~data & 0x0800); | |
| 308 | coin_counter_w(machine(), 0, data & 0x0100); | |
| 309 | coin_counter_w(machine(), 1, data & 0x0200); | |
| 310 | coin_lockout_w(machine(), 0, ~data & 0x0400); | |
| 311 | coin_lockout_w(machine(), 1, ~data & 0x0800); | |
| 312 | 312 | |
| 313 | 313 | // bit 15 = CPS-A custom reset? |
| 314 | 314 | } |
| r14860 | r14861 | |
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | READ16_ | |
| 362 | READ16_M | |
| 363 | 363 | { |
| 364 | cps_state *state = space->machine().driver_data<cps_state>(); | |
| 365 | return state->m_qsound_sharedram1[offset] | 0xff00; | |
| 364 | return m_qsound_sharedram1[offset] | 0xff00; | |
| 366 | 365 | } |
| 367 | 366 | |
| 368 | WRITE16_ | |
| 367 | WRITE16_M | |
| 369 | 368 | { |
| 370 | cps_state *state = space->machine().driver_data<cps_state>(); | |
| 371 | 369 | |
| 372 | 370 | if (ACCESSING_BITS_0_7) |
| 373 | | |
| 371 | | |
| 374 | 372 | } |
| 375 | 373 | |
| 376 | 374 | READ16_MEMBER(cps_state::qsound_sharedram2_r) |
| r14860 | r14861 | |
| 539 | 537 | AM_RANGE(0x000000, 0x3fffff) AM_ROM |
| 540 | 538 | AM_RANGE(0x800000, 0x800007) AM_READ_PORT("IN1") /* Player input ports */ |
| 541 | 539 | /* forgottn, willow, cawing, nemo, varth read from 800010. Probably debug input leftover from development */ |
| 542 | AM_RANGE(0x800018, 0x80001f) AM_READ | |
| 540 | AM_RANGE(0x800018, 0x80001f) AM_READ | |
| 543 | 541 | AM_RANGE(0x800020, 0x800021) AM_READNOP /* ? Used by Rockman ? not mapped according to PAL */ |
| 544 | AM_RANGE(0x800030, 0x800037) AM_WRITE | |
| 542 | AM_RANGE(0x800030, 0x800037) AM_WRITE | |
| 545 | 543 | /* Forgotten Worlds has dial controls on B-board mapped at 800040-80005f. See DRIVER_INIT */ |
| 546 | 544 | AM_RANGE(0x800100, 0x80013f) AM_WRITE_LEGACY(cps1_cps_a_w) AM_BASE(m_cps_a_regs) /* CPS-A custom */ |
| 547 | 545 | /* CPS-B custom is mapped by the PAL IOB2 on the B-board. SF2 revision "E" World and USA 910228 has it a a different |
| r14860 | r14861 | |
| 591 | 589 | static ADDRESS_MAP_START( qsound_main_map, AS_PROGRAM, 16, cps_state ) |
| 592 | 590 | AM_RANGE(0x000000, 0x1fffff) AM_ROM |
| 593 | 591 | AM_RANGE(0x800000, 0x800007) AM_READ_PORT("IN1") /* Player input ports */ |
| 594 | AM_RANGE(0x800018, 0x80001f) AM_READ_LEGACY(cps1_dsw_r) /* System input ports / Dip Switches */ | |
| 595 | AM_RANGE(0x800030, 0x800037) AM_WRITE_LEGACY(cps1_coinctrl_w) | |
| 592 | AM_RANGE(0x800018, 0x80001f) AM_READ(cps1_dsw_r) /* System input ports / Dip Switches */ | |
| 593 | AM_RANGE(0x800030, 0x800037) AM_WRITE(cps1_coinctrl_w) | |
| 596 | 594 | AM_RANGE(0x800100, 0x80013f) AM_WRITE_LEGACY(cps1_cps_a_w) AM_BASE(m_cps_a_regs) /* CPS-A custom */ |
| 597 | 595 | AM_RANGE(0x800140, 0x80017f) AM_READWRITE_LEGACY(cps1_cps_b_r, cps1_cps_b_w) AM_BASE(m_cps_b_regs) /* CPS-B custom (mapped by LWIO/IOB1 PAL on B-board) */ |
| 598 | 596 | AM_RANGE(0x900000, 0x92ffff) AM_RAM_WRITE_LEGACY(cps1_gfxram_w) AM_BASE_SIZE(m_gfxram, m_gfxram_size) /* SF2CE executes code from here */ |
| 599 | 597 | AM_RANGE(0xf00000, 0xf0ffff) AM_READ(qsound_rom_r) /* Slammasters protection */ |
| 600 | AM_RANGE(0xf18000, 0xf19fff) AM_READWRITE | |
| 598 | AM_RANGE(0xf18000, 0xf19fff) AM_READWRITE | |
| 601 | 599 | AM_RANGE(0xf1c000, 0xf1c001) AM_READ_PORT("IN2") /* Player 3 controls (later games) */ |
| 602 | 600 | AM_RANGE(0xf1c002, 0xf1c003) AM_READ_PORT("IN3") /* Player 4 controls ("Muscle Bombers") */ |
| 603 | 601 | AM_RANGE(0xf1c004, 0xf1c005) AM_WRITE(cpsq_coinctrl2_w) /* Coin control2 (later games) */ |
| r14860 | r14861 | |
|---|---|---|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | |
| 75 | WRITE8_ | |
| 75 | WRITE8_M | |
| 76 | 76 | { |
| 77 | espial_state *state = space->machine().driver_data<espial_state>(); | |
| 78 | state->m_sound_nmi_enabled = data & 1; | |
| 77 | m_sound_nmi_enabled = data & 1; | |
| 79 | 78 | } |
| 80 | 79 | |
| 81 | 80 | static TIMER_DEVICE_CALLBACK( espial_scanline ) |
| r14860 | r14861 | |
| 156 | 155 | static ADDRESS_MAP_START( espial_sound_map, AS_PROGRAM, 8, espial_state ) |
| 157 | 156 | AM_RANGE(0x0000, 0x1fff) AM_ROM |
| 158 | 157 | AM_RANGE(0x2000, 0x23ff) AM_RAM |
| 159 | AM_RANGE(0x4000, 0x4000) AM_WRITE | |
| 158 | AM_RANGE(0x4000, 0x4000) AM_WRITE | |
| 160 | 159 | AM_RANGE(0x6000, 0x6000) AM_READWRITE(soundlatch_r, soundlatch2_w) |
| 161 | 160 | ADDRESS_MAP_END |
| 162 | 161 |
| r14860 | r14861 | |
|---|---|---|
| 50 | 50 | |
| 51 | 51 | ***************************************************************************/ |
| 52 | 52 | |
| 53 | WRITE16_ | |
| 53 | WRITE16_M | |
| 54 | 54 | { |
| 55 | tetrisp2_state *state = space->machine().driver_data<tetrisp2_state>(); | |
| 56 | 55 | if (ACCESSING_BITS_0_7) |
| 57 | 56 | { |
| 58 | | |
| 57 | | |
| 59 | 58 | } |
| 60 | 59 | } |
| 61 | 60 | |
| r14860 | r14861 | |
| 216 | 215 | |
| 217 | 216 | |
| 218 | 217 | /* The game only ever writes even bytes and reads odd bytes */ |
| 219 | READ16_ | |
| 218 | READ16_M | |
| 220 | 219 | { |
| 221 | tetrisp2_state *state = space->machine().driver_data<tetrisp2_state>(); | |
| 222 | return ( (state->m_nvram[offset] >> 8) & 0x00ff ) | | |
| 223 | ( (state->m_nvram[offset] << 8) & 0xff00 ) ; | |
| 220 | return ( (m_nvram[offset] >> 8) & 0x00ff ) | | |
| 221 | ( (m_nvram[offset] << 8) & 0xff00 ) ; | |
| 224 | 222 | } |
| 225 | 223 | |
| 226 | WRITE16_ | |
| 224 | WRITE16_M | |
| 227 | 225 | { |
| 228 | tetrisp2_state *state = space->machine().driver_data<tetrisp2_state>(); | |
| 229 | COMBINE_DATA(&state->m_nvram[offset]); | |
| 226 | COMBINE_DATA(&m_nvram[offset]); | |
| 230 | 227 | } |
| 231 | 228 | |
| 232 | 229 | READ16_MEMBER(tetrisp2_state::rockn_nvram_r) |
| r14860 | r14861 | |
| 297 | 294 | AM_RANGE(0x600000, 0x60ffff) AM_RAM_WRITE_LEGACY(tetrisp2_vram_rot_w) AM_BASE(m_vram_rot) // Rotation |
| 298 | 295 | AM_RANGE(0x650000, 0x651fff) AM_RAM_WRITE_LEGACY(tetrisp2_vram_rot_w) // Rotation (mirror) |
| 299 | 296 | AM_RANGE(0x800000, 0x800003) AM_DEVREADWRITE8_LEGACY("ymz", ymz280b_r, ymz280b_w, 0x00ff) // Sound |
| 300 | AM_RANGE(0x900000, 0x903fff) AM_READ_LEGACY(tetrisp2_nvram_r) AM_WRITE_LEGACY(tetrisp2_nvram_w) AM_BASE(m_nvram) AM_SHARE("nvram") // NVRAM | |
| 301 | AM_RANGE(0x904000, 0x907fff) AM_READ_LEGACY(tetrisp2_nvram_r) AM_WRITE_LEGACY(tetrisp2_nvram_w) // NVRAM (mirror) | |
| 297 | AM_RANGE(0x900000, 0x903fff) AM_READ(tetrisp2_nvram_r) AM_WRITE(tetrisp2_nvram_w) AM_BASE(m_nvram) AM_SHARE("nvram") // NVRAM | |
| 298 | AM_RANGE(0x904000, 0x907fff) AM_READ(tetrisp2_nvram_r) AM_WRITE(tetrisp2_nvram_w) // NVRAM (mirror) | |
| 302 | 299 | AM_RANGE(0xb00000, 0xb00001) AM_WRITE(tetrisp2_coincounter_w) // Coin Counter |
| 303 | 300 | AM_RANGE(0xb20000, 0xb20001) AM_WRITENOP // ??? |
| 304 | 301 | AM_RANGE(0xb40000, 0xb4000b) AM_WRITEONLY AM_BASE(m_scroll_fg) // Foreground Scrolling |
| 305 | 302 | AM_RANGE(0xb40010, 0xb4001b) AM_WRITEONLY AM_BASE(m_scroll_bg) // Background Scrolling |
| 306 | 303 | AM_RANGE(0xb4003e, 0xb4003f) AM_WRITENOP // scr_size |
| 307 | 304 | AM_RANGE(0xb60000, 0xb6002f) AM_WRITEONLY AM_BASE(m_rotregs) // Rotation Registers |
| 308 | AM_RANGE(0xba0000, 0xba001f) AM_WRITE | |
| 305 | AM_RANGE(0xba0000, 0xba001f) AM_WRITE | |
| 309 | 306 | AM_RANGE(0xba001a, 0xba001b) AM_WRITENOP // Lev 4 irq ack |
| 310 | 307 | AM_RANGE(0xba001e, 0xba001f) AM_WRITENOP // Lev 2 irq ack |
| 311 | 308 | AM_RANGE(0xbe0000, 0xbe0001) AM_READNOP // INT-level1 dummy read |
| r14860 | r14861 | |
| 359 | 356 | |
| 360 | 357 | AM_RANGE(0x800000, 0x800003) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff ) // Sound |
| 361 | 358 | |
| 362 | AM_RANGE(0x900000, 0x903fff) AM_READWRITE | |
| 359 | AM_RANGE(0x900000, 0x903fff) AM_READWRITE | |
| 363 | 360 | |
| 364 | 361 | AM_RANGE(0xb00000, 0xb00001) AM_WRITE(nndmseal_coincounter_w) // Coin Counter |
| 365 | 362 | AM_RANGE(0xb20000, 0xb20001) AM_WRITE(nndmseal_b20000_w) // ??? |
| r14860 | r14861 | |
| 398 | 395 | AM_RANGE(0x408000, 0x409fff) AM_RAM // ??? |
| 399 | 396 | AM_RANGE(0x500000, 0x50ffff) AM_RAM // Line |
| 400 | 397 | AM_RANGE(0x600000, 0x60ffff) AM_RAM_WRITE_LEGACY(tetrisp2_vram_rot_w) AM_BASE(m_vram_rot) // Rotation |
| 401 | AM_RANGE(0x900000, 0x903fff) AM_READ(rockn_nvram_r) AM_WRITE | |
| 398 | AM_RANGE(0x900000, 0x903fff) AM_READ(rockn_nvram_r) AM_WRITE | |
| 402 | 399 | AM_RANGE(0xa30000, 0xa30001) AM_READWRITE(rockn_soundvolume_r, rockn_soundvolume_w) // Sound Volume |
| 403 | 400 | AM_RANGE(0xa40000, 0xa40003) AM_DEVREADWRITE8_LEGACY("ymz", ymz280b_r, ymz280b_w, 0x00ff) // Sound |
| 404 | 401 | AM_RANGE(0xa44000, 0xa44001) AM_READWRITE(rockn_adpcmbank_r, rockn_adpcmbank_w) // Sound Bank |
| r14860 | r14861 | |
| 432 | 429 | AM_RANGE(0x800000, 0x803fff) AM_RAM_WRITE_LEGACY(tetrisp2_vram_fg_w) AM_BASE(m_vram_fg) // Foreground |
| 433 | 430 | AM_RANGE(0x804000, 0x807fff) AM_RAM_WRITE_LEGACY(tetrisp2_vram_bg_w) AM_BASE(m_vram_bg) // Background |
| 434 | 431 | AM_RANGE(0x808000, 0x809fff) AM_RAM // ??? |
| 435 | AM_RANGE(0x900000, 0x903fff) AM_READ(rockn_nvram_r) AM_WRITE | |
| 432 | AM_RANGE(0x900000, 0x903fff) AM_READ(rockn_nvram_r) AM_WRITE | |
| 436 | 433 | AM_RANGE(0xa30000, 0xa30001) AM_READWRITE(rockn_soundvolume_r, rockn_soundvolume_w) // Sound Volume |
| 437 | 434 | AM_RANGE(0xa40000, 0xa40003) AM_DEVREADWRITE8_LEGACY("ymz", ymz280b_r, ymz280b_w, 0x00ff) // Sound |
| 438 | 435 | AM_RANGE(0xa44000, 0xa44001) AM_READWRITE(rockn_adpcmbank_r, rockn2_adpcmbank_w) // Sound Bank |
| r14860 | r14861 | |
| 466 | 463 | AM_RANGE(0x800000, 0x803fff) AM_RAM_WRITE_LEGACY(tetrisp2_vram_fg_w) AM_BASE(m_vram_fg) // Foreground |
| 467 | 464 | AM_RANGE(0x804000, 0x807fff) AM_RAM_WRITE_LEGACY(tetrisp2_vram_bg_w) AM_BASE(m_vram_bg) // Background |
| 468 | 465 | // AM_RANGE(0x808000, 0x809fff) AM_RAM // ??? |
| 469 | AM_RANGE(0x900000, 0x903fff) AM_READ(rockn_nvram_r) AM_WRITE | |
| 466 | AM_RANGE(0x900000, 0x903fff) AM_READ(rockn_nvram_r) AM_WRITE | |
| 470 | 467 | AM_RANGE(0xa30000, 0xa30001) AM_READWRITE(rockn_soundvolume_r, rockn_soundvolume_w) // Sound Volume |
| 471 | 468 | AM_RANGE(0xa40000, 0xa40003) AM_DEVREADWRITE8_LEGACY("ymz", ymz280b_r, ymz280b_w, 0x00ff) // Sound |
| 472 | 469 | AM_RANGE(0xa44000, 0xa44001) AM_READWRITE(rockn_adpcmbank_r, rockn_adpcmbank_w) // Sound Bank |
| r14860 | r14861 | |
|---|---|---|
| 205 | 205 | tmaster_state *state = device->machine().driver_data<tmaster_state>(); |
| 206 | 206 | if ( channel == 0 ) |
| 207 | 207 | { |
| 208 | state->m_microtouch->rx(* | |
| 208 | state->m_microtouch->rx(* | |
| 209 | 209 | } |
| 210 | 210 | }; |
| 211 | 211 | |
| r14860 | r14861 | |
| 658 | 658 | |
| 659 | 659 | state->m_gfx_offs = 0x200000 * cart; |
| 660 | 660 | |
| 661 | if (memory | |
| 661 | if (machine.memory(). | |
| 662 | 662 | memory_set_bank(machine, GALGAMES_BANK_200000_R, GALGAMES_ROM0 + state->m_galgames_cart); // rom |
| 663 | 663 | |
| 664 | 664 | memory_set_bank(machine, GALGAMES_BANK_240000_R, GALGAMES_ROM0 + state->m_galgames_cart); // rom |
| r14860 | r14861 | |
|---|---|---|
| 332 | 332 | |
| 333 | 333 | |
| 334 | 334 | |
| 335 | READ16_ | |
| 335 | READ16_M | |
| 336 | 336 | { |
| 337 | 337 | switch (offset<<1) |
| 338 | 338 | { |
| 339 | 339 | case 0: /* Dip Switches */ |
| 340 | return input_port_read( | |
| 340 | return input_port_read( | |
| 341 | 341 | |
| 342 | 342 | case 2: /* Player 1 & Player 2 joysticks & fire buttons */ |
| 343 | return input_port_read( | |
| 343 | return input_port_read( | |
| 344 | 344 | |
| 345 | 345 | case 4: /* Credits */ |
| 346 | return input_port_read( | |
| 346 | return input_port_read( | |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | logerror("Unknown control read at 30c000 %d\n", offset); |
| 350 | 350 | return ~0; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | READ16_ | |
| 353 | READ16_M | |
| 354 | 354 | { |
| 355 | 355 | /* These values are for Boulderdash, I have no idea what they do in Slyspy */ |
| 356 | 356 | switch (offset<<1) { |
| r14860 | r14861 | |
| 360 | 360 | case 6: return 0x2; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | logerror("%04x, Unknown protection read at 30c000 %d\n", cpu_get_pc(&space | |
| 363 | logerror("%04x, Unknown protection read at 30c000 %d\n", cpu_get_pc(&space. | |
| 364 | 364 | return 0; |
| 365 | 365 | } |
| 366 | 366 | |
| r14860 | r14861 | |
| 406 | 406 | |
| 407 | 407 | void slyspy_set_protection_map(running_machine& machine, int type); |
| 408 | 408 | |
| 409 | WRITE16_ | |
| 409 | WRITE16_M | |
| 410 | 410 | { |
| 411 | dec0_state *state = space->machine().driver_data<dec0_state>(); | |
| 412 | state->m_slyspy_state=0; | |
| 413 | slyspy_set_protection_map(space->machine(), state->m_slyspy_state); | |
| 411 | m_slyspy_state=0; | |
| 412 | slyspy_set_protection_map(machine(), m_slyspy_state); | |
| 414 | 413 | } |
| 415 | 414 | |
| 416 | READ16_ | |
| 415 | READ16_M | |
| 417 | 416 | { |
| 418 | dec0_state *state = space->machine().driver_data<dec0_state>(); | |
| 419 | state->m_slyspy_state++; | |
| 420 | state->m_slyspy_state=state->m_slyspy_state%4; | |
| 421 | slyspy_set_protection_map(space->machine(), state->m_slyspy_state); | |
| 417 | m_slyspy_state++; | |
| 418 | m_slyspy_state=m_slyspy_state%4; | |
| 419 | slyspy_set_protection_map(machine(), m_slyspy_state); | |
| 422 | 420 | |
| 423 | 421 | return 0; /* Value doesn't mater */ |
| 424 | 422 | } |
| r14860 | r14861 | |
| 433 | 431 | |
| 434 | 432 | space->install_write_handler( 0x240000, 0x24ffff, write16_delegate(FUNC(dec0_state::unmapped_w),state)); |
| 435 | 433 | |
| 436 | space->install_legacy_write_handler( 0x24a000, 0x24a001, FUNC(slyspy_state_w)); | |
| 437 | space->install_legacy_read_handler( 0x244000, 0x244001, FUNC(slyspy_state_r)); | |
| 434 | space->install_write_handler( 0x24a000, 0x24a001, write16_delegate(FUNC(dec0_state::slyspy_state_w),state)); | |
| 435 | space->install_read_handler( 0x244000, 0x244001, read16_delegate(FUNC(dec0_state::slyspy_state_r),state)); | |
| 438 | 436 | |
| 439 | 437 | switch (type) |
| 440 | 438 | { |
| r14860 | r14861 | |
| 511 | 509 | AM_RANGE(0x308000, 0x3087ff) AM_RAM AM_BASE(m_spriteram) /* Sprites */ |
| 512 | 510 | AM_RANGE(0x310000, 0x3107ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram") |
| 513 | 511 | AM_RANGE(0x314000, 0x314003) AM_WRITE(slyspy_control_w) |
| 514 | AM_RANGE(0x314008, 0x31400f) AM_READ_LEGACY(slyspy_controls_r) | |
| 515 | AM_RANGE(0x31c000, 0x31c00f) AM_READ_LEGACY(slyspy_protection_r) AM_WRITENOP | |
| 512 | AM_RANGE(0x314008, 0x31400f) AM_READ(slyspy_controls_r) | |
| 513 | AM_RANGE(0x31c000, 0x31c00f) AM_READ(slyspy_protection_r) AM_WRITENOP | |
| 516 | 514 | ADDRESS_MAP_END |
| 517 | 515 | |
| 518 | 516 | |
| r14860 | r14861 | |
| 599 | 597 | // AM_RANGE(0x340000, 0x34007f) AM_DEVREADWRITE_LEGACY("tilegen1", deco_bac06_pf_colscroll_r, deco_bac06_pf_colscroll_w) |
| 600 | 598 | // AM_RANGE(0x340400, 0x3407ff) AM_DEVREADWRITE_LEGACY("tilegen1", deco_bac06_pf_rowscroll_r, deco_bac06_pf_rowscroll_w) |
| 601 | 599 | |
| 602 | AM_RANGE(0x314008, 0x31400f) AM_READ | |
| 600 | AM_RANGE(0x314008, 0x31400f) AM_READ | |
| 603 | 601 | // AM_RANGE(0x314000, 0x314003) AM_WRITE(slyspy_control_w) |
| 604 | 602 | |
| 605 | 603 | AM_RANGE(0x300000, 0x300007) AM_DEVWRITE_LEGACY("tilegen3", deco_bac06_pf_control_0_w) |
| r14860 | r14861 | |
|---|---|---|
| 112 | 112 | * |
| 113 | 113 | *************************************/ |
| 114 | 114 | |
| 115 | READ8_ | |
| 115 | READ8_M | |
| 116 | 116 | { |
| 117 | cvs_state *state = space->machine().driver_data<cvs_state>(); | |
| 118 | 117 | |
| 119 | if (*state->m_fo_state) | |
| 120 | return state->m_video_ram[offset]; | |
| 118 | if (*m_fo_state) | |
| 119 | return m_video_ram[offset]; | |
| 121 | 120 | else |
| 122 | return | |
| 121 | return | |
| 123 | 122 | } |
| 124 | 123 | |
| 125 | WRITE8_ | |
| 124 | WRITE8_M | |
| 126 | 125 | { |
| 127 | cvs_state *state = space->machine().driver_data<cvs_state>(); | |
| 128 | 126 | |
| 129 | if (*state->m_fo_state) | |
| 130 | state->m_video_ram[offset] = data; | |
| 127 | if (*m_fo_state) | |
| 128 | m_video_ram[offset] = data; | |
| 131 | 129 | else |
| 132 | | |
| 130 | | |
| 133 | 131 | } |
| 134 | 132 | |
| 135 | 133 | |
| 136 | READ8_ | |
| 134 | READ8_M | |
| 137 | 135 | { |
| 138 | cvs_state *state = space->machine().driver_data<cvs_state>(); | |
| 139 | 136 | |
| 140 | if (*state->m_fo_state) | |
| 141 | return state->m_palette_ram[offset & 0x0f]; | |
| 137 | if (*m_fo_state) | |
| 138 | return m_palette_ram[offset & 0x0f]; | |
| 142 | 139 | else |
| 143 | return | |
| 140 | return | |
| 144 | 141 | } |
| 145 | 142 | |
| 146 | WRITE8_ | |
| 143 | WRITE8_M | |
| 147 | 144 | { |
| 148 | cvs_state *state = space->machine().driver_data<cvs_state>(); | |
| 149 | 145 | |
| 150 | if (*state->m_fo_state) | |
| 151 | state->m_palette_ram[offset & 0x0f] = data; | |
| 146 | if (*m_fo_state) | |
| 147 | m_palette_ram[offset & 0x0f] = data; | |
| 152 | 148 | else |
| 153 | | |
| 149 | | |
| 154 | 150 | } |
| 155 | 151 | |
| 156 | 152 | |
| 157 | READ8_ | |
| 153 | READ8_M | |
| 158 | 154 | { |
| 159 | cvs_state *state = space->machine().driver_data<cvs_state>(); | |
| 160 | 155 | |
| 161 | if (*state->m_fo_state) | |
| 162 | return state->m_character_ram[(0 * 0x800) | 0x400 | state->m_character_ram_page_start | offset]; | |
| 156 | if (*m_fo_state) | |
| 157 | return m_character_ram[(0 * 0x800) | 0x400 | m_character_ram_page_start | offset]; | |
| 163 | 158 | else |
| 164 | return s2636_work_ram_r( | |
| 159 | return s2636_work_ram_r( | |
| 165 | 160 | } |
| 166 | 161 | |
| 167 | WRITE8_ | |
| 162 | WRITE8_M | |
| 168 | 163 | { |
| 169 | cvs_state *state = space->machine().driver_data<cvs_state>(); | |
| 170 | 164 | |
| 171 | if (* | |
| 165 | if (* | |
| 172 | 166 | { |
| 173 | offset |= (0 * 0x800) | 0x400 | state->m_character_ram_page_start; | |
| 174 | state->m_character_ram[offset] = data; | |
| 175 | gfx_element_mark_dirty(space->machine().gfx[1], (offset / 8) % 256); | |
| 167 | offset |= (0 * 0x800) | 0x400 | m_character_ram_page_start; | |
| 168 | m_character_ram[offset] = data; | |
| 169 | gfx_element_mark_dirty(machine().gfx[1], (offset / 8) % 256); | |
| 176 | 170 | } |
| 177 | 171 | else |
| 178 | s2636_work_ram_w( | |
| 172 | s2636_work_ram_w( | |
| 179 | 173 | } |
| 180 | 174 | |
| 181 | 175 | |
| 182 | READ8_ | |
| 176 | READ8_M | |
| 183 | 177 | { |
| 184 | cvs_state *state = space->machine().driver_data<cvs_state>(); | |
| 185 | 178 | |
| 186 | if (*state->m_fo_state) | |
| 187 | return state->m_character_ram[(1 * 0x800) | 0x400 | state->m_character_ram_page_start | offset]; | |
| 179 | if (*m_fo_state) | |
| 180 | return m_character_ram[(1 * 0x800) | 0x400 | m_character_ram_page_start | offset]; | |
| 188 | 181 | else |
| 189 | return s2636_work_ram_r( | |
| 182 | return s2636_work_ram_r( | |
| 190 | 183 | } |
| 191 | 184 | |
| 192 | WRITE8_ | |
| 185 | WRITE8_M | |
| 193 | 186 | { |
| 194 | cvs_state *state = space->machine().driver_data<cvs_state>(); | |
| 195 | 187 | |
| 196 | if (* | |
| 188 | if (* | |
| 197 | 189 | { |
| 198 | offset |= (1 * 0x800) | 0x400 | state->m_character_ram_page_start; | |
| 199 | state->m_character_ram[offset] = data; | |
| 200 | gfx_element_mark_dirty(space->machine().gfx[1], (offset / 8) % 256); | |
| 190 | offset |= (1 * 0x800) | 0x400 | m_character_ram_page_start; | |
| 191 | m_character_ram[offset] = data; | |
| 192 | gfx_element_mark_dirty(machine().gfx[1], (offset / 8) % 256); | |
| 201 | 193 | } |
| 202 | 194 | else |
| 203 | s2636_work_ram_w( | |
| 195 | s2636_work_ram_w( | |
| 204 | 196 | } |
| 205 | 197 | |
| 206 | 198 | |
| 207 | READ8_ | |
| 199 | READ8_M | |
| 208 | 200 | { |
| 209 | cvs_state *state = space->machine().driver_data<cvs_state>(); | |
| 210 | 201 | |
| 211 | if (*state->m_fo_state) | |
| 212 | return state->m_character_ram[(2 * 0x800) | 0x400 | state->m_character_ram_page_start | offset]; | |
| 202 | if (*m_fo_state) | |
| 203 | return m_character_ram[(2 * 0x800) | 0x400 | m_character_ram_page_start | offset]; | |
| 213 | 204 | else |
| 214 | return s2636_work_ram_r( | |
| 205 | return s2636_work_ram_r( | |
| 215 | 206 | } |
| 216 | 207 | |
| 217 | WRITE8_ | |
| 208 | WRITE8_M | |
| 218 | 209 | { |
| 219 | cvs_state *state = space->machine().driver_data<cvs_state>(); | |
| 220 | 210 | |
| 221 | if (* | |
| 211 | if (* | |
| 222 | 212 | { |
| 223 | offset |= (2 * 0x800) | 0x400 | state->m_character_ram_page_start; | |
| 224 | state->m_character_ram[offset] = data; | |
| 225 | gfx_element_mark_dirty(space->machine().gfx[1], (offset / 8) % 256); | |
| 213 | offset |= (2 * 0x800) | 0x400 | m_character_ram_page_start; | |
| 214 | m_character_ram[offset] = data; | |
| 215 | gfx_element_mark_dirty(machine().gfx[1], (offset / 8) % 256); | |
| 226 | 216 | } |
| 227 | 217 | else |
| 228 | s2636_work_ram_w( | |
| 218 | s2636_work_ram_w( | |
| 229 | 219 | } |
| 230 | 220 | |
| 231 | 221 | |
| r14860 | r14861 | |
| 484 | 474 | static ADDRESS_MAP_START( cvs_main_cpu_map, AS_PROGRAM, 8, cvs_state ) |
| 485 | 475 | ADDRESS_MAP_GLOBAL_MASK(0x7fff) |
| 486 | 476 | AM_RANGE(0x0000, 0x13ff) AM_ROM |
| 487 | AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_READWRITE_LEGACY(cvs_bullet_ram_or_palette_r, cvs_bullet_ram_or_palette_w) AM_BASE(m_bullet_ram) | |
| 488 | AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_READWRITE_LEGACY(cvs_s2636_2_or_character_ram_r, cvs_s2636_2_or_character_ram_w) | |
| 489 | AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_READWRITE_LEGACY(cvs_s2636_1_or_character_ram_r, cvs_s2636_1_or_character_ram_w) | |
| 490 | AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_READWRITE_LEGACY(cvs_s2636_0_or_character_ram_r, cvs_s2636_0_or_character_ram_w) | |
| 491 | AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READWRITE_LEGACY(cvs_video_or_color_ram_r, cvs_video_or_color_ram_w) AM_BASE(m_video_ram) | |
| 477 | AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_bullet_ram_or_palette_r, cvs_bullet_ram_or_palette_w) AM_BASE(m_bullet_ram) | |
| 478 | AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_2_or_character_ram_r, cvs_s2636_2_or_character_ram_w) | |
| 479 | AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_1_or_character_ram_r, cvs_s2636_1_or_character_ram_w) | |
| 480 | AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_0_or_character_ram_r, cvs_s2636_0_or_character_ram_w) | |
| 481 | AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READWRITE(cvs_video_or_color_ram_r, cvs_video_or_color_ram_w) AM_BASE(m_video_ram) | |
| 492 | 482 | AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM |
| 493 | 483 | AM_RANGE(0x2000, 0x33ff) AM_ROM |
| 494 | 484 | AM_RANGE(0x4000, 0x53ff) AM_ROM |
| r14860 | r14861 | |
|---|---|---|
| 119 | 119 | |
| 120 | 120 | static ADDRESS_MAP_START( quasar, AS_PROGRAM, 8, quasar_state ) |
| 121 | 121 | AM_RANGE(0x0000, 0x13ff) AM_ROM |
| 122 | AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_READWRITE_LEGACY(cvs_bullet_ram_or_palette_r, quasar_bullet_w) AM_BASE(m_bullet_ram) | |
| 123 | AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_READWRITE_LEGACY(cvs_s2636_0_or_character_ram_r, cvs_s2636_0_or_character_ram_w) | |
| 124 | AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_READWRITE_LEGACY(cvs_s2636_1_or_character_ram_r, cvs_s2636_1_or_character_ram_w) | |
| 125 | AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_READWRITE_LEGACY(cvs_s2636_2_or_character_ram_r, cvs_s2636_2_or_character_ram_w) | |
| 126 | AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READWRITE_LEGACY(cvs_video_or_color_ram_r, quasar_video_w) AM_BASE(m_video_ram) | |
| 122 | AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_READ(cvs_bullet_ram_or_palette_r) AM_WRITE_LEGACY(quasar_bullet_w) AM_BASE(m_bullet_ram) | |
| 123 | AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_0_or_character_ram_r, cvs_s2636_0_or_character_ram_w) | |
| 124 | AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_1_or_character_ram_r, cvs_s2636_1_or_character_ram_w) | |
| 125 | AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_2_or_character_ram_r, cvs_s2636_2_or_character_ram_w) | |
| 126 | AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READ(cvs_video_or_color_ram_r) AM_WRITE_LEGACY(quasar_video_w) AM_BASE(m_video_ram) | |
| 127 | 127 | AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM |
| 128 | 128 | AM_RANGE(0x2000, 0x33ff) AM_ROM |
| 129 | 129 | AM_RANGE(0x4000, 0x53ff) AM_ROM |
| r14860 | r14861 | |
|---|---|---|
| 111 | 111 | static MACHINE_RESET( segac2 ) |
| 112 | 112 | { |
| 113 | 113 | segac2_state *state = machine.driver_data<segac2_state>(); |
| 114 | megadrive_ram = reinterpret_cast<UINT16 *>(memory | |
| 114 | megadrive_ram = reinterpret_cast<UINT16 *>(machine.memory(). | |
| 115 | 115 | |
| 116 | 116 | /* set up interrupts and such */ |
| 117 | 117 | MACHINE_RESET_CALL(megadriv); |
| r14860 | r14861 | |
|---|---|---|
| 460 | 460 | |
| 461 | 461 | |
| 462 | 462 | #ifdef UNUSED_FUNCTION |
| 463 | WRITE32_ | |
| 463 | WRITE32_M | |
| 464 | 464 | { |
| 465 | 465 | logerror("Remapped write... %08x %08x\n",offset,data); |
| 466 | 466 | } |
| r14860 | r14861 | |
| 808 | 808 | } |
| 809 | 809 | |
| 810 | 810 | #ifdef UNUSED_FUNCTION |
| 811 | WRITE32_ | |
| 811 | WRITE32_M | |
| 812 | 812 | { |
| 813 | 813 | fatalerror("WRITE32_HANDLER( hng64_3d_1_w )"); |
| 814 | 814 | } |
| r14860 | r14861 | |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | #ifdef UNUSED_FUNCTION |
| 890 | WRITE32_ | |
| 890 | WRITE32_M | |
| 891 | 891 | { |
| 892 | 892 | COMBINE_DATA (&active_3d_buffer[offset]); |
| 893 | 893 | mame_printf_debug("COMBINED %d\n", active_3d_buffer[offset]); |
| r14860 | r14861 | |
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | 1212 | #ifdef UNUSED_FUNCTION |
| 1213 | READ8_ | |
| 1213 | READ8_M | |
| 1214 | 1214 | { |
| 1215 | 1215 | // I'm thinking 0x54 comes from an interrupt on the MIPS CPU? Or maybe the Toshiba one? |
| 1216 | 1216 | // Nothing from CPU0 seems to ping the COM CPU as often as it reads 0x54. |
| r14860 | r14861 | |
| 1226 | 1226 | if (offset==0x04) (hng64_com_shared_b & 0x000000ff) ? return 0xff : return 0x00; |
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | WRITE8_ | |
| 1229 | WRITE8_M | |
| 1230 | 1230 | { |
| 1231 | 1231 | if (offset==0x00) hng64_com_shared_a = (hng64_com_shared_a & 0x00ffffff) | (data << 24); |
| 1232 | 1232 | if (offset==0x01) hng64_com_shared_a = (hng64_com_shared_a & 0xff00ffff) | (data << 16); |
| r14860 | r14861 | |
| 1258 | 1258 | // AM_RANGE(0x3c,0x3f) AM_NOP /* Reserved */ |
| 1259 | 1259 | |
| 1260 | 1260 | /* General IO */ |
| 1261 | AM_RANGE(0x50,0x54) AM_NOP // AM_WRITE | |
| 1261 | AM_RANGE(0x50,0x54) AM_NOP // AM_WRITE | |
| 1262 | 1262 | // AM_RANGE(0x72,0x72) AM_WRITE /* dunno yet */ |
| 1263 | 1263 | ADDRESS_MAP_END |
| 1264 | 1264 |
| r14860 | r14861 | |
|---|---|---|
| 69 | 69 | AM_RANGE(0x408000, 0x409fff) AM_RAM // ??? |
| 70 | 70 | AM_RANGE(0x500000, 0x50ffff) AM_RAM // Line |
| 71 | 71 | AM_RANGE(0x600000, 0x60ffff) AM_RAM_WRITE_LEGACY(tetrisp2_vram_rot_w) AM_BASE(m_vram_rot) // Rotation |
| 72 | AM_RANGE(0x900000, 0x903fff) AM_READWRITE_LEGACY(tetrisp2_nvram_r, tetrisp2_nvram_w) AM_BASE(m_nvram) AM_SHARE("nvram") // NVRAM | |
| 73 | AM_RANGE(0x904000, 0x907fff) AM_READWRITE_LEGACY(tetrisp2_nvram_r, tetrisp2_nvram_w) // NVRAM (mirror) | |
| 72 | AM_RANGE(0x900000, 0x903fff) AM_READWRITE(tetrisp2_nvram_r, tetrisp2_nvram_w) AM_BASE(m_nvram) AM_SHARE("nvram") // NVRAM | |
| 73 | AM_RANGE(0x904000, 0x907fff) AM_READWRITE(tetrisp2_nvram_r, tetrisp2_nvram_w) // NVRAM (mirror) | |
| 74 | 74 | // AM_RANGE(0xa00000, 0xa7ffff) AM_READ_LEGACY(unknown_read_0xc00000 ) // presumably comms with slave CPU |
| 75 | 75 | AM_RANGE(0xb00000, 0xb00001) AM_WRITENOP // Coin Counter plus other things |
| 76 | 76 | AM_RANGE(0xb20000, 0xb20001) AM_WRITENOP // protection related? |
| r14860 | r14861 | |
| 78 | 78 | AM_RANGE(0xb40010, 0xb4001b) AM_WRITEONLY AM_BASE(m_scroll_bg) // Background Scrolling |
| 79 | 79 | AM_RANGE(0xb4003e, 0xb4003f) AM_WRITENOP // scr_size |
| 80 | 80 | AM_RANGE(0xb60000, 0xb6002f) AM_WRITEONLY AM_BASE(m_rotregs) // Rotation Registers |
| 81 | AM_RANGE(0xba0000, 0xba001f) AM_WRITE | |
| 81 | AM_RANGE(0xba0000, 0xba001f) AM_WRITE | |
| 82 | 82 | AM_RANGE(0xba001e, 0xba001f) AM_WRITENOP // Lev 2 irq ack |
| 83 | 83 | AM_RANGE(0xbe0002, 0xbe0003) AM_READ_PORT("PLAYERS") // Inputs |
| 84 | 84 | AM_RANGE(0xbe0004, 0xbe0005) AM_READ_LEGACY(stepstag_ip_1_word_r) // Inputs & protection |
| r14860 | r14861 | |
|---|---|---|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | #if 0 |
| 495 | WRITE16_ | |
| 495 | WRITE16_M | |
| 496 | 496 | { |
| 497 | cave_state *state = space->machine().driver_data<cave_state>(); | |
| 498 | COMBINE_DATA(&state->m_videoregs[offset]); | |
| 497 | COMBINE_DATA(&m_videoregs[offset]); | |
| 499 | 498 | |
| 500 | 499 | switch (offset) |
| 501 | 500 | { |
| r14860 | r14861 | |
|---|---|---|
| 2596 | 2596 | file = fopen(filename, "w"); |
| 2597 | 2597 | if (file) |
| 2598 | 2598 | { |
| 2599 | memory | |
| 2599 | machine.memory().dump( | |
| 2600 | 2600 | fclose(file); |
| 2601 | 2601 | } |
| 2602 | 2602 | } |
| r14860 | r14861 | |
|---|---|---|
| 112 | 112 | UINT8 devcb_stub(device_t *device, offs_t offset) |
| 113 | 113 | { |
| 114 | 114 | _Class *target = downcast<_Class *>(device); |
| 115 | return (target->*_Function)(* | |
| 115 | return (target->*_Function)(* | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | // static template for a read16 stub function that calls through a given READ16_MEMBER |
| r14860 | r14861 | |
| 120 | 120 | UINT16 devcb_stub16(device_t *device, offs_t offset) |
| 121 | 121 | { |
| 122 | 122 | _Class *target = downcast<_Class *>(device); |
| 123 | return (target->*_Function)(* | |
| 123 | return (target->*_Function)(* | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | // static template for a write_line stub function that calls through a given WRITE_LINE_MEMBER |
| r14860 | r14861 | |
| 136 | 136 | void devcb_stub(device_t *device, offs_t offset, UINT8 data) |
| 137 | 137 | { |
| 138 | 138 | _Class *target = downcast<_Class *>(device); |
| 139 | (target->*_Function)(* | |
| 139 | (target->*_Function)(* | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // static template for a write16 stub function that calls through a given WRITE16_MEMBER |
| r14860 | r14861 | |
| 144 | 144 | void devcb_stub16(device_t *device, offs_t offset, UINT16 data) |
| 145 | 145 | { |
| 146 | 146 | _Class *target = downcast<_Class *>(device); |
| 147 | (target->*_Function)(* | |
| 147 | (target->*_Function)(* | |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | #define DEVCB_NULL { DEVCB_TYPE_NULL } |
| r14860 | r14861 | |
|---|---|---|
| 143 | 143 | colortable(NULL), |
| 144 | 144 | shadow_table(NULL), |
| 145 | 145 | debug_flags(0), |
| 146 | memory_data(NULL), | |
| 147 | 146 | palette_data(NULL), |
| 148 | 147 | romload_data(NULL), |
| 149 | 148 | input_port_data(NULL), |
| r14860 | r14861 | |
| 159 | 158 | m_regionlist(m_respool), |
| 160 | 159 | m_save(*this), |
| 161 | 160 | m_scheduler(*this), |
| 161 | m_memory(NULL), | |
| 162 | 162 | m_cheat(NULL), |
| 163 | 163 | m_render(NULL), |
| 164 | 164 | m_input(NULL), |
| r14860 | r14861 | |
| 283 | 283 | // first load ROMs, then populate memory, and finally initialize CPUs |
| 284 | 284 | // these operations must proceed in this order |
| 285 | 285 | rom_init(*this); |
| 286 | memory_in | |
| 286 | m_memory = auto_alloc(*this, memory_manager(*this)); | |
| 287 | 287 | watchdog_init(*this); |
| 288 | 288 | |
| 289 | 289 | // allocate the gfx elements prior to device initialization |
| r14860 | r14861 | |
|---|---|---|
| 3090 | 3090 | |
| 3091 | 3091 | void spu_device::dma_read( UINT32 n_address, INT32 n_size ) |
| 3092 | 3092 | { |
| 3093 | UINT8 *psxram = (UINT8 *)memory | |
| 3093 | UINT8 *psxram = (UINT8 *)machine().memory(). | |
| 3094 | 3094 | |
| 3095 | 3095 | start_dma(psxram + n_address, false, n_size*4); |
| 3096 | 3096 | } |
| 3097 | 3097 | |
| 3098 | 3098 | void spu_device::dma_write( UINT32 n_address, INT32 n_size ) |
| 3099 | 3099 | { |
| 3100 | UINT8 *psxram = (UINT8 *)memory | |
| 3100 | UINT8 *psxram = (UINT8 *)machine().memory(). | |
| 3101 | 3101 | |
| 3102 | 3102 | // printf("SPU DMA write from %x, size %x\n", n_address, n_size); |
| 3103 | 3103 |
| r14860 | r14861 | |
|---|---|---|
| 183 | 183 | class debug_view_manager; |
| 184 | 184 | class osd_interface; |
| 185 | 185 | |
| 186 | typedef struct _memory_private memory_private; | |
| 187 | 186 | typedef struct _palette_private palette_private; |
| 188 | 187 | typedef struct _romload_private romload_private; |
| 189 | 188 | typedef struct _input_port_private input_port_private; |
| r14860 | r14861 | |
| 319 | 318 | resource_pool &respool() { return m_respool; } |
| 320 | 319 | device_scheduler &scheduler() { return m_scheduler; } |
| 321 | 320 | save_manager &save() { return m_save; } |
| 321 | memory_manager &memory() { assert(m_memory != NULL); return *m_memory; } | |
| 322 | 322 | cheat_manager &cheat() const { assert(m_cheat != NULL); return *m_cheat; } |
| 323 | 323 | render_manager &render() const { assert(m_render != NULL); return *m_render; } |
| 324 | 324 | input_manager &input() const { assert(m_input != NULL); return *m_input; } |
| r14860 | r14861 | |
| 407 | 407 | UINT32 debug_flags; // the current debug flags |
| 408 | 408 | |
| 409 | 409 | // internal core information |
| 410 | memory_private * memory_data; // internal data from memory.c | |
| 411 | 410 | palette_private * palette_data; // internal data from palette.c |
| 412 | 411 | romload_private * romload_data; // internal data from romload.c |
| 413 | 412 | input_port_private * input_port_data; // internal data from inptport.c |
| r14860 | r14861 | |
| 446 | 445 | device_scheduler m_scheduler; // scheduler object |
| 447 | 446 | |
| 448 | 447 | // managers |
| 448 | memory_manager * m_memory; // internal data from memory.c | |
| 449 | 449 | cheat_manager * m_cheat; // internal data from cheat.c |
| 450 | 450 | render_manager * m_render; // internal data from render.c |
| 451 | 451 | input_manager * m_input; // internal data from input.c |
| r14860 | r14861 | |
|---|---|---|
| 855 | 855 | } |
| 856 | 856 | |
| 857 | 857 | |
| 858 | //------------------------------------------------- | |
| 859 | // find_memory - find memory | |
| 860 | //------------------------------------------------- | |
| 858 | 861 | |
| 862 | void *device_t::finder_base::find_memory(UINT8 width, size_t &bytes, bool required) | |
| 863 | { | |
| 864 | memory_share *share = m_base.machine().memory().shared(m_base, m_tag); | |
| 865 | if (share == NULL) | |
| 866 | return NULL; | |
| 867 | if (share->width() != width) | |
| 868 | { | |
| 869 | if (required) | |
| 870 | mame_printf_warning("Shared ptr '%s' found but is width %d, not %d as requested\n", m_tag, share->width(), width); | |
| 871 | return NULL; | |
| 872 | } | |
| 873 | bytes = share->bytes(); | |
| 874 | return share->ptr(); | |
| 875 | } | |
| 876 | ||
| 877 | ||
| 859 | 878 | //************************************************************************** |
| 860 | 879 | // LIVE DEVICE INTERFACES |
| 861 | 880 | //************************************************************************** |
| r14860 | r14861 | |
|---|---|---|
| 302 | 302 | virtual void findit() = 0; |
| 303 | 303 | |
| 304 | 304 | protected: |
| 305 | // static helpers | |
| 306 | void *find_memory(UINT8 width, size_t &bytes, bool required); | |
| 307 | ||
| 305 | 308 | // internal state |
| 306 | 309 | finder_base *m_next; |
| 307 | 310 | device_t &m_base; |
| r14860 | r14861 | |
| 364 | 367 | { |
| 365 | 368 | public: |
| 366 | 369 | // construction/destruction |
| 367 | shared_ptr_finder(device_t &base, const char *tag) | |
| 370 | shared_ptr_finder(device_t &base, const char *tag, UINT8 width = 0) | |
| 368 | 371 | : finder_base(base, tag), |
| 369 | 372 | m_target(0), |
| 370 | 373 | m_bytes(0), |
| 371 | m_allocated(false) { } | |
| 374 | m_allocated(false), | |
| 375 | m_width((width != 0) ? width : sizeof(_PointerType) * 8) { } | |
| 372 | 376 | |
| 373 | 377 | virtual ~shared_ptr_finder() { if (m_allocated) global_free(m_target); } |
| 374 | 378 | |
| r14860 | r14861 | |
| 401 | 405 | } |
| 402 | 406 | |
| 403 | 407 | // finder |
| 404 | virtual void findit() { | |
| 408 | virtual void findit() { | |
| 405 | 409 | |
| 406 | 410 | protected: |
| 407 | 411 | // internal state |
| 408 | 412 | _PointerType *m_target; |
| 409 | 413 | size_t m_bytes; |
| 410 | 414 | bool m_allocated; |
| 415 | UINT8 m_width; | |
| 411 | 416 | }; |
| 412 | 417 | |
| 413 | 418 | // optional device finder |
| r14860 | r14861 | |
| 415 | 420 | class optional_shared_ptr : public shared_ptr_finder<_PointerType, false> |
| 416 | 421 | { |
| 417 | 422 | public: |
| 418 | optional_shared_ptr(device_t &base, const char *tag) : shared_ptr_finder<_PointerType, false>(base, tag) { } | |
| 423 | optional_shared_ptr(device_t &base, const char *tag, UINT8 width = 0) : shared_ptr_finder<_PointerType, false>(base, tag, width) { } | |
| 419 | 424 | }; |
| 420 | 425 | |
| 421 | 426 | // required devices are similar but throw an error if they are not found |
| r14860 | r14861 | |
| 423 | 428 | class required_shared_ptr : public shared_ptr_finder<_PointerType, true> |
| 424 | 429 | { |
| 425 | 430 | public: |
| 426 | required_shared_ptr(device_t &base, const char *tag) : shared_ptr_finder<_PointerType, true>(base, tag) { } | |
| 431 | required_shared_ptr(device_t &base, const char *tag, UINT8 width = 0) : shared_ptr_finder<_PointerType, true>(base, tag, width) { } | |
| 427 | 432 | }; |
| 428 | 433 | |
| 429 | 434 | // internal helpers |
| r14860 | r14861 | |
|---|---|---|
| 248 | 248 | //************************************************************************** |
| 249 | 249 | |
| 250 | 250 | |
| 251 | // ======================> memory_block | |
| 252 | ||
| 253 | // a memory block is a chunk of RAM associated with a range of memory in a device's address space | |
| 254 | class memory_block | |
| 255 | { | |
| 256 | DISABLE_COPYING(memory_block); | |
| 257 | ||
| 258 | friend class simple_list<memory_block>; | |
| 259 | friend resource_pool_object<memory_block>::~resource_pool_object(); | |
| 260 | ||
| 261 | public: | |
| 262 | // construction/destruction | |
| 263 | memory_block(address_space &space, offs_t bytestart, offs_t byteend, void *memory = NULL); | |
| 264 | ~memory_block(); | |
| 265 | ||
| 266 | // getters | |
| 267 | running_machine &machine() const { return m_machine; } | |
| 268 | memory_block *next() const { return m_next; } | |
| 269 | offs_t bytestart() const { return m_bytestart; } | |
| 270 | offs_t byteend() const { return m_byteend; } | |
| 271 | UINT8 *data() const { return m_data; } | |
| 272 | ||
| 273 | // is the given range contained by this memory block? | |
| 274 | bool contains(address_space &space, offs_t bytestart, offs_t byteend) const | |
| 275 | { | |
| 276 | return (&space == &m_space && m_bytestart <= bytestart && m_byteend >= byteend); | |
| 277 | } | |
| 278 | ||
| 279 | private: | |
| 280 | // internal state | |
| 281 | memory_block * m_next; // next memory block in the list | |
| 282 | running_machine & m_machine; // need the machine to free our memory | |
| 283 | address_space & m_space; // which address space are we associated with? | |
| 284 | offs_t m_bytestart, m_byteend; // byte-normalized start/end for verifying a match | |
| 285 | UINT8 * m_data; // pointer to the data for this block | |
| 286 | UINT8 * m_allocated; // pointer to the actually allocated block | |
| 287 | }; | |
| 288 | ||
| 289 | ||
| 290 | // ======================> memory_bank | |
| 291 | ||
| 292 | // a memory bank is a global pointer to memory that can be shared across devices and changed dynamically | |
| 293 | class memory_bank | |
| 294 | { | |
| 295 | friend class simple_list<memory_bank>; | |
| 296 | friend resource_pool_object<memory_bank>::~resource_pool_object(); | |
| 297 | ||
| 298 | // a bank reference is an entry in a list of address spaces that reference a given bank | |
| 299 | class bank_reference | |
| 300 | { | |
| 301 | friend class simple_list<bank_reference>; | |
| 302 | friend resource_pool_object<bank_reference>::~resource_pool_object(); | |
| 303 | ||
| 304 | public: | |
| 305 | // construction/destruction | |
| 306 | bank_reference(address_space &space, read_or_write readorwrite) | |
| 307 | : m_next(NULL), | |
| 308 | m_space(space), | |
| 309 | m_readorwrite(readorwrite) { } | |
| 310 | ||
| 311 | // getters | |
| 312 | bank_reference *next() const { return m_next; } | |
| 313 | address_space &space() const { return m_space; } | |
| 314 | ||
| 315 | // does this reference match the space+read/write combination? | |
| 316 | bool matches(address_space &space, read_or_write readorwrite) const | |
| 317 | { | |
| 318 | return (&space == &m_space && (readorwrite == ROW_READWRITE || readorwrite == m_readorwrite)); | |
| 319 | } | |
| 320 | ||
| 321 | private: | |
| 322 | // internal state | |
| 323 | bank_reference * m_next; // link to the next reference | |
| 324 | address_space & m_space; // address space that references us | |
| 325 | read_or_write m_readorwrite; // used for read or write? | |
| 326 | }; | |
| 327 | ||
| 328 | // a bank_entry contains a raw and decrypted pointer | |
| 329 | struct bank_entry | |
| 330 | { | |
| 331 | UINT8 * m_raw; | |
| 332 | UINT8 * m_decrypted; | |
| 333 | }; | |
| 334 | ||
| 335 | public: | |
| 336 | // construction/destruction | |
| 337 | memory_bank(address_space &space, int index, offs_t bytestart, offs_t byteend, const char *tag = NULL); | |
| 338 | ~memory_bank(); | |
| 339 | ||
| 340 | // getters | |
| 341 | memory_bank *next() const { return m_next; } | |
| 342 | running_machine &machine() const { return m_machine; } | |
| 343 | int index() const { return m_index; } | |
| 344 | int entry() const { return m_curentry; } | |
| 345 | bool anonymous() const { return m_anonymous; } | |
| 346 | offs_t bytestart() const { return m_bytestart; } | |
| 347 | void *base() const { return *m_baseptr; } | |
| 348 | void *base_decrypted() const { return *m_basedptr; } | |
| 349 | const char *tag() const { return m_tag; } | |
| 350 | const char *name() const { return m_name; } | |
| 351 | ||
| 352 | // compare a range against our range | |
| 353 | bool matches_exactly(offs_t bytestart, offs_t byteend) const { return (m_bytestart == bytestart && m_byteend == byteend); } | |
| 354 | bool fully_covers(offs_t bytestart, offs_t byteend) const { return (m_bytestart <= bytestart && m_byteend >= byteend); } | |
| 355 | bool is_covered_by(offs_t bytestart, offs_t byteend) const { return (m_bytestart >= bytestart && m_byteend <= byteend); } | |
| 356 | bool straddles(offs_t bytestart, offs_t byteend) const { return (m_bytestart < byteend && m_byteend > bytestart); } | |
| 357 | ||
| 358 | // track and verify address space references to this bank | |
| 359 | bool references_space(address_space &space, read_or_write readorwrite) const; | |
| 360 | void add_reference(address_space &space, read_or_write readorwrite); | |
| 361 | ||
| 362 | // set the base explicitly | |
| 363 | void set_base(void *base); | |
| 364 | void set_base_decrypted(void *base); | |
| 365 | ||
| 366 | // configure and set entries | |
| 367 | void configure(int entrynum, void *base); | |
| 368 | void configure_decrypted(int entrynum, void *base); | |
| 369 | void set_entry(int entrynum); | |
| 370 | ||
| 371 | private: | |
| 372 | // internal helpers | |
| 373 | void invalidate_references(); | |
| 374 | void expand_entries(int entrynum); | |
| 375 | ||
| 376 | // internal state | |
| 377 | memory_bank * m_next; // next bank in sequence | |
| 378 | running_machine & m_machine; // need the machine to free our memory | |
| 379 | UINT8 ** m_baseptr; // pointer to our base pointer in the global array | |
| 380 | UINT8 ** m_basedptr; // same for the decrypted base pointer | |
| 381 | UINT8 m_index; // array index for this handler | |
| 382 | bool m_anonymous; // are we anonymous or explicit? | |
| 383 | offs_t m_bytestart; // byte-adjusted start offset | |
| 384 | offs_t m_byteend; // byte-adjusted end offset | |
| 385 | int m_curentry; // current entry | |
| 386 | bank_entry * m_entry; // array of entries (dynamically allocated) | |
| 387 | int m_entry_count; // number of allocated entries | |
| 388 | astring m_name; // friendly name for this bank | |
| 389 | astring m_tag; // tag for this bank | |
| 390 | simple_list<bank_reference> m_reflist; // linked list of address spaces referencing this bank | |
| 391 | }; | |
| 392 | ||
| 393 | ||
| 394 | // ======================> memory_share | |
| 395 | ||
| 396 | // a memory share contains information about shared memory region | |
| 397 | class memory_share | |
| 398 | { | |
| 399 | public: | |
| 400 | // construction/destruction | |
| 401 | memory_share(size_t size, void *ptr = NULL) | |
| 402 | : m_ptr(ptr), | |
| 403 | m_size(size) { } | |
| 404 | ||
| 405 | // getters | |
| 406 | void *ptr() const { return m_ptr; } | |
| 407 | size_t size() const { return m_size; } | |
| 408 | ||
| 409 | // setters | |
| 410 | void set_ptr(void *ptr) { m_ptr = ptr; } | |
| 411 | ||
| 412 | private: | |
| 413 | // internal state | |
| 414 | void * m_ptr; // pointer to the memory backing the region | |
| 415 | size_t m_size; // size of the shared region | |
| 416 | }; | |
| 417 | ||
| 418 | ||
| 419 | 251 | // ======================> handler_entry |
| 420 | 252 | |
| 421 | 253 | // a handler entry contains information about a memory handler |
| r14860 | r14861 | |
| 1057 | 889 | |
| 1058 | 890 | public: |
| 1059 | 891 | // construction/destruction |
| 1060 | address_space_specific(device_memory_interface &memory, address_spacenum spacenum) | |
| 1061 | : address_space(memory, spacenum, _Large), | |
| 892 | address_space_specific(memory_manager &manager, device_memory_interface &memory, address_spacenum spacenum) | |
| 893 | : address_space(manager, memory, spacenum, _Large), | |
| 1062 | 894 | m_read(*this, _Large), |
| 1063 | 895 | m_write(*this, _Large) |
| 1064 | 896 | { |
| r14860 | r14861 | |
| 1667 | 1499 | typedef address_space_specific<UINT64, ENDIANNESS_BIG, true> address_space_64be_large; |
| 1668 | 1500 | |
| 1669 | 1501 | |
| 1670 | // ======================> _memory_private | |
| 1671 | 1502 | |
| 1672 | // holds internal state for the memory system | |
| 1673 | struct _memory_private | |
| 1674 | { | |
| 1675 | bool initialized; // have we completed initialization? | |
| 1676 | ||
| 1677 | UINT8 * bank_ptr[STATIC_COUNT]; // array of bank pointers | |
| 1678 | UINT8 * bankd_ptr[STATIC_COUNT]; // array of decrypted bank pointers | |
| 1679 | ||
| 1680 | simple_list<address_space> spacelist; // list of address spaces | |
| 1681 | simple_list<memory_block> blocklist; // head of the list of memory blocks | |
| 1682 | ||
| 1683 | simple_list<memory_bank> banklist; // data gathered for each bank | |
| 1684 | tagmap_t<memory_bank *> bankmap; // map for fast bank lookups | |
| 1685 | UINT8 banknext; // next bank to allocate | |
| 1686 | ||
| 1687 | tagmap_t<memory_share *> sharemap; // map for share lookups | |
| 1688 | }; | |
| 1689 | ||
| 1690 | ||
| 1691 | ||
| 1692 | 1503 | //************************************************************************** |
| 1693 | 1504 | // GLOBAL VARIABLES |
| 1694 | 1505 | //************************************************************************** |
| r14860 | r14861 | |
| 1702 | 1513 | // FUNCTION PROTOTYPES |
| 1703 | 1514 | //************************************************************************** |
| 1704 | 1515 | |
| 1705 | // banking helpers | |
| 1706 | static void bank_reattach(running_machine &machine); | |
| 1707 | ||
| 1708 | 1516 | // debugging |
| 1709 | 1517 | static void generate_memdump(running_machine &machine); |
| 1710 | 1518 | |
| r14860 | r14861 | |
| 1718 | 1526 | // memory_init - initialize the memory system |
| 1719 | 1527 | //------------------------------------------------- |
| 1720 | 1528 | |
| 1721 | void memory_init(running_machine &machine) | |
| 1529 | memory_manager::memory_manager(running_machine &machine) | |
| 1530 | : m_machine(machine), | |
| 1531 | m_initialized(false), | |
| 1532 | m_banknext(STATIC_BANK1) | |
| 1722 | 1533 | { |
| 1723 | // allocate our private data | |
| 1724 | memory_private *memdata = machine.memory_data = auto_alloc_clear(machine, memory_private); | |
| 1725 | memdata->banknext = STATIC_BANK1; | |
| 1534 | memset(m_bank_ptr, 0, sizeof(m_bank_ptr)); | |
| 1535 | memset(m_bankd_ptr, 0, sizeof(m_bankd_ptr)); | |
| 1726 | 1536 | |
| 1727 | 1537 | // loop over devices and spaces within each device |
| 1728 | 1538 | memory_interface_iterator iter(machine.root_device()); |
| r14860 | r14861 | |
| 1732 | 1542 | // if there is a configuration for this space, we need an address space |
| 1733 | 1543 | const address_space_config *spaceconfig = memory->space_config(spacenum); |
| 1734 | 1544 | if (spaceconfig != NULL) |
| 1735 | m | |
| 1545 | m_ | |
| 1736 | 1546 | } |
| 1737 | 1547 | |
| 1738 | 1548 | // construct and preprocess the address_map for each space |
| 1739 | for (address_space *space = m | |
| 1549 | for (address_space *space = m_ | |
| 1740 | 1550 | space->prepare_map(); |
| 1741 | 1551 | |
| 1742 | 1552 | // create the handlers from the resulting address maps |
| 1743 | for (address_space *space = m | |
| 1553 | for (address_space *space = m_ | |
| 1744 | 1554 | space->populate_from_map(); |
| 1745 | 1555 | |
| 1746 | 1556 | // allocate memory needed to back each address space |
| 1747 | for (address_space *space = m | |
| 1557 | for (address_space *space = m_ | |
| 1748 | 1558 | space->allocate_memory(); |
| 1749 | 1559 | |
| 1750 | 1560 | // find all the allocated pointers |
| 1751 | for (address_space *space = m | |
| 1561 | for (address_space *space = m_ | |
| 1752 | 1562 | space->locate_memory(); |
| 1753 | 1563 | |
| 1754 | 1564 | // register a callback to reset banks when reloading state |
| 1755 | machine.save().register_postload(save_prepost_delegate(FUNC(bank_reattach), | |
| 1565 | machine.save().register_postload(save_prepost_delegate(FUNC(memory_manager::bank_reattach), t | |
| 1756 | 1566 | |
| 1757 | 1567 | // dump the final memory configuration |
| 1758 | 1568 | generate_memdump(machine); |
| 1759 | 1569 | |
| 1760 | 1570 | // we are now initialized |
| 1761 | m | |
| 1571 | m_ | |
| 1762 | 1572 | } |
| 1763 | 1573 | |
| 1764 | address_space *memory_nonspecific_space(running_machine &machine) | |
| 1765 | { | |
| 1766 | memory_private *memdata = machine.memory_data; | |
| 1767 | return memdata->spacelist.first(); | |
| 1768 | } | |
| 1769 | 1574 | |
| 1770 | 1575 | |
| 1771 | ||
| 1772 | 1576 | //************************************************************************** |
| 1773 | 1577 | // MEMORY BANKING |
| 1774 | 1578 | //************************************************************************** |
| 1775 | 1579 | |
| 1776 | 1580 | //------------------------------------------------- |
| 1777 | // memory_configure_bank - configure the | |
| 1778 | // addresses for a bank | |
| 1581 | // configure_bank - configure the addresses for a | |
| 1582 | // bank | |
| 1779 | 1583 | //------------------------------------------------- |
| 1780 | 1584 | |
| 1781 | void memory_configure_bank( | |
| 1585 | void memory_manager::configure_bank( | |
| 1782 | 1586 | { |
| 1783 | | |
| 1587 | | |
| 1784 | 1588 | } |
| 1785 | 1589 | |
| 1786 | ||
| 1787 | //------------------------------------------------- | |
| 1788 | // memory_configure_bank - configure the | |
| 1789 | // addresses for a bank | |
| 1790 | //------------------------------------------------- | |
| 1791 | ||
| 1792 | void memory_configure_bank(device_t &device, const char *tag, int startentry, int numentries, void *base, offs_t stride) | |
| 1590 | void memory_manager::configure_bank(device_t &device, const char *tag, int startentry, int numentries, void *base, offs_t stride) | |
| 1793 | 1591 | { |
| 1794 | 1592 | // validation checks |
| 1795 | 1593 | astring fulltag; |
| 1796 | memory_bank *bank = | |
| 1594 | memory_bank *bank = | |
| 1797 | 1595 | if (bank == NULL) |
| 1798 | fatalerror(" | |
| 1596 | fatalerror(" | |
| 1799 | 1597 | if (base == NULL) |
| 1800 | fatalerror(" | |
| 1598 | fatalerror(" | |
| 1801 | 1599 | |
| 1802 | 1600 | // fill in the requested bank entries (backwards to improve allocation) |
| 1803 | 1601 | for (int entrynum = startentry + numentries - 1; entrynum >= startentry; entrynum--) |
| r14860 | r14861 | |
| 1806 | 1604 | |
| 1807 | 1605 | |
| 1808 | 1606 | //------------------------------------------------- |
| 1809 | // memory_configure_bank_decrypted - configure | |
| 1810 | // the decrypted addresses for a bank | |
| 1607 | // configure_bank_decrypted - configure the | |
| 1608 | // decrypted addresses for a bank | |
| 1811 | 1609 | //------------------------------------------------- |
| 1812 | 1610 | |
| 1813 | void memory_configure_bank_decrypted( | |
| 1611 | void memory_manager::configure_bank_decrypted( | |
| 1814 | 1612 | { |
| 1815 | memory_configure_bank_decrypted(machine.root_device(), tag, startentry, numentries, base, stride); | |
| 1613 | memory_configure_bank_decrypted(machine().root_device(), tag, startentry, numentries, base, stride); | |
| 1816 | 1614 | } |
| 1817 | 1615 | |
| 1818 | ||
| 1819 | //------------------------------------------------- | |
| 1820 | // memory_configure_bank_decrypted - configure | |
| 1821 | // the decrypted addresses for a bank | |
| 1822 | //------------------------------------------------- | |
| 1823 | ||
| 1824 | void memory_configure_bank_decrypted(device_t &device, const char *tag, int startentry, int numentries, void *base, offs_t stride) | |
| 1616 | void memory_manager::configure_bank_decrypted(device_t &device, const char *tag, int startentry, int numentries, void *base, offs_t stride) | |
| 1825 | 1617 | { |
| 1826 | 1618 | // validation checks |
| 1827 | 1619 | astring fulltag; |
| 1828 | memory_bank *bank = | |
| 1620 | memory_bank *bank = | |
| 1829 | 1621 | if (bank == NULL) |
| 1830 | fatalerror(" | |
| 1622 | fatalerror(" | |
| 1831 | 1623 | if (base == NULL) |
| 1832 | fatalerror(" | |
| 1624 | fatalerror(" | |
| 1833 | 1625 | |
| 1834 | 1626 | // fill in the requested bank entries (backwards to improve allocation) |
| 1835 | 1627 | for (int entrynum = startentry + numentries - 1; entrynum >= startentry; entrynum--) |
| r14860 | r14861 | |
| 1838 | 1630 | |
| 1839 | 1631 | |
| 1840 | 1632 | //------------------------------------------------- |
| 1841 | // memory_set_bank - select one pre-configured | |
| 1842 | // entry to be the new bank base | |
| 1633 | // set_bank - select one pre-configured entry to | |
| 1634 | // be the new bank base | |
| 1843 | 1635 | //------------------------------------------------- |
| 1844 | 1636 | |
| 1845 | void memory_set_bank( | |
| 1637 | void memory_manager::set_bank( | |
| 1846 | 1638 | { |
| 1847 | | |
| 1639 | | |
| 1848 | 1640 | } |
| 1849 | 1641 | |
| 1850 | ||
| 1851 | //------------------------------------------------- | |
| 1852 | // memory_set_bank - select one pre-configured | |
| 1853 | // entry to be the new bank base | |
| 1854 | //------------------------------------------------- | |
| 1855 | ||
| 1856 | void memory_set_bank(device_t &device, const char *tag, int entrynum) | |
| 1642 | void memory_manager::set_bank(device_t &device, const char *tag, int entrynum) | |
| 1857 | 1643 | { |
| 1858 | 1644 | // validation checks |
| 1859 | 1645 | astring fulltag; |
| 1860 | memory_bank *bank = | |
| 1646 | memory_bank *bank = | |
| 1861 | 1647 | if (bank == NULL) |
| 1862 | fatalerror(" | |
| 1648 | fatalerror(" | |
| 1863 | 1649 | |
| 1864 | 1650 | // set the base |
| 1865 | 1651 | bank->set_entry(entrynum); |
| r14860 | r14861 | |
| 1867 | 1653 | |
| 1868 | 1654 | |
| 1869 | 1655 | //------------------------------------------------- |
| 1870 | // memory_get_bank - return the currently | |
| 1871 | // selected bank | |
| 1656 | // get_bank - return the currently selected bank | |
| 1872 | 1657 | //------------------------------------------------- |
| 1873 | 1658 | |
| 1874 | int memory_ge | |
| 1659 | int memory_manager::bank( | |
| 1875 | 1660 | { |
| 1876 | return | |
| 1661 | return | |
| 1877 | 1662 | } |
| 1878 | 1663 | |
| 1879 | ||
| 1880 | //------------------------------------------------- | |
| 1881 | // memory_get_bank - return the currently | |
| 1882 | // selected bank | |
| 1883 | //------------------------------------------------- | |
| 1884 | ||
| 1885 | int memory_get_bank(device_t &device, const char *tag) | |
| 1664 | int memory_manager::bank(device_t &device, const char *tag) | |
| 1886 | 1665 | { |
| 1887 | 1666 | // validation checks |
| 1888 | 1667 | astring fulltag; |
| 1889 | memory_bank *bank = | |
| 1668 | memory_bank *bank = | |
| 1890 | 1669 | if (bank == NULL) |
| 1891 | fatalerror(" | |
| 1670 | fatalerror(" | |
| 1892 | 1671 | |
| 1893 | 1672 | // return the current entry |
| 1894 | 1673 | return bank->entry(); |
| r14860 | r14861 | |
| 1896 | 1675 | |
| 1897 | 1676 | |
| 1898 | 1677 | //------------------------------------------------- |
| 1899 | // | |
| 1678 | // | |
| 1900 | 1679 | //------------------------------------------------- |
| 1901 | 1680 | |
| 1902 | void memory_set_bankptr( | |
| 1681 | void memory_manager::set_bankptr( | |
| 1903 | 1682 | { |
| 1904 | | |
| 1683 | | |
| 1905 | 1684 | } |
| 1906 | 1685 | |
| 1907 | ||
| 1908 | //------------------------------------------------- | |
| 1909 | // memory_set_bankptr - set the base of a bank | |
| 1910 | //------------------------------------------------- | |
| 1911 | ||
| 1912 | void memory_set_bankptr(device_t &device, const char *tag, void *base) | |
| 1686 | void memory_manager::set_bankptr(device_t &device, const char *tag, void *base) | |
| 1913 | 1687 | { |
| 1914 | 1688 | // validation checks |
| 1915 | 1689 | astring fulltag; |
| 1916 | memory_bank *bank = | |
| 1690 | memory_bank *bank = | |
| 1917 | 1691 | if (bank == NULL) |
| 1918 | 1692 | throw emu_fatalerror("memory_set_bankptr called for unknown bank '%s'", fulltag.cstr()); |
| 1919 | 1693 | |
| r14860 | r14861 | |
| 1923 | 1697 | |
| 1924 | 1698 | |
| 1925 | 1699 | //------------------------------------------------- |
| 1926 | // memory_get_shared - get a pointer to a shared | |
| 1927 | // memory region by tag | |
| 1700 | // shared - get a pointer to a shared memory | |
| 1701 | // region by tag | |
| 1928 | 1702 | //------------------------------------------------- |
| 1929 | 1703 | |
| 1930 | ||
| 1704 | ||
| 1931 | 1705 | { |
| 1932 | size_t size; | |
| 1933 | return memory_get_shared(machine, tag, size); | |
| 1706 | return shared(machine().root_device(), tag); | |
| 1934 | 1707 | } |
| 1935 | 1708 | |
| 1936 | ||
| 1709 | memory_share *memory_manager::shared(dev | |
| 1937 | 1710 | { |
| 1938 | 1711 | astring fulltag; |
| 1939 | memory_share *share = machine.memory_data->sharemap.find(machine.root_device().subtag(fulltag, tag)); | |
| 1940 | if (share == NULL) | |
| 1941 | return NULL; | |
| 1942 | length = share->size(); | |
| 1943 | return share->ptr(); | |
| 1712 | return m_sharelist.find(device.subtag(fulltag, tag).cstr()); | |
| 1944 | 1713 | } |
| 1945 | 1714 | |
| 1946 | 1715 | |
| 1947 | 1716 | //------------------------------------------------- |
| 1948 | // memory_dump - dump the internal memory tables | |
| 1949 | // to the given file | |
| 1717 | // dump - dump the internal memory tables to the | |
| 1718 | // given file | |
| 1950 | 1719 | //------------------------------------------------- |
| 1951 | 1720 | |
| 1952 | void memory_ | |
| 1721 | void memory_ | |
| 1953 | 1722 | { |
| 1954 | 1723 | // skip if we can't open the file |
| 1955 | 1724 | if (file == NULL) |
| 1956 | 1725 | return; |
| 1957 | 1726 | |
| 1958 | 1727 | // loop over address spaces |
| 1959 | for (address_space *space = m | |
| 1728 | for (address_space *space = m | |
| 1960 | 1729 | { |
| 1961 | 1730 | fprintf(file, "\n\n" |
| 1962 | 1731 | "====================================================\n" |
| r14860 | r14861 | |
| 1984 | 1753 | FILE *file = fopen("memdump.log", "w"); |
| 1985 | 1754 | if (file) |
| 1986 | 1755 | { |
| 1987 | memory | |
| 1756 | machine.memory().dump( | |
| 1988 | 1757 | fclose(file); |
| 1989 | 1758 | } |
| 1990 | 1759 | } |
| r14860 | r14861 | |
| 1995 | 1764 | // bank_reattach - reconnect banks after a load |
| 1996 | 1765 | //------------------------------------------------- |
| 1997 | 1766 | |
| 1998 | ||
| 1767 | ||
| 1999 | 1768 | { |
| 2000 | 1769 | // for each non-anonymous bank, explicitly reset its entry |
| 2001 | for (memory_bank *bank = m | |
| 1770 | for (memory_bank *bank = m | |
| 2002 | 1771 | if (!bank->anonymous() && bank->entry() != BANK_ENTRY_UNSPECIFIED) |
| 2003 | 1772 | bank->set_entry(bank->entry()); |
| 2004 | 1773 | } |
| r14860 | r14861 | |
| 2013 | 1782 | // address_space - constructor |
| 2014 | 1783 | //------------------------------------------------- |
| 2015 | 1784 | |
| 2016 | address_space::address_space(device_memory_interface &memory, address_spacenum spacenum, bool large) | |
| 1785 | address_space::address_space(memory_manager &manager, device_memory_interface &memory, address_spacenum spacenum, bool large) | |
| 2017 | 1786 | : m_next(NULL), |
| 2018 | 1787 | m_config(*memory.space_config(spacenum)), |
| 2019 | 1788 | m_device(memory.device()), |
| r14860 | r14861 | |
| 2030 | 1799 | m_name(memory.space_config(spacenum)->name()), |
| 2031 | 1800 | m_addrchars((m_config.m_addrbus_width + 3) / 4), |
| 2032 | 1801 | m_logaddrchars((m_config.m_logaddr_width + 3) / 4), |
| 1802 | m_manager(manager), | |
| 2033 | 1803 | m_machine(memory.device().machine()) |
| 2034 | 1804 | { |
| 2035 | 1805 | // notify the device |
| r14860 | r14861 | |
| 2052 | 1822 | // allocate - static smart allocator of subtypes |
| 2053 | 1823 | //------------------------------------------------- |
| 2054 | 1824 | |
| 2055 | address_space &address_space::allocate(r | |
| 1825 | address_space &address_space::allocate(memory | |
| 2056 | 1826 | { |
| 2057 | 1827 | // allocate one of the appropriate type |
| 2058 | 1828 | bool large = (config.addr2byte_end(0xffffffffUL >> (32 - config.m_addrbus_width)) >= (1 << 18)); |
| r14860 | r14861 | |
| 2063 | 1833 | if (config.endianness() == ENDIANNESS_LITTLE) |
| 2064 | 1834 | { |
| 2065 | 1835 | if (large) |
| 2066 | return * | |
| 1836 | return *gl | |
| 2067 | 1837 | else |
| 2068 | return * | |
| 1838 | return *gl | |
| 2069 | 1839 | } |
| 2070 | 1840 | else |
| 2071 | 1841 | { |
| 2072 | 1842 | if (large) |
| 2073 | return * | |
| 1843 | return *gl | |
| 2074 | 1844 | else |
| 2075 | return * | |
| 1845 | return *gl | |
| 2076 | 1846 | } |
| 2077 | 1847 | |
| 2078 | 1848 | case 16: |
| 2079 | 1849 | if (config.endianness() == ENDIANNESS_LITTLE) |
| 2080 | 1850 | { |
| 2081 | 1851 | if (large) |
| 2082 | return * | |
| 1852 | return *gl | |
| 2083 | 1853 | else |
| 2084 | return * | |
| 1854 | return *gl | |
| 2085 | 1855 | } |
| 2086 | 1856 | else |
| 2087 | 1857 | { |
| 2088 | 1858 | if (large) |
| 2089 | return * | |
| 1859 | return *gl | |
| 2090 | 1860 | else |
| 2091 | return * | |
| 1861 | return *gl | |
| 2092 | 1862 | } |
| 2093 | 1863 | |
| 2094 | 1864 | case 32: |
| 2095 | 1865 | if (config.endianness() == ENDIANNESS_LITTLE) |
| 2096 | 1866 | { |
| 2097 | 1867 | if (large) |
| 2098 | return * | |
| 1868 | return *gl | |
| 2099 | 1869 | else |
| 2100 | return * | |
| 1870 | return *gl | |
| 2101 | 1871 | } |
| 2102 | 1872 | else |
| 2103 | 1873 | { |
| 2104 | 1874 | if (large) |
| 2105 | return * | |
| 1875 | return *gl | |
| 2106 | 1876 | else |
| 2107 | return * | |
| 1877 | return *gl | |
| 2108 | 1878 | } |
| 2109 | 1879 | |
| 2110 | 1880 | case 64: |
| 2111 | 1881 | if (config.endianness() == ENDIANNESS_LITTLE) |
| 2112 | 1882 | { |
| 2113 | 1883 | if (large) |
| 2114 | return * | |
| 1884 | return *gl | |
| 2115 | 1885 | else |
| 2116 | return * | |
| 1886 | return *gl | |
| 2117 | 1887 | } |
| 2118 | 1888 | else |
| 2119 | 1889 | { |
| 2120 | 1890 | if (large) |
| 2121 | return * | |
| 1891 | return *gl | |
| 2122 | 1892 | else |
| 2123 | return * | |
| 1893 | return *gl | |
| 2124 | 1894 | } |
| 2125 | 1895 | } |
| 2126 | 1896 | throw emu_fatalerror("Invalid width %d specified for address_space::allocate", config.data_width()); |
| r14860 | r14861 | |
| 2190 | 1960 | { |
| 2191 | 1961 | // if we can't find it, add it to our map |
| 2192 | 1962 | astring fulltag; |
| 2193 | if (ma | |
| 1963 | if (ma | |
| 2194 | 1964 | { |
| 2195 | 1965 | VPRINTF(("Creating share '%s' of length 0x%X\n", fulltag.cstr(), entry->m_byteend + 1 - entry->m_bytestart)); |
| 2196 | memory_share *share = auto_alloc(machine(), memory_share(entry->m_byteend + 1 - entry->m_bytestart)); | |
| 2197 | machine().memory_data->sharemap.add(fulltag, share, false); | |
| 1966 | memory_share *share = auto_alloc(machine(), memory_share(m_map->m_databits, entry->m_byteend + 1 - entry->m_bytestart)); | |
| 1967 | manager().m_sharelist.append(fulltag, *share); | |
| 2198 | 1968 | } |
| 2199 | 1969 | } |
| 2200 | 1970 | |
| r14860 | r14861 | |
| 2399 | 2169 | |
| 2400 | 2170 | void address_space::allocate_memory() |
| 2401 | 2171 | { |
| 2402 | simple_list<memory_block> &blocklist = ma | |
| 2172 | simple_list<memory_block> &blocklist = ma | |
| 2403 | 2173 | |
| 2404 | 2174 | // make a first pass over the memory map and track blocks with hardcoded pointers |
| 2405 | 2175 | // we do this to make sure they are found by space_find_backing_memory first |
| 2406 | 2176 | memory_block *prev_memblock_tail = blocklist.last(); |
| 2407 | 2177 | for (address_map_entry *entry = m_map->m_entrylist.first(); entry != NULL; entry = entry->next()) |
| 2408 | 2178 | if (entry->m_memory != NULL) |
| 2409 | blocklist.append(* | |
| 2179 | blocklist.append(*gl | |
| 2410 | 2180 | |
| 2411 | 2181 | // loop over all blocks just allocated and assign pointers from them |
| 2412 | 2182 | address_map_entry *unassigned = NULL; |
| r14860 | r14861 | |
| 2453 | 2223 | // we now have a block to allocate; do it |
| 2454 | 2224 | offs_t curbytestart = curblockstart * MEMORY_BLOCK_CHUNK; |
| 2455 | 2225 | offs_t curbyteend = curblockend * MEMORY_BLOCK_CHUNK + (MEMORY_BLOCK_CHUNK - 1); |
| 2456 | memory_block &block = blocklist.append(* | |
| 2226 | memory_block &block = blocklist.append(*gl | |
| 2457 | 2227 | |
| 2458 | 2228 | // assign memory that intersected the new block |
| 2459 | 2229 | unassigned = block_assign_intersecting(curbytestart, curbyteend, block.data()); |
| r14860 | r14861 | |
| 2482 | 2252 | } |
| 2483 | 2253 | |
| 2484 | 2254 | // once this is done, find the starting bases for the banks |
| 2485 | for (memory_bank *bank = ma | |
| 2255 | for (memory_bank *bank = ma | |
| 2486 | 2256 | if (bank->base() == NULL && bank->references_space(*this, ROW_READWRITE)) |
| 2487 | 2257 | { |
| 2488 | 2258 | // set the initial bank pointer |
| r14860 | r14861 | |
| 2513 | 2283 | bool found = false; |
| 2514 | 2284 | |
| 2515 | 2285 | // loop over banks looking for a match |
| 2516 | for (memory_bank *bank = ma | |
| 2286 | for (memory_bank *bank = ma | |
| 2517 | 2287 | { |
| 2518 | 2288 | // consider this bank if it is used for reading and matches the address space |
| 2519 | 2289 | if (bank->references_space(*this, ROW_READ)) |
| r14860 | r14861 | |
| 2545 | 2315 | |
| 2546 | 2316 | address_map_entry *address_space::block_assign_intersecting(offs_t bytestart, offs_t byteend, UINT8 *base) |
| 2547 | 2317 | { |
| 2548 | memory_private *memdata = machine().memory_data; | |
| 2549 | 2318 | address_map_entry *unassigned = NULL; |
| 2550 | 2319 | |
| 2551 | 2320 | // loop over the adjusted map and assign memory to any blocks we can |
| r14860 | r14861 | |
| 2555 | 2324 | if (entry->m_memory == NULL && entry->m_share != NULL) |
| 2556 | 2325 | { |
| 2557 | 2326 | astring fulltag; |
| 2558 | memory_share *share = m | |
| 2327 | memory_share *share = m | |
| 2559 | 2328 | if (share != NULL && share->ptr() != NULL) |
| 2560 | 2329 | { |
| 2561 | 2330 | entry->m_memory = share->ptr(); |
| r14860 | r14861 | |
| 2578 | 2347 | if (entry->m_memory != NULL && entry->m_share != NULL) |
| 2579 | 2348 | { |
| 2580 | 2349 | astring fulltag; |
| 2581 | memory_share *share = m | |
| 2350 | memory_share *share = m | |
| 2582 | 2351 | if (share != NULL && share->ptr() == NULL) |
| 2583 | 2352 | { |
| 2584 | 2353 | share->set_ptr(entry->m_memory); |
| r14860 | r14861 | |
| 2749 | 2518 | |
| 2750 | 2519 | void *address_space::install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read_or_write readorwrite, void *baseptr) |
| 2751 | 2520 | { |
| 2752 | memory_private *memdata = machine().memory_data; | |
| 2753 | ||
| 2754 | 2521 | VPRINTF(("address_space::install_ram_generic(%s-%s mask=%s mirror=%s, %s, %p)\n", |
| 2755 | 2522 | core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars), |
| 2756 | 2523 | core_i64_hex_format(addrmask, m_addrchars), core_i64_hex_format(addrmirror, m_addrchars), |
| r14860 | r14861 | |
| 2777 | 2544 | } |
| 2778 | 2545 | |
| 2779 | 2546 | // if we still don't have a pointer, and we're past the initialization phase, allocate a new block |
| 2780 | if (bank.base() == NULL && m | |
| 2547 | if (bank.base() == NULL && m | |
| 2781 | 2548 | { |
| 2782 | 2549 | if (machine().phase() >= MACHINE_PHASE_RESET) |
| 2783 | 2550 | fatalerror("Attempted to call install_ram_generic() after initialization time without a baseptr!"); |
| 2784 | memory_block &block = m | |
| 2551 | memory_block &block = m | |
| 2785 | 2552 | bank.set_base(block.data()); |
| 2786 | 2553 | } |
| 2787 | 2554 | } |
| r14860 | r14861 | |
| 2806 | 2573 | } |
| 2807 | 2574 | |
| 2808 | 2575 | // if we still don't have a pointer, and we're past the initialization phase, allocate a new block |
| 2809 | if (bank.base() == NULL && m | |
| 2576 | if (bank.base() == NULL && m | |
| 2810 | 2577 | { |
| 2811 | 2578 | if (machine().phase() >= MACHINE_PHASE_RESET) |
| 2812 | 2579 | fatalerror("Attempted to call install_ram_generic() after initialization time without a baseptr!"); |
| 2813 | memory_block &block = m | |
| 2580 | memory_block &block = m | |
| 2814 | 2581 | bank.set_base(block.data()); |
| 2815 | 2582 | } |
| 2816 | 2583 | } |
| r14860 | r14861 | |
| 3199 | 2966 | } |
| 3200 | 2967 | |
| 3201 | 2968 | // if not found there, look in the allocated blocks |
| 3202 | for (memory_block *block = ma | |
| 2969 | for (memory_block *block = ma | |
| 3203 | 2970 | if (block->contains(*this, bytestart, byteend)) |
| 3204 | 2971 | { |
| 3205 | 2972 | VPRINTF(("found in allocated memory block %08X-%08X [%p]\n", block->bytestart(), block->byteend(), block->data() + (bytestart - block->bytestart()))); |
| r14860 | r14861 | |
| 3227 | 2994 | if (entry->m_share != NULL) |
| 3228 | 2995 | { |
| 3229 | 2996 | astring fulltag; |
| 3230 | memory_share *share = ma | |
| 2997 | memory_share *share = ma | |
| 3231 | 2998 | if (share != NULL && share->ptr() == NULL) |
| 3232 | 2999 | return true; |
| 3233 | 3000 | } |
| r14860 | r14861 | |
| 3260 | 3027 | |
| 3261 | 3028 | memory_bank &address_space::bank_find_or_allocate(const char *tag, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read_or_write readorwrite) |
| 3262 | 3029 | { |
| 3263 | memory_private *memdata = machine().memory_data; | |
| 3264 | ||
| 3265 | 3030 | // adjust the addresses, handling mirrors and such |
| 3266 | 3031 | offs_t bytemirror = addrmirror; |
| 3267 | 3032 | offs_t bytestart = addrstart; |
| r14860 | r14861 | |
| 3272 | 3037 | // if this bank is named, look it up |
| 3273 | 3038 | memory_bank *bank = NULL; |
| 3274 | 3039 | if (tag != NULL) |
| 3275 | bank = m | |
| 3040 | bank = m | |
| 3276 | 3041 | |
| 3277 | 3042 | // else try to find an exact match |
| 3278 | 3043 | else |
| 3279 | for (bank = m | |
| 3044 | for (bank = m | |
| 3280 | 3045 | if (bank->anonymous() && bank->references_space(*this, ROW_READWRITE) && bank->matches_exactly(bytestart, byteend)) |
| 3281 | 3046 | break; |
| 3282 | 3047 | |
| r14860 | r14861 | |
| 3284 | 3049 | if (bank == NULL) |
| 3285 | 3050 | { |
| 3286 | 3051 | // handle failure |
| 3287 | int banknum = m | |
| 3052 | int banknum = m | |
| 3288 | 3053 | if (banknum > STATIC_BANKMAX) |
| 3289 | 3054 | { |
| 3290 | 3055 | if (tag != NULL) |
| r14860 | r14861 | |
| 3294 | 3059 | } |
| 3295 | 3060 | |
| 3296 | 3061 | // allocate the bank |
| 3297 | bank = auto_alloc(machine(), memory_bank(*this, banknum, bytestart, byteend, tag)); | |
| 3298 | memdata->banklist.append(*bank); | |
| 3062 | bank = global_alloc(memory_bank(*this, banknum, bytestart, byteend, tag)); | |
| 3063 | manager().m_banklist.append(*bank); | |
| 3299 | 3064 | |
| 3300 | 3065 | // for named banks, add to the map and register for save states |
| 3301 | 3066 | if (tag != NULL) |
| 3302 | m | |
| 3067 | m | |
| 3303 | 3068 | } |
| 3304 | 3069 | |
| 3305 | 3070 | // add a reference for this space |
| r14860 | r14861 | |
| 4145 | 3910 | |
| 4146 | 3911 | // banks have names |
| 4147 | 3912 | if (entry >= STATIC_BANK1 && entry <= STATIC_BANKMAX) |
| 4148 | for (memory_bank *info = m_space.ma | |
| 3913 | for (memory_bank *info = m_space.ma | |
| 4149 | 3914 | if (info->index() == entry) |
| 4150 | 3915 | return info->name(); |
| 4151 | 3916 | |
| r14860 | r14861 | |
| 4173 | 3938 | // allocate handlers for each entry, prepopulating the bankptrs for banks |
| 4174 | 3939 | for (int entrynum = 0; entrynum < ARRAY_LENGTH(m_handlers); entrynum++) |
| 4175 | 3940 | { |
| 4176 | UINT8 **bankptr = (entrynum >= STATIC_BANK1 && entrynum <= STATIC_BANKMAX) ? | |
| 3941 | UINT8 **bankptr = (entrynum >= STATIC_BANK1 && entrynum <= STATIC_BANKMAX) ? | |
| 4177 | 3942 | m_handlers[entrynum] = auto_alloc(space.machine(), handler_entry_read(space.data_width(), space.endianness(), bankptr)); |
| 4178 | 3943 | } |
| 4179 | 3944 | |
| r14860 | r14861 | |
| 4249 | 4014 | // allocate handlers for each entry, prepopulating the bankptrs for banks |
| 4250 | 4015 | for (int entrynum = 0; entrynum < ARRAY_LENGTH(m_handlers); entrynum++) |
| 4251 | 4016 | { |
| 4252 | UINT8 **bankptr = (entrynum >= STATIC_BANK1 && entrynum <= STATIC_BANKMAX) ? | |
| 4017 | UINT8 **bankptr = (entrynum >= STATIC_BANK1 && entrynum <= STATIC_BANKMAX) ? | |
| 4253 | 4018 | m_handlers[entrynum] = auto_alloc(space.machine(), handler_entry_write(space.data_width(), space.endianness(), bankptr)); |
| 4254 | 4019 | } |
| 4255 | 4020 | |
| r14860 | r14861 | |
| 4379 | 4144 | } |
| 4380 | 4145 | |
| 4381 | 4146 | // if no decrypted opcodes, point to the same base |
| 4382 | UINT8 *base = m_space.machine().memory_data->bank_ptr[m_entry]; | |
| 4383 | UINT8 *based = m_space.machine().memory_data->bankd_ptr[m_entry]; | |
| 4147 | UINT8 *base = *m_space.manager().bank_pointer_addr(m_entry, false); | |
| 4148 | UINT8 *based = *m_space.manager().bank_pointer_addr(m_entry, true); | |
| 4384 | 4149 | if (based == NULL) |
| 4385 | 4150 | based = base; |
| 4386 | 4151 | |
| r14860 | r14861 | |
| 4559 | 4324 | memory_bank::memory_bank(address_space &space, int index, offs_t bytestart, offs_t byteend, const char *tag) |
| 4560 | 4325 | : m_next(NULL), |
| 4561 | 4326 | m_machine(space.machine()), |
| 4562 | m_baseptr(&space.machine().memory_data->bank_ptr[index]), | |
| 4563 | m_basedptr(&space.machine().memory_data->bankd_ptr[index]), | |
| 4327 | m_baseptr(space.manager().bank_pointer_addr(index, false)), | |
| 4328 | m_basedptr(space.manager().bank_pointer_addr(index, true)), | |
| 4564 | 4329 | m_index(index), |
| 4565 | 4330 | m_anonymous(tag == NULL), |
| 4566 | 4331 | m_bytestart(bytestart), |
| r14860 | r14861 | |
| 4621 | 4386 | // if we already have a reference, skip it |
| 4622 | 4387 | if (references_space(space, readorwrite)) |
| 4623 | 4388 | return; |
| 4624 | m_reflist.append(* | |
| 4389 | m_reflist.append(*gl | |
| 4625 | 4390 | } |
| 4626 | 4391 | |
| 4627 | 4392 | |
| r14860 | r14861 | |
| 5888 | 5653 | { |
| 5889 | 5654 | m_legacy_info.handler.space64(m_legacy_info.object.space, offset, data, mask); |
| 5890 | 5655 | } |
| 5656 | ||
| 5657 | ||
| 5658 | ||
| 5659 | // configure the addresses for a bank | |
| 5660 | void memory_configure_bank(running_machine &machine, const char *tag, int startentry, int numentries, void *base, offs_t stride) { machine.memory().configure_bank(tag, startentry, numentries, base, stride); } | |
| 5661 | void memory_configure_bank(device_t &device, const char *tag, int startentry, int numentries, void *base, offs_t stride) { device.machine().memory().configure_bank(device, tag, startentry, numentries, base, stride); } | |
| 5662 | ||
| 5663 | // configure the decrypted addresses for a bank | |
| 5664 | void memory_configure_bank_decrypted(running_machine &machine, const char *tag, int startentry, int numentries, void *base, offs_t stride) { machine.memory().configure_bank_decrypted(tag, startentry, numentries, base, stride); } | |
| 5665 | void memory_configure_bank_decrypted(device_t &device, const char *tag, int startentry, int numentries, void *base, offs_t stride) { device.machine().memory().configure_bank_decrypted(device, tag, startentry, numentries, base, stride); } | |
| 5666 | ||
| 5667 | // select one pre-configured entry to be the new bank base | |
| 5668 | void memory_set_bank(running_machine &machine, const char *tag, int entrynum) { machine.memory().set_bank(tag, entrynum); } | |
| 5669 | void memory_set_bank(device_t &device, const char *tag, int entrynum) { device.machine().memory().set_bank(device, tag, entrynum); } | |
| 5670 | ||
| 5671 | // set the absolute address of a bank base | |
| 5672 | void memory_set_bankptr(running_machine &machine, const char *tag, void *base) { machine.memory().set_bankptr(tag, base); } | |
| 5673 | void memory_set_bankptr(device_t &device, const char *tag, void *base) { device.machine().memory().set_bankptr(device, tag, base); } |
| r14860 | r14861 | |
|---|---|---|
| 90 | 90 | // forward declarations of classes defined here |
| 91 | 91 | class address_map; |
| 92 | 92 | class address_map_entry; |
| 93 | class memory_manager; | |
| 93 | 94 | class memory_bank; |
| 95 | class memory_block; | |
| 96 | class memory_share; | |
| 94 | 97 | class direct_read_data; |
| 95 | 98 | class address_space; |
| 96 | 99 | class address_table; |
| r14860 | r14861 | |
| 302 | 305 | |
| 303 | 306 | protected: |
| 304 | 307 | // construction/destruction |
| 305 | address_space(device_memory_interface &memory, address_spacenum spacenum, bool large); | |
| 308 | address_space(memory_manager &manager, device_memory_interface &memory, address_spacenum spacenum, bool large); | |
| 306 | 309 | virtual ~address_space(); |
| 307 | 310 | |
| 308 | 311 | public: |
| 309 | 312 | // public allocator |
| 310 | static address_space &allocate(r | |
| 313 | static address_space &allocate(memory | |
| 311 | 314 | |
| 312 | 315 | // getters |
| 313 | 316 | address_space *next() const { return m_next; } |
| 317 | memory_manager &manager() const { return m_manager; } | |
| 314 | 318 | device_t &device() const { return m_device; } |
| 315 | 319 | running_machine &machine() const { return m_machine; } |
| 316 | 320 | const char *name() const { return m_name; } |
| r14860 | r14861 | |
| 554 | 558 | UINT8 m_logaddrchars; // number of characters to use for logical addresses |
| 555 | 559 | |
| 556 | 560 | private: |
| 561 | memory_manager & m_manager; // reference to the owning manager | |
| 557 | 562 | running_machine & m_machine; // reference to the owning machine |
| 558 | 563 | }; |
| 559 | 564 | |
| 560 | 565 | |
| 566 | // ======================> memory_block | |
| 561 | 567 | |
| 568 | // a memory block is a chunk of RAM associated with a range of memory in a device's address space | |
| 569 | class memory_block | |
| 570 | { | |
| 571 | DISABLE_COPYING(memory_block); | |
| 572 | ||
| 573 | friend class simple_list<memory_block>; | |
| 574 | friend resource_pool_object<memory_block>::~resource_pool_object(); | |
| 575 | ||
| 576 | public: | |
| 577 | // construction/destruction | |
| 578 | memory_block(address_space &space, offs_t bytestart, offs_t byteend, void *memory = NULL); | |
| 579 | ~memory_block(); | |
| 580 | ||
| 581 | // getters | |
| 582 | running_machine &machine() const { return m_machine; } | |
| 583 | memory_block *next() const { return m_next; } | |
| 584 | offs_t bytestart() const { return m_bytestart; } | |
| 585 | offs_t byteend() const { return m_byteend; } | |
| 586 | UINT8 *data() const { return m_data; } | |
| 587 | ||
| 588 | // is the given range contained by this memory block? | |
| 589 | bool contains(address_space &space, offs_t bytestart, offs_t byteend) const | |
| 590 | { | |
| 591 | return (&space == &m_space && m_bytestart <= bytestart && m_byteend >= byteend); | |
| 592 | } | |
| 593 | ||
| 594 | private: | |
| 595 | // internal state | |
| 596 | memory_block * m_next; // next memory block in the list | |
| 597 | running_machine & m_machine; // need the machine to free our memory | |
| 598 | address_space & m_space; // which address space are we associated with? | |
| 599 | offs_t m_bytestart, m_byteend; // byte-normalized start/end for verifying a match | |
| 600 | UINT8 * m_data; // pointer to the data for this block | |
| 601 | UINT8 * m_allocated; // pointer to the actually allocated block | |
| 602 | }; | |
| 603 | ||
| 604 | ||
| 605 | // ======================> memory_bank | |
| 606 | ||
| 607 | // a memory bank is a global pointer to memory that can be shared across devices and changed dynamically | |
| 608 | class memory_bank | |
| 609 | { | |
| 610 | friend class simple_list<memory_bank>; | |
| 611 | friend resource_pool_object<memory_bank>::~resource_pool_object(); | |
| 612 | ||
| 613 | // a bank reference is an entry in a list of address spaces that reference a given bank | |
| 614 | class bank_reference | |
| 615 | { | |
| 616 | friend class simple_list<bank_reference>; | |
| 617 | friend resource_pool_object<bank_reference>::~resource_pool_object(); | |
| 618 | ||
| 619 | public: | |
| 620 | // construction/destruction | |
| 621 | bank_reference(address_space &space, read_or_write readorwrite) | |
| 622 | : m_next(NULL), | |
| 623 | m_space(space), | |
| 624 | m_readorwrite(readorwrite) { } | |
| 625 | ||
| 626 | // getters | |
| 627 | bank_reference *next() const { return m_next; } | |
| 628 | address_space &space() const { return m_space; } | |
| 629 | ||
| 630 | // does this reference match the space+read/write combination? | |
| 631 | bool matches(address_space &space, read_or_write readorwrite) const | |
| 632 | { | |
| 633 | return (&space == &m_space && (readorwrite == ROW_READWRITE || readorwrite == m_readorwrite)); | |
| 634 | } | |
| 635 | ||
| 636 | private: | |
| 637 | // internal state | |
| 638 | bank_reference * m_next; // link to the next reference | |
| 639 | address_space & m_space; // address space that references us | |
| 640 | read_or_write m_readorwrite; // used for read or write? | |
| 641 | }; | |
| 642 | ||
| 643 | // a bank_entry contains a raw and decrypted pointer | |
| 644 | struct bank_entry | |
| 645 | { | |
| 646 | UINT8 * m_raw; | |
| 647 | UINT8 * m_decrypted; | |
| 648 | }; | |
| 649 | ||
| 650 | public: | |
| 651 | // construction/destruction | |
| 652 | memory_bank(address_space &space, int index, offs_t bytestart, offs_t byteend, const char *tag = NULL); | |
| 653 | ~memory_bank(); | |
| 654 | ||
| 655 | // getters | |
| 656 | memory_bank *next() const { return m_next; } | |
| 657 | running_machine &machine() const { return m_machine; } | |
| 658 | int index() const { return m_index; } | |
| 659 | int entry() const { return m_curentry; } | |
| 660 | bool anonymous() const { return m_anonymous; } | |
| 661 | offs_t bytestart() const { return m_bytestart; } | |
| 662 | void *base() const { return *m_baseptr; } | |
| 663 | void *base_decrypted() const { return *m_basedptr; } | |
| 664 | const char *tag() const { return m_tag; } | |
| 665 | const char *name() const { return m_name; } | |
| 666 | ||
| 667 | // compare a range against our range | |
| 668 | bool matches_exactly(offs_t bytestart, offs_t byteend) const { return (m_bytestart == bytestart && m_byteend == byteend); } | |
| 669 | bool fully_covers(offs_t bytestart, offs_t byteend) const { return (m_bytestart <= bytestart && m_byteend >= byteend); } | |
| 670 | bool is_covered_by(offs_t bytestart, offs_t byteend) const { return (m_bytestart >= bytestart && m_byteend <= byteend); } | |
| 671 | bool straddles(offs_t bytestart, offs_t byteend) const { return (m_bytestart < byteend && m_byteend > bytestart); } | |
| 672 | ||
| 673 | // track and verify address space references to this bank | |
| 674 | bool references_space(address_space &space, read_or_write readorwrite) const; | |
| 675 | void add_reference(address_space &space, read_or_write readorwrite); | |
| 676 | ||
| 677 | // set the base explicitly | |
| 678 | void set_base(void *base); | |
| 679 | void set_base_decrypted(void *base); | |
| 680 | ||
| 681 | // configure and set entries | |
| 682 | void configure(int entrynum, void *base); | |
| 683 | void configure_decrypted(int entrynum, void *base); | |
| 684 | void set_entry(int entrynum); | |
| 685 | ||
| 686 | private: | |
| 687 | // internal helpers | |
| 688 | void invalidate_references(); | |
| 689 | void expand_entries(int entrynum); | |
| 690 | ||
| 691 | // internal state | |
| 692 | memory_bank * m_next; // next bank in sequence | |
| 693 | running_machine & m_machine; // need the machine to free our memory | |
| 694 | UINT8 ** m_baseptr; // pointer to our base pointer in the global array | |
| 695 | UINT8 ** m_basedptr; // same for the decrypted base pointer | |
| 696 | UINT8 m_index; // array index for this handler | |
| 697 | bool m_anonymous; // are we anonymous or explicit? | |
| 698 | offs_t m_bytestart; // byte-adjusted start offset | |
| 699 | offs_t m_byteend; // byte-adjusted end offset | |
| 700 | int m_curentry; // current entry | |
| 701 | bank_entry * m_entry; // array of entries (dynamically allocated) | |
| 702 | int m_entry_count; // number of allocated entries | |
| 703 | astring m_name; // friendly name for this bank | |
| 704 | astring m_tag; // tag for this bank | |
| 705 | simple_list<bank_reference> m_reflist; // linked list of address spaces referencing this bank | |
| 706 | }; | |
| 707 | ||
| 708 | ||
| 709 | // ======================> memory_share | |
| 710 | ||
| 711 | // a memory share contains information about shared memory region | |
| 712 | class memory_share | |
| 713 | { | |
| 714 | friend class simple_list<memory_share>; | |
| 715 | ||
| 716 | public: | |
| 717 | // construction/destruction | |
| 718 | memory_share(UINT8 width, size_t bytes, void *ptr = NULL) | |
| 719 | : m_ptr(ptr), | |
| 720 | m_bytes(bytes), | |
| 721 | m_width(width) { } | |
| 722 | ||
| 723 | // getters | |
| 724 | memory_share *next() const { return m_next; } | |
| 725 | void *ptr() const { return m_ptr; } | |
| 726 | size_t bytes() const { return m_bytes; } | |
| 727 | UINT8 width() const { return m_width; } | |
| 728 | ||
| 729 | // setters | |
| 730 | void set_ptr(void *ptr) { m_ptr = ptr; } | |
| 731 | ||
| 732 | private: | |
| 733 | // internal state | |
| 734 | memory_share * m_next; // next share in the list | |
| 735 | void * m_ptr; // pointer to the memory backing the region | |
| 736 | size_t m_bytes; // size of the shared region in bytes | |
| 737 | UINT8 m_width; // width of the shared region | |
| 738 | }; | |
| 739 | ||
| 740 | ||
| 741 | // ======================> memory_manager | |
| 742 | ||
| 743 | // holds internal state for the memory system | |
| 744 | class memory_manager | |
| 745 | { | |
| 746 | friend class address_space; | |
| 747 | ||
| 748 | public: | |
| 749 | // construction/destruction | |
| 750 | memory_manager(running_machine &machine); | |
| 751 | ||
| 752 | // getters | |
| 753 | running_machine &machine() const { return m_machine; } | |
| 754 | address_space *first_space() const { return m_spacelist.first(); } | |
| 755 | memory_bank *first_bank() const { return m_banklist.first(); } | |
| 756 | ||
| 757 | // configure the addresses for a bank | |
| 758 | void configure_bank(const char *tag, int startentry, int numentries, void *base, offs_t stride); | |
| 759 | void configure_bank(device_t &device, const char *tag, int startentry, int numentries, void *base, offs_t stride); | |
| 760 | ||
| 761 | // configure the decrypted addresses for a bank | |
| 762 | void configure_bank_decrypted(const char *tag, int startentry, int numentries, void *base, offs_t stride); | |
| 763 | void configure_bank_decrypted(device_t &device, const char *tag, int startentry, int numentries, void *base, offs_t stride); | |
| 764 | ||
| 765 | // select one pre-configured entry to be the new bank base | |
| 766 | void set_bank(const char *tag, int entrynum); | |
| 767 | void set_bank(device_t &device, const char *tag, int entrynum); | |
| 768 | ||
| 769 | // return the currently selected bank | |
| 770 | int bank(const char *tag); | |
| 771 | int bank(device_t &device, const char *tag); | |
| 772 | ||
| 773 | // set the absolute address of a bank base | |
| 774 | void set_bankptr(const char *tag, void *base) ATTR_NONNULL(3); | |
| 775 | void set_bankptr(device_t &device, const char *tag, void *base) ATTR_NONNULL(3); | |
| 776 | ||
| 777 | // get a pointer to a shared memory region by tag | |
| 778 | memory_share *shared(const char *tag); | |
| 779 | memory_share *shared(device_t &device, const char *tag); | |
| 780 | ||
| 781 | // dump the internal memory tables to the given file | |
| 782 | void dump(FILE *file); | |
| 783 | ||
| 784 | // pointers to a bank pointer (internal usage only) | |
| 785 | UINT8 **bank_pointer_addr(UINT8 index, bool decrypted = false) { return decrypted ? &m_bankd_ptr[index] : &m_bank_ptr[index]; } | |
| 786 | ||
| 787 | private: | |
| 788 | // internal helpers | |
| 789 | void bank_reattach(); | |
| 790 | ||
| 791 | // internal state | |
| 792 | running_machine & m_machine; // reference to the machine | |
| 793 | bool m_initialized; // have we completed initialization? | |
| 794 | ||
| 795 | UINT8 * m_bank_ptr[256]; // array of bank pointers | |
| 796 | UINT8 * m_bankd_ptr[256]; // array of decrypted bank pointers | |
| 797 | ||
| 798 | simple_list<address_space> m_spacelist; // list of address spaces | |
| 799 | simple_list<memory_block> m_blocklist; // head of the list of memory blocks | |
| 800 | ||
| 801 | simple_list<memory_bank> m_banklist; // data gathered for each bank | |
| 802 | tagmap_t<memory_bank *> m_bankmap; // map for fast bank lookups | |
| 803 | UINT8 m_banknext; // next bank to allocate | |
| 804 | ||
| 805 | tagged_list<memory_share> m_sharelist; // map for share lookups | |
| 806 | }; | |
| 807 | ||
| 808 | ||
| 809 | ||
| 562 | 810 | //************************************************************************** |
| 563 | 811 | // MACROS |
| 564 | 812 | //************************************************************************** |
| r14860 | r14861 | |
| 671 | 919 | // FUNCTION PROTOTYPES FOR CORE MEMORY FUNCTIONS |
| 672 | 920 | //************************************************************************** |
| 673 | 921 | |
| 674 | // initialize the memory system | |
| 675 | void memory_init(running_machine &machine); | |
| 676 | ||
| 677 | 922 | // configure the addresses for a bank |
| 678 | 923 | void memory_configure_bank(running_machine &machine, const char *tag, int startentry, int numentries, void *base, offs_t stride) ATTR_NONNULL(5); |
| 679 | 924 | void memory_configure_bank(device_t &device, const char *tag, int startentry, int numentries, void *base, offs_t stride) ATTR_NONNULL(5); |
| r14860 | r14861 | |
| 686 | 931 | void memory_set_bank(running_machine &machine, const char *tag, int entrynum); |
| 687 | 932 | void memory_set_bank(device_t &device, const char *tag, int entrynum); |
| 688 | 933 | |
| 689 | // return the currently selected bank | |
| 690 | int memory_get_bank(running_machine &machine, const char *tag); | |
| 691 | int memory_get_bank(device_t &device, const char *tag); | |
| 692 | ||
| 693 | 934 | // set the absolute address of a bank base |
| 694 | 935 | void memory_set_bankptr(running_machine &machine, const char *tag, void *base) ATTR_NONNULL(3); |
| 695 | 936 | void memory_set_bankptr(device_t &device, const char *tag, void *base) ATTR_NONNULL(3); |
| 696 | 937 | |
| 697 | // get a pointer to a shared memory region by tag | |
| 698 | void *memory_get_shared(running_machine &machine, const char *tag); | |
| 699 | void *memory_get_shared(running_machine &machine, const char *tag, size_t &length); | |
| 700 | 938 | |
| 701 | // dump the internal memory tables to the given file | |
| 702 | void memory_dump(running_machine &machine, FILE *file); | |
| 703 | 939 | |
| 704 | address_space *memory_nonspecific_space(running_machine &machine); | |
| 705 | ||
| 706 | ||
| 707 | 940 | //************************************************************************** |
| 708 | 941 | // INLINE FUNCTIONS |
| 709 | 942 | //************************************************************************** |
| r14860 | r14861 | |
| 808 | 1041 | return m_space.read_qword(byteaddress); |
| 809 | 1042 | } |
| 810 | 1043 | |
| 811 | ||
| 812 | 1044 | #endif /* __MEMORY_H__ */ |
| r14860 | r14861 | |
|---|---|---|
| 94 | 94 | void set_port_a_z_mask(UINT8 data) { m_port_a_z_mask = data; }// see second note in .c |
| 95 | 95 | |
| 96 | 96 | DECLARE_READ8_MEMBER( porta_r ); |
| 97 | UINT8 porta_r() { return porta_r(*memory | |
| 97 | UINT8 porta_r() { return porta_r(*machine().memory(). | |
| 98 | 98 | DECLARE_WRITE8_MEMBER( porta_w ); |
| 99 | void porta_w(UINT8 data) { porta_w(*memory | |
| 99 | void porta_w(UINT8 data) { porta_w(*machine().memory(). | |
| 100 | 100 | void set_a_input(UINT8 data, UINT8 z_mask); |
| 101 | 101 | UINT8 a_output(); |
| 102 | 102 | |
| r14860 | r14861 | |
| 109 | 109 | int ca2_output_z(); |
| 110 | 110 | |
| 111 | 111 | DECLARE_READ8_MEMBER( portb_r ); |
| 112 | UINT8 portb_r() { return portb_r(*memory | |
| 112 | UINT8 portb_r() { return portb_r(*machine().memory(). | |
| 113 | 113 | DECLARE_WRITE8_MEMBER( portb_w ); |
| 114 | void portb_w(UINT8 data) { portb_w(*memory | |
| 114 | void portb_w(UINT8 data) { portb_w(*machine().memory(). | |
| 115 | 115 | UINT8 b_output(); |
| 116 | 116 | |
| 117 | 117 | DECLARE_READ_LINE_MEMBER( cb1_r ); |
| r14860 | r14861 | |
|---|---|---|
| 61 | 61 | int ext_clock(int counter) const { return m_external_clock[counter]; } // get clock frequency |
| 62 | 62 | |
| 63 | 63 | DECLARE_WRITE8_MEMBER( write ); |
| 64 | void write(offs_t offset, UINT8 data) { write(*memory | |
| 64 | void write(offs_t offset, UINT8 data) { write(*machine().memory(). | |
| 65 | 65 | DECLARE_READ8_MEMBER( read ); |
| 66 | UINT8 read(offs_t offset) { return read(*memory | |
| 66 | UINT8 read(offs_t offset) { return read(*machine().memory(). | |
| 67 | 67 | |
| 68 | 68 | void set_gate(int idx, int state); |
| 69 | 69 | DECLARE_WRITE_LINE_MEMBER( set_g1 ); |
| r14860 | r14861 | |
|---|---|---|
| 187 | 187 | // find our shared pointer with the target RAM |
| 188 | 188 | if (m_base == NULL) |
| 189 | 189 | { |
| 190 | m_base = memory_get_shared(machine(), tag(), m_length); | |
| 191 | if (m_base == NULL) | |
| 190 | memory_share *share = machine().memory().shared(*owner(), tag()); | |
| 191 | if (share == NULL) | |
| 192 | 192 | throw emu_fatalerror("NVRAM device '%s' has no corresponding AM_SHARE region", tag()); |
| 193 | m_base = share->ptr(); | |
| 194 | m_length = share->bytes(); | |
| 193 | 195 | } |
| 194 | 196 | |
| 195 | 197 | // if we are region-backed for the default, find it now and make sure it's the right size |
| r14860 | r14861 | |
|---|---|---|
| 343 | 343 | void microtouch_serial_device::rcv_complete() |
| 344 | 344 | { |
| 345 | 345 | receive_register_extract(); |
| 346 | microtouch_device::rx(*memory | |
| 346 | microtouch_device::rx(*machine().memory(). | |
| 347 | 347 | } |
| r14860 | r14861 | |
|---|---|---|
| 415 | 415 | break; |
| 416 | 416 | |
| 417 | 417 | case 1: |
| 418 | data = m_ace1->ins8250_r(*memory | |
| 418 | data = m_ace1->ins8250_r(*machine().memory(). | |
| 419 | 419 | break; |
| 420 | 420 | |
| 421 | 421 | case 2: |
| 422 | data = m_ace2->ins8250_r(*memory | |
| 422 | data = m_ace2->ins8250_r(*machine().memory(). | |
| 423 | 423 | break; |
| 424 | 424 | |
| 425 | 425 | case 3: |
| 426 | data = m_ace3->ins8250_r(*memory | |
| 426 | data = m_ace3->ins8250_r(*machine().memory(). | |
| 427 | 427 | break; |
| 428 | 428 | } |
| 429 | 429 | } |
| r14860 | r14861 | |
| 538 | 538 | break; |
| 539 | 539 | |
| 540 | 540 | case 1: |
| 541 | m_ace1->ins8250_w(*memory | |
| 541 | m_ace1->ins8250_w(*machine().memory(). | |
| 542 | 542 | break; |
| 543 | 543 | |
| 544 | 544 | case 2: |
| 545 | m_ace2->ins8250_w(*memory | |
| 545 | m_ace2->ins8250_w(*machine().memory(). | |
| 546 | 546 | break; |
| 547 | 547 | |
| 548 | 548 | case 3: |
| 549 | m_ace3->ins8250_w(*memory | |
| 549 | m_ace3->ins8250_w(*machine().memory(). | |
| 550 | 550 | break; |
| 551 | 551 | } |
| 552 | 552 | } |
| r14860 | r14861 | |
|---|---|---|
| 164 | 164 | { |
| 165 | 165 | pc_lpt_state *lpt = get_safe_token(device); |
| 166 | 166 | // pull up mechanism for input lines, zeros are provided by pheripherial |
| 167 | return lpt->data & ~lpt->centronics->read(* | |
| 167 | return lpt->data & ~lpt->centronics->read(* | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | |
| r14860 | r14861 | |
| 172 | 172 | { |
| 173 | 173 | pc_lpt_state *lpt = get_safe_token(device); |
| 174 | 174 | lpt->data = data; |
| 175 | lpt->centronics->write(* | |
| 175 | lpt->centronics->write(* | |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 |
| r14860 | r14861 | |
|---|---|---|
| 136 | 136 | case 0: /* RTC RAM */ |
| 137 | 137 | if (addr & 0x80) |
| 138 | 138 | /* RTC RAM page register */ |
| 139 | reply = m_rtc->xram_r(*memory | |
| 139 | reply = m_rtc->xram_r(*machine().memory(). | |
| 140 | 140 | else |
| 141 | 141 | /* RTC RAM read */ |
| 142 | reply = m_rtc->xram_r(*memory | |
| 142 | reply = m_rtc->xram_r(*machine().memory(). | |
| 143 | 143 | break; |
| 144 | 144 | case 1: /* RTC registers */ |
| 145 | 145 | if (addr & 0x10) |
| 146 | 146 | /* register data */ |
| 147 | reply = m_rtc->rtc_r(*memory | |
| 147 | reply = m_rtc->rtc_r(*machine().memory(). | |
| 148 | 148 | else |
| 149 | 149 | /* register select */ |
| 150 | reply = m_rtc->rtc_r(*memory | |
| 150 | reply = m_rtc->rtc_r(*machine().memory(). | |
| 151 | 151 | break; |
| 152 | 152 | case 2: /* IDE registers set 1 (CS1Fx) */ |
| 153 | 153 | if (m_tms9995_mode ? (!(addr & 1)) : (addr & 1)) |
| r14860 | r14861 | |
| 205 | 205 | case 0: /* RTC RAM */ |
| 206 | 206 | if (addr & 0x80) |
| 207 | 207 | /* RTC RAM page register */ |
| 208 | m_rtc->xram_w(*memory | |
| 208 | m_rtc->xram_w(*machine().memory(). | |
| 209 | 209 | else |
| 210 | 210 | /* RTC RAM write */ |
| 211 | m_rtc->xram_w(*memory | |
| 211 | m_rtc->xram_w(*machine().memory(). | |
| 212 | 212 | break; |
| 213 | 213 | case 1: /* RTC registers */ |
| 214 | 214 | if (addr & 0x10) |
| 215 | 215 | /* register data */ |
| 216 | m_rtc->rtc_w(*memory | |
| 216 | m_rtc->rtc_w(*machine().memory(). | |
| 217 | 217 | else |
| 218 | 218 | /* register select */ |
| 219 | m_rtc->rtc_w(*memory | |
| 219 | m_rtc->rtc_w(*machine().memory(). | |
| 220 | 220 | break; |
| 221 | 221 | case 2: /* IDE registers set 1 (CS1Fx) */ |
| 222 | 222 | /* |
| r14860 | r14861 | |
|---|---|---|
| 765 | 765 | LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), data )); |
| 766 | 766 | |
| 767 | 767 | /* set 8-bit data */ |
| 768 | printer->write( * | |
| 768 | printer->write( * | |
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | |
| r14860 | r14861 | |
| 2961 | 2961 | static WRITE8_DEVICE_HANDLER ( to9_sys_porta_out ) |
| 2962 | 2962 | { |
| 2963 | 2963 | centronics_device *printer = device->machine().device<centronics_device>("centronics"); |
| 2964 | printer->write(* | |
| 2964 | printer->write(* | |
| 2965 | 2965 | } |
| 2966 | 2966 | |
| 2967 | 2967 | |
| r14860 | r14861 | |
| 4472 | 4472 | LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), data )); |
| 4473 | 4473 | |
| 4474 | 4474 | /* centronics data */ |
| 4475 | printer->write( * | |
| 4475 | printer->write( * | |
| 4476 | 4476 | } |
| 4477 | 4477 | |
| 4478 | 4478 |
| r14860 | r14861 | |
|---|---|---|
| 242 | 242 | { |
| 243 | 243 | /* if psg not selected, write to printer */ |
| 244 | 244 | centronics_device *centronics = device->machine().device<centronics_device>("centronics"); |
| 245 | centronics->write(* | |
| 245 | centronics->write(* | |
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 |
| r14860 | r14861 | |
|---|---|---|
| 641 | 641 | /* SIMPL emulation */ |
| 642 | 642 | dac_signed_data_w(device->machine().device("dac"), data); |
| 643 | 643 | else |
| 644 | device->machine().device<centronics_device>("centronics")->write(* | |
| 644 | device->machine().device<centronics_device>("centronics")->write(* | |
| 645 | 645 | } |
| 646 | 646 | |
| 647 | 647 | READ8_DEVICE_HANDLER( msx_printer_status_r ) |
| r14860 | r14861 | |
|---|---|---|
| 226 | 226 | static void duart_tx(device_t *device, int channel, UINT8 data) |
| 227 | 227 | { |
| 228 | 228 | device_t *devconf = device->machine().device(TERMINAL_TAG); |
| 229 | dynamic_cast<generic_terminal_device *>(devconf)->write(* | |
| 229 | dynamic_cast<generic_terminal_device *>(devconf)->write(* | |
| 230 | 230 | #ifdef SERIAL_TO_STDERR |
| 231 | 231 | fprintf(stderr, "%02X ",data); |
| 232 | 232 | #endif |
| r14860 | r14861 | |
|---|---|---|
| 114 | 114 | static void data_from_i8031(device_t *device, int data) |
| 115 | 115 | { |
| 116 | 116 | pes_state *state = device->machine().driver_data<pes_state>(); |
| 117 | state->m_terminal->write(* | |
| 117 | state->m_terminal->write(* | |
| 118 | 118 | #ifdef DEBUG_SERIAL_CB |
| 119 | 119 | fprintf(stderr,"callback: output from i8031/pes to pc/terminal: %02X\n",data); |
| 120 | 120 | #endif |
| r14860 | r14861 | |
|---|---|---|
| 699 | 699 | static WRITE8_DEVICE_HANDLER( misc_ppi_pb_w ) |
| 700 | 700 | { |
| 701 | 701 | centronics_device *centronics = device->machine().device<centronics_device>(CENTRONICS_TAG); |
| 702 | centronics->write( * | |
| 702 | centronics->write( * | |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | static READ8_DEVICE_HANDLER( misc_ppi_pc_r ) |
| r14860 | r14861 | |
|---|---|---|
| 1282 | 1282 | AM_RANGE(0x2ffff0, 0x2fffff) AM_WRITE_LEGACY(main_cpu_bank_select_w) |
| 1283 | 1283 | AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01ff7e) AM_READ_LEGACY(aes_in0_r) |
| 1284 | 1284 | AM_RANGE(0x300080, 0x300081) AM_MIRROR(0x01ff7e) AM_READ_PORT("IN4") |
| 1285 | AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01ffe0) AM_READ | |
| 1285 | AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01ffe0) AM_READ | |
| 1286 | 1286 | AM_RANGE(0x320000, 0x320001) AM_MIRROR(0x01fffe) AM_READ_PORT("IN3") AM_WRITE_LEGACY(audio_command_w) |
| 1287 | 1287 | AM_RANGE(0x340000, 0x340001) AM_MIRROR(0x01fffe) AM_READ_LEGACY(aes_in1_r) |
| 1288 | AM_RANGE(0x360000, 0x37ffff) AM_READ | |
| 1288 | AM_RANGE(0x360000, 0x37ffff) AM_READ | |
| 1289 | 1289 | AM_RANGE(0x380000, 0x380001) AM_MIRROR(0x01fffe) AM_READ_LEGACY(aes_in2_r) |
| 1290 | 1290 | AM_RANGE(0x380000, 0x38007f) AM_MIRROR(0x01ff80) AM_WRITE_LEGACY(io_control_w) |
| 1291 | AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READ | |
| 1291 | AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READ | |
| 1292 | 1292 | AM_RANGE(0x3c0000, 0x3c0007) AM_MIRROR(0x01fff8) AM_READ_LEGACY(neogeo_video_register_r) |
| 1293 | 1293 | AM_RANGE(0x3c0000, 0x3c000f) AM_MIRROR(0x01fff0) AM_WRITE_LEGACY(neogeo_video_register_w) |
| 1294 | AM_RANGE(0x3e0000, 0x3fffff) AM_READ | |
| 1294 | AM_RANGE(0x3e0000, 0x3fffff) AM_READ | |
| 1295 | 1295 | AM_RANGE(0x400000, 0x401fff) AM_MIRROR(0x3fe000) AM_READWRITE_LEGACY(neogeo_paletteram_r, neogeo_paletteram_w) |
| 1296 | 1296 | AM_RANGE(0x800000, 0x800fff) AM_READWRITE_LEGACY(memcard_r, memcard_w) |
| 1297 | 1297 | AM_RANGE(0xc00000, 0xc1ffff) AM_MIRROR(0x0e0000) AM_ROMBANK(NEOGEO_BANK_BIOS) |
| 1298 | AM_RANGE(0xd00000, 0xd0ffff) AM_MIRROR(0x0f0000) AM_READ_LEGACY(neogeo_unmapped_r) //AM_RAM_WRITE_LEGACY(save_ram_w) AM_BASE_LEGACY(&save_ram) | |
| 1299 | AM_RANGE(0xe00000, 0xffffff) AM_READ_LEGACY(neogeo_unmapped_r) | |
| 1298 | AM_RANGE(0xd00000, 0xd0ffff) AM_MIRROR(0x0f0000) AM_READ(neogeo_unmapped_r) //AM_RAM_WRITE_LEGACY(save_ram_w) AM_BASE_LEGACY(&save_ram) | |
| 1299 | AM_RANGE(0xe00000, 0xffffff) AM_READ(neogeo_unmapped_r) | |
| 1300 | 1300 | ADDRESS_MAP_END |
| 1301 | 1301 | |
| 1302 | 1302 | static ADDRESS_MAP_START( neocd_main_map, AS_PROGRAM, 16, ng_aes_state ) |
| r14860 | r14861 | |
| 1308 | 1308 | AM_RANGE(0x2ffff0, 0x2fffff) AM_WRITE_LEGACY(main_cpu_bank_select_w) |
| 1309 | 1309 | AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01ff7e) AM_READ_LEGACY(aes_in0_r) |
| 1310 | 1310 | AM_RANGE(0x300080, 0x300081) AM_MIRROR(0x01ff7e) AM_READ_PORT("IN4") |
| 1311 | AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01ffe0) AM_READ | |
| 1311 | AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01ffe0) AM_READ | |
| 1312 | 1312 | AM_RANGE(0x320000, 0x320001) AM_MIRROR(0x01fffe) AM_READ_PORT("IN3") AM_WRITE_LEGACY(audio_command_w) |
| 1313 | 1313 | AM_RANGE(0x340000, 0x340001) AM_MIRROR(0x01fffe) AM_READ_LEGACY(aes_in1_r) |
| 1314 | AM_RANGE(0x360000, 0x37ffff) AM_READ | |
| 1314 | AM_RANGE(0x360000, 0x37ffff) AM_READ | |
| 1315 | 1315 | AM_RANGE(0x380000, 0x380001) AM_MIRROR(0x01fffe) AM_READ_LEGACY(aes_in2_r) |
| 1316 | 1316 | AM_RANGE(0x380000, 0x38007f) AM_MIRROR(0x01ff80) AM_WRITE_LEGACY(io_control_w) |
| 1317 | AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READ | |
| 1317 | AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READ | |
| 1318 | 1318 | AM_RANGE(0x3c0000, 0x3c0007) AM_MIRROR(0x01fff8) AM_READ_LEGACY(neogeo_video_register_r) |
| 1319 | 1319 | AM_RANGE(0x3c0000, 0x3c000f) AM_MIRROR(0x01fff0) AM_WRITE_LEGACY(neogeo_video_register_w) |
| 1320 | AM_RANGE(0x3e0000, 0x3fffff) AM_READ | |
| 1320 | AM_RANGE(0x3e0000, 0x3fffff) AM_READ | |
| 1321 | 1321 | AM_RANGE(0x400000, 0x401fff) AM_MIRROR(0x3fe000) AM_READWRITE_LEGACY(neogeo_paletteram_r, neogeo_paletteram_w) |
| 1322 | 1322 | AM_RANGE(0x800000, 0x803fff) AM_READWRITE_LEGACY(neocd_memcard_r, neocd_memcard_w) |
| 1323 | 1323 | AM_RANGE(0xc00000, 0xcfffff) AM_ROMBANK(NEOGEO_BANK_BIOS) |
| 1324 | AM_RANGE(0xd00000, 0xd0ffff) AM_MIRROR(0x0f0000) AM_READ | |
| 1324 | AM_RANGE(0xd00000, 0xd0ffff) AM_MIRROR(0x0f0000) AM_READ | |
| 1325 | 1325 | AM_RANGE(0xe00000, 0xefffff) AM_READWRITE_LEGACY(neocd_transfer_r,neocd_transfer_w) |
| 1326 | AM_RANGE(0xf00000, 0xfeffff) AM_READ | |
| 1326 | AM_RANGE(0xf00000, 0xfeffff) AM_READ | |
| 1327 | 1327 | AM_RANGE(0xff0000, 0xff01ff) AM_READWRITE_LEGACY(neocd_control_r, neocd_control_w) // CDROM / DMA |
| 1328 | AM_RANGE(0xff0200, 0xffffff) AM_READ | |
| 1328 | AM_RANGE(0xff0200, 0xffffff) AM_READ | |
| 1329 | 1329 | ADDRESS_MAP_END |
| 1330 | 1330 | |
| 1331 | 1331 |
| r14860 | r14861 | |
|---|---|---|
| 660 | 660 | |
| 661 | 661 | static void cd_dma_read( psxcd_device *psxcd, UINT32 n_address, INT32 n_size ) |
| 662 | 662 | { |
| 663 | UINT8 *psxram = (UINT8 *) | |
| 663 | UINT8 *psxram = (UINT8 *) | |
| 664 | 664 | |
| 665 | 665 | psxcd->start_dma(psxram + n_address, n_size*4); |
| 666 | 666 | } |
| r14860 | r14861 | |
|---|---|---|
| 426 | 426 | { |
| 427 | 427 | device_t *devconf = device->machine().device(TERMINAL_TAG); |
| 428 | 428 | verboselog(device->machine(), 0, "duarta_tx: %02x\n", data); |
| 429 | dynamic_cast<generic_terminal_device *>(devconf)->write(* | |
| 429 | dynamic_cast<generic_terminal_device *>(devconf)->write(* | |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | static const duart68681_config sgi_ip2_duart68681a_config = |
| r14860 | r14861 | |
|---|---|---|
| 86 | 86 | static void duart_tx(device_t *device, int channel, UINT8 data) |
| 87 | 87 | { |
| 88 | 88 | ht68k_state *state = device->machine().driver_data<ht68k_state>(); |
| 89 | state->m_terminal->write(* | |
| 89 | state->m_terminal->write(* | |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | static UINT8 duart_input(device_t *device) |
| r14860 | r14861 | |
|---|---|---|
| 1175 | 1175 | void apollo_terminal_write(UINT8 data) { |
| 1176 | 1176 | if (dsp_terminal != NULL) { |
| 1177 | 1177 | // output data to the terminal emulator |
| 1178 | dynamic_cast<generic_terminal_device *>(dsp_terminal)->write(* | |
| 1178 | dynamic_cast<generic_terminal_device *>(dsp_terminal)->write(* | |
| 1179 | 1179 | } |
| 1180 | 1180 | } |
| 1181 | 1181 |
| Previous | 15994 Revisions | Next |