diff options
author | 2014-05-14 19:04:52 +0000 | |
---|---|---|
committer | 2014-05-14 19:04:52 +0000 | |
commit | c74226bb26acd1afdcc59f20e174d126423f60b9 (patch) | |
tree | 67a584a596dc13b820cfdbe411eaf826852475ff /src/emu/bus/msx_cart/msxdos2.c | |
parent | 8ab3ccb194ff9cb37bda434489a82da854b24af6 (diff) |
(MESS) msx.c: [Wilbert Pol]
- Reimplemented the cartridge slots as slot devices.
- Moved the msx slot layouts to inline machine configuration.
- Started adding support for a few more firmware types.
- Add turbo support to Panasonic FS-A1FX/FS-A1WX/FS-A1WSX.
Diffstat (limited to 'src/emu/bus/msx_cart/msxdos2.c')
-rw-r--r-- | src/emu/bus/msx_cart/msxdos2.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/emu/bus/msx_cart/msxdos2.c b/src/emu/bus/msx_cart/msxdos2.c new file mode 100644 index 00000000000..10af9d6de28 --- /dev/null +++ b/src/emu/bus/msx_cart/msxdos2.c @@ -0,0 +1,66 @@ +#include "emu.h" +#include "msxdos2.h" + +const device_type MSX_CART_MSXDOS2 = &device_creator<msx_cart_msxdos2>; + + +msx_cart_msxdos2::msx_cart_msxdos2(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MSX_CART_MSXDOS2, "MSX Cartridge - MSXDOS2", tag, owner, clock, "msx_cart_msxdos2", __FILE__) + , msx_cart_interface(mconfig, *this) + , m_selected_bank(0) + , m_bank_base(NULL) +{ +} + + +void msx_cart_msxdos2::device_start() +{ + save_item(NAME(m_selected_bank)); + + machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_msxdos2::restore_banks), this)); +} + + +void msx_cart_msxdos2::restore_banks() +{ + m_bank_base = get_rom_base() + ( m_selected_bank & 0x03 ) * 0x4000; +} + + +void msx_cart_msxdos2::device_reset() +{ + m_selected_bank = 0; +} + + +void msx_cart_msxdos2::initialize_cartridge() +{ + if (get_rom_size() != 0x10000) + { + fatalerror("msxdos2: Invalid ROM size\n"); + } + + restore_banks(); +} + + +READ8_MEMBER(msx_cart_msxdos2::read_cart) +{ + if (offset >= 0x4000 && offset < 0x8000) + { + return m_bank_base[offset & 0x3fff]; + } + + return 0xff; +} + + +WRITE8_MEMBER(msx_cart_msxdos2::write_cart) +{ + if (offset == 0x6000) + { + m_selected_bank = data; + restore_banks(); + } +} + |