diff options
author | 2015-09-13 08:41:44 +0200 | |
---|---|---|
committer | 2015-09-13 08:41:44 +0200 | |
commit | f88cefad27a1737c76e09d99c9fb43e173506081 (patch) | |
tree | 2d8167d03579c46e226471747eb4407bd00ed6fa /src/devices/bus/msx_cart/arc.c | |
parent | e92ac9e0fa8e99869894bea00589bbb526be30aa (diff) |
Move all devices into separate part of src tree (nw)
Diffstat (limited to 'src/devices/bus/msx_cart/arc.c')
-rw-r--r-- | src/devices/bus/msx_cart/arc.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/devices/bus/msx_cart/arc.c b/src/devices/bus/msx_cart/arc.c new file mode 100644 index 00000000000..a64f321af14 --- /dev/null +++ b/src/devices/bus/msx_cart/arc.c @@ -0,0 +1,64 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#include "emu.h" +#include "arc.h" + + +const device_type MSX_CART_ARC = &device_creator<msx_cart_arc>; + + +msx_cart_arc::msx_cart_arc(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MSX_CART_ARC, "MSX Cartridge - Arc", tag, owner, clock, "msx_cart_arc", __FILE__) + , msx_cart_interface(mconfig, *this) + , m_7f(0) +{ +} + + +void msx_cart_arc::device_start() +{ + // Install IO read/write handlers + address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO); + space.install_write_handler(0x7f, 0x7f, write8_delegate(FUNC(msx_cart_arc::io_7f_w), this)); + space.install_read_handler(0x7f, 0x7f, read8_delegate(FUNC(msx_cart_arc::io_7f_r), this)); +} + + +void msx_cart_arc::device_reset() +{ + m_7f = 0; +} + + +void msx_cart_arc::initialize_cartridge() +{ + if (get_rom_size() != 0x8000) + { + fatalerror("arc: Invalid ROM size\n"); + } +} + + +READ8_MEMBER(msx_cart_arc::read_cart) +{ + if (offset >= 0x4000 && offset < 0xc000) + { + return get_rom_base()[offset - 0x4000]; + } + return 0xff; +} + + +WRITE8_MEMBER(msx_cart_arc::io_7f_w) +{ + if (data == 0x35) + { + m_7f++; + } +} + + +READ8_MEMBER(msx_cart_arc::io_7f_r) +{ + return ((m_7f & 0x03) == 0x03) ? 0xda : 0xff; +} |