diff options
author | 2014-04-02 16:33:03 +0000 | |
---|---|---|
committer | 2014-04-02 16:33:03 +0000 | |
commit | 880613a70aff06efeac97398ae6cad2c8bd52040 (patch) | |
tree | 7ec982c3dce89159dd986f20922c445b89ed09ca /src | |
parent | 4796f476cbddeb418e836d6fba6f63d40a8d65f1 (diff) |
converted legacy handlers to modern (nw)
Diffstat (limited to 'src')
-rw-r--r-- | src/emu/cpu/g65816/g65816.c | 84 | ||||
-rw-r--r-- | src/emu/cpu/g65816/g65816.h | 27 | ||||
-rw-r--r-- | src/mess/drivers/snes.c | 22 |
3 files changed, 77 insertions, 56 deletions
diff --git a/src/emu/cpu/g65816/g65816.c b/src/emu/cpu/g65816/g65816.c index 503e1a5421c..143afc9c9d8 100644 --- a/src/emu/cpu/g65816/g65816.c +++ b/src/emu/cpu/g65816/g65816.c @@ -584,39 +584,39 @@ translation of Breath of Fire 2 to work. More weirdness: we might need to leave 8 CPU cycles for division at first, since using 16 produces bugs (see e.g. Triforce pieces in Zelda 3 intro) */ -static WRITE8_HANDLER( wrmpya_w ) +WRITE8_MEMBER( _5a22_device::wrmpya_w ) { - g65816i_cpu_struct *cpustate = get_safe_token(&space.device()); + g65816i_cpu_struct *cpustate = get_safe_token(this); cpustate->wrmpya = data; } -static WRITE8_HANDLER( wrmpyb_w ) +WRITE8_MEMBER( _5a22_device::wrmpyb_w ) { - g65816i_cpu_struct *cpustate = get_safe_token(&space.device()); + g65816i_cpu_struct *cpustate = get_safe_token(this); cpustate->wrmpyb = data; cpustate->rdmpy = cpustate->wrmpya * cpustate->wrmpyb; /* TODO: cpustate->rddiv == 0? */ } -static WRITE8_HANDLER( wrdivl_w ) +WRITE8_MEMBER( _5a22_device::wrdivl_w ) { - g65816i_cpu_struct *cpustate = get_safe_token(&space.device()); + g65816i_cpu_struct *cpustate = get_safe_token(this); cpustate->wrdiv = (data) | (cpustate->wrdiv & 0xff00); } -static WRITE8_HANDLER( wrdivh_w ) +WRITE8_MEMBER( _5a22_device::wrdivh_w ) { - g65816i_cpu_struct *cpustate = get_safe_token(&space.device()); + g65816i_cpu_struct *cpustate = get_safe_token(this); cpustate->wrdiv = (data << 8) | (cpustate->wrdiv & 0xff); } -static WRITE8_HANDLER( wrdvdd_w ) +WRITE8_MEMBER( _5a22_device::wrdvdd_w ) { - g65816i_cpu_struct *cpustate = get_safe_token(&space.device()); + g65816i_cpu_struct *cpustate = get_safe_token(this); UINT16 quotient, remainder; cpustate->dvdd = data; @@ -628,67 +628,67 @@ static WRITE8_HANDLER( wrdvdd_w ) cpustate->rdmpy = remainder; } -static WRITE8_HANDLER( memsel_w ) +WRITE8_MEMBER( _5a22_device::memsel_w ) { - g65816i_cpu_struct *cpustate = get_safe_token(&space.device()); + g65816i_cpu_struct *cpustate = get_safe_token(this); cpustate->fastROM = data & 1; } -static READ8_HANDLER( rddivl_r ) +READ8_MEMBER( _5a22_device::rddivl_r ) { - g65816i_cpu_struct *cpustate = get_safe_token(&space.device()); + g65816i_cpu_struct *cpustate = get_safe_token(this); return cpustate->rddiv & 0xff; } -static READ8_HANDLER( rddivh_r ) +READ8_MEMBER( _5a22_device::rddivh_r ) { - g65816i_cpu_struct *cpustate = get_safe_token(&space.device()); + g65816i_cpu_struct *cpustate = get_safe_token(this); return cpustate->rddiv >> 8; } -static READ8_HANDLER( rdmpyl_r ) +READ8_MEMBER( _5a22_device::rdmpyl_r ) { - g65816i_cpu_struct *cpustate = get_safe_token(&space.device()); + g65816i_cpu_struct *cpustate = get_safe_token(this); return cpustate->rdmpy & 0xff; } -static READ8_HANDLER( rdmpyh_r ) +READ8_MEMBER( _5a22_device::rdmpyh_r ) { - g65816i_cpu_struct *cpustate = get_safe_token(&space.device()); + g65816i_cpu_struct *cpustate = get_safe_token(this); return cpustate->rdmpy >> 8; } -static ADDRESS_MAP_START(_5a22_map, AS_PROGRAM, 8, legacy_cpu_device) - AM_RANGE(0x4202, 0x4202) AM_MIRROR(0xbf0000) AM_WRITE_LEGACY(wrmpya_w) - AM_RANGE(0x4203, 0x4203) AM_MIRROR(0xbf0000) AM_WRITE_LEGACY(wrmpyb_w) - AM_RANGE(0x4204, 0x4204) AM_MIRROR(0xbf0000) AM_WRITE_LEGACY(wrdivl_w) - AM_RANGE(0x4205, 0x4205) AM_MIRROR(0xbf0000) AM_WRITE_LEGACY(wrdivh_w) - AM_RANGE(0x4206, 0x4206) AM_MIRROR(0xbf0000) AM_WRITE_LEGACY(wrdvdd_w) +static ADDRESS_MAP_START(_5a22_map, AS_PROGRAM, 8, _5a22_device) + AM_RANGE(0x4202, 0x4202) AM_MIRROR(0xbf0000) AM_WRITE(wrmpya_w) + AM_RANGE(0x4203, 0x4203) AM_MIRROR(0xbf0000) AM_WRITE(wrmpyb_w) + AM_RANGE(0x4204, 0x4204) AM_MIRROR(0xbf0000) AM_WRITE(wrdivl_w) + AM_RANGE(0x4205, 0x4205) AM_MIRROR(0xbf0000) AM_WRITE(wrdivh_w) + AM_RANGE(0x4206, 0x4206) AM_MIRROR(0xbf0000) AM_WRITE(wrdvdd_w) - AM_RANGE(0x420d, 0x420d) AM_MIRROR(0xbf0000) AM_WRITE_LEGACY(memsel_w) + AM_RANGE(0x420d, 0x420d) AM_MIRROR(0xbf0000) AM_WRITE(memsel_w) - AM_RANGE(0x4214, 0x4214) AM_MIRROR(0xbf0000) AM_READ_LEGACY(rddivl_r) - AM_RANGE(0x4215, 0x4215) AM_MIRROR(0xbf0000) AM_READ_LEGACY(rddivh_r) - AM_RANGE(0x4216, 0x4216) AM_MIRROR(0xbf0000) AM_READ_LEGACY(rdmpyl_r) - AM_RANGE(0x4217, 0x4217) AM_MIRROR(0xbf0000) AM_READ_LEGACY(rdmpyh_r) + AM_RANGE(0x4214, 0x4214) AM_MIRROR(0xbf0000) AM_READ(rddivl_r) + AM_RANGE(0x4215, 0x4215) AM_MIRROR(0xbf0000) AM_READ(rddivh_r) + AM_RANGE(0x4216, 0x4216) AM_MIRROR(0xbf0000) AM_READ(rdmpyl_r) + AM_RANGE(0x4217, 0x4217) AM_MIRROR(0xbf0000) AM_READ(rdmpyh_r) ADDRESS_MAP_END -void set_5a22_map(legacy_cpu_device &cpu) +void _5a22_device::set_5a22_map() { - cpu.space(AS_PROGRAM).install_legacy_write_handler(0x4202, 0x4202, 0, 0xbf0000, FUNC(wrmpya_w)); - cpu.space(AS_PROGRAM).install_legacy_write_handler(0x4203, 0x4203, 0, 0xbf0000, FUNC(wrmpyb_w)); - cpu.space(AS_PROGRAM).install_legacy_write_handler(0x4204, 0x4204, 0, 0xbf0000, FUNC(wrdivl_w)); - cpu.space(AS_PROGRAM).install_legacy_write_handler(0x4205, 0x4205, 0, 0xbf0000, FUNC(wrdivh_w)); - cpu.space(AS_PROGRAM).install_legacy_write_handler(0x4206, 0x4206, 0, 0xbf0000, FUNC(wrdvdd_w)); + space(AS_PROGRAM).install_write_handler(0x4202, 0x4202, 0, 0xbf0000, write8_delegate(FUNC(_5a22_device::wrmpya_w),this)); + space(AS_PROGRAM).install_write_handler(0x4203, 0x4203, 0, 0xbf0000, write8_delegate(FUNC(_5a22_device::wrmpyb_w),this)); + space(AS_PROGRAM).install_write_handler(0x4204, 0x4204, 0, 0xbf0000, write8_delegate(FUNC(_5a22_device::wrdivl_w),this)); + space(AS_PROGRAM).install_write_handler(0x4205, 0x4205, 0, 0xbf0000, write8_delegate(FUNC(_5a22_device::wrdivh_w),this)); + space(AS_PROGRAM).install_write_handler(0x4206, 0x4206, 0, 0xbf0000, write8_delegate(FUNC(_5a22_device::wrdvdd_w),this)); - cpu.space(AS_PROGRAM).install_legacy_write_handler(0x420d, 0x420d, 0, 0xbf0000, FUNC(memsel_w)); + space(AS_PROGRAM).install_write_handler(0x420d, 0x420d, 0, 0xbf0000, write8_delegate(FUNC(_5a22_device::memsel_w),this)); - cpu.space(AS_PROGRAM).install_legacy_read_handler(0x4214, 0x4214, 0, 0xbf0000, FUNC(rddivl_r)); - cpu.space(AS_PROGRAM).install_legacy_read_handler(0x4215, 0x4215, 0, 0xbf0000, FUNC(rddivh_r)); - cpu.space(AS_PROGRAM).install_legacy_read_handler(0x4216, 0x4216, 0, 0xbf0000, FUNC(rdmpyl_r)); - cpu.space(AS_PROGRAM).install_legacy_read_handler(0x4217, 0x4217, 0, 0xbf0000, FUNC(rdmpyh_r)); + space(AS_PROGRAM).install_read_handler(0x4214, 0x4214, 0, 0xbf0000, read8_delegate(FUNC(_5a22_device::rddivl_r),this)); + space(AS_PROGRAM).install_read_handler(0x4215, 0x4215, 0, 0xbf0000, read8_delegate(FUNC(_5a22_device::rddivh_r),this)); + space(AS_PROGRAM).install_read_handler(0x4216, 0x4216, 0, 0xbf0000, read8_delegate(FUNC(_5a22_device::rdmpyl_r),this)); + space(AS_PROGRAM).install_read_handler(0x4217, 0x4217, 0, 0xbf0000, read8_delegate(FUNC(_5a22_device::rdmpyh_r),this)); } CPU_SET_INFO( _5a22 ) diff --git a/src/emu/cpu/g65816/g65816.h b/src/emu/cpu/g65816/g65816.h index 3370fa51a1e..5422a6749f4 100644 --- a/src/emu/cpu/g65816/g65816.h +++ b/src/emu/cpu/g65816/g65816.h @@ -59,7 +59,30 @@ enum /* Main interface function */ DECLARE_LEGACY_CPU_DEVICE(G65816, g65816); -DECLARE_LEGACY_CPU_DEVICE(_5A22, _5a22); + +CPU_GET_INFO( _5a22 ); + +class _5a22_device : public legacy_cpu_device +{ +public: + _5a22_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_WRITE8_MEMBER( wrmpya_w ); + DECLARE_WRITE8_MEMBER( wrmpyb_w ); + DECLARE_WRITE8_MEMBER( wrdivl_w ); + DECLARE_WRITE8_MEMBER( wrdivh_w ); + DECLARE_WRITE8_MEMBER( wrdvdd_w ); + DECLARE_WRITE8_MEMBER( memsel_w ); + DECLARE_READ8_MEMBER( rddivl_r ); + DECLARE_READ8_MEMBER( rddivh_r ); + DECLARE_READ8_MEMBER( rdmpyl_r ); + DECLARE_READ8_MEMBER( rdmpyh_r ); + + void set_5a22_map(); +}; + +extern const device_type _5A22; + #define CPU_TYPE_G65816 0 #define CPU_TYPE_5A22 1 @@ -67,8 +90,6 @@ DECLARE_LEGACY_CPU_DEVICE(_5A22, _5a22); void g65816_set_read_vector_callback(device_t *device, read8_delegate read_vector); -void set_5a22_map(legacy_cpu_device &cpu); - /* ======================================================================== */ /* ============================== END OF FILE ============================= */ /* ======================================================================== */ diff --git a/src/mess/drivers/snes.c b/src/mess/drivers/snes.c index 10e728a2ff4..07bc237e1b0 100644 --- a/src/mess/drivers/snes.c +++ b/src/mess/drivers/snes.c @@ -1815,12 +1815,12 @@ void snes_console_state::machine_start() case SNES_Z80GB: // skeleton support m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessgb_lo_r),this), write8_delegate(FUNC(snes_console_state::snessgb_lo_w),this)); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessgb_hi_r),this), write8_delegate(FUNC(snes_console_state::snessgb_hi_w),this)); - set_5a22_map(m_maincpu); + m_maincpu->set_5a22_map(); break; case SNES_SA1: // skeleton support m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessa1_lo_r),this), write8_delegate(FUNC(snes_console_state::snessa1_lo_w),this)); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessa1_hi_r),this), write8_delegate(FUNC(snes_console_state::snessa1_hi_w),this)); - set_5a22_map(m_maincpu); + m_maincpu->set_5a22_map(); break; case SNES_DSP: m_maincpu->space(AS_PROGRAM).install_read_handler(0x208000, 0x20ffff, 0, 0x9f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); @@ -1841,49 +1841,49 @@ void snes_console_state::machine_start() case SNES_SFX: m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessfx_lo_r),this), write8_delegate(FUNC(snes_console_state::snessfx_lo_w),this)); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessfx_hi_r),this), write8_delegate(FUNC(snes_console_state::snessfx_hi_w),this)); - set_5a22_map(m_maincpu); + m_maincpu->set_5a22_map(); break; case SNES_SDD1: m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessdd1_lo_r),this), write8_delegate(FUNC(snes_console_state::snessdd1_lo_w),this)); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessdd1_hi_r),this), write8_delegate(FUNC(snes_console_state::snessdd1_hi_w),this)); - set_5a22_map(m_maincpu); + m_maincpu->set_5a22_map(); break; case SNES_BSX: m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snesbsx_lo_r),this), write8_delegate(FUNC(snes_console_state::snesbsx_lo_w),this)); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snesbsx_hi_r),this), write8_delegate(FUNC(snes_console_state::snesbsx_hi_w),this)); - set_5a22_map(m_maincpu); + m_maincpu->set_5a22_map(); break; // HiROM & HiROM + addons case SNES_MODE21: case SNES_BSXHI: m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),this), write8_delegate(FUNC(snes_console_state::snes21_lo_w),this)); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),this), write8_delegate(FUNC(snes_console_state::snes21_hi_w),this)); - set_5a22_map(m_maincpu); + m_maincpu->set_5a22_map(); break; case SNES_DSP_MODE21: m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),this), write8_delegate(FUNC(snes_console_state::snes21_lo_w),this)); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),this), write8_delegate(FUNC(snes_console_state::snes21_hi_w),this)); m_maincpu->space(AS_PROGRAM).install_read_handler(0x006000, 0x007fff, 0, 0x9f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); m_maincpu->space(AS_PROGRAM).install_write_handler(0x006000, 0x007fff, 0, 0x9f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); - set_5a22_map(m_maincpu); + m_maincpu->set_5a22_map(); break; case SNES_SRTC: m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),this), write8_delegate(FUNC(snes_console_state::snes21_lo_w),this)); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),this), write8_delegate(FUNC(snes_console_state::snes21_hi_w),this)); m_maincpu->space(AS_PROGRAM).install_read_handler(0x002800, 0x002800, 0, 0xbf0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); m_maincpu->space(AS_PROGRAM).install_write_handler(0x002801, 0x002801, 0, 0xbf0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); - set_5a22_map(m_maincpu); + m_maincpu->set_5a22_map(); break; case SNES_SPC7110: case SNES_SPC7110_RTC: m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes7110_lo_r),this), write8_delegate(FUNC(snes_console_state::snes7110_lo_w),this)); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes7110_hi_r),this), write8_delegate(FUNC(snes_console_state::snes7110_hi_w),this)); - set_5a22_map(m_maincpu); + m_maincpu->set_5a22_map(); break; case SNES_PFEST94: m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::pfest94_lo_r),this), write8_delegate(FUNC(snes_console_state::pfest94_lo_w),this)); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::pfest94_hi_r),this), write8_delegate(FUNC(snes_console_state::pfest94_hi_w),this)); - set_5a22_map(m_maincpu); + m_maincpu->set_5a22_map(); break; // pirate 'mappers' case SNES_POKEMON: @@ -1910,7 +1910,7 @@ void snes_console_state::machine_start() case SNES_BANANA: // m_maincpu->space(AS_PROGRAM).install_read_handler(0x808000, 0x80ffff, 0, 0x780000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); // m_maincpu->space(AS_PROGRAM).install_write_handler(0x808000, 0x80ffff, 0, 0x780000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); -// set_5a22_map(m_maincpu); +// m_maincpu->set_5a22_map(); break; } |