trunk/src/emu/bus/msx_cart/hfox.c
| r0 | r30779 | |
| 1 | #include "emu.h" |
| 2 | #include "hfox.h" |
| 3 | |
| 4 | |
| 5 | const device_type MSX_CART_HFOX = &device_creator<msx_cart_hfox>; |
| 6 | |
| 7 | |
| 8 | msx_cart_hfox::msx_cart_hfox(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 9 | : device_t(mconfig, MSX_CART_HFOX, "MSX Cartridge - Harry Fox", tag, owner, clock, "msx_cart_hfox", __FILE__) |
| 10 | , msx_cart_interface(mconfig, *this) |
| 11 | { |
| 12 | m_selected_bank[0] = m_selected_bank[1] = 0; |
| 13 | m_bank_base[0] = m_bank_base[1] = NULL; |
| 14 | } |
| 15 | |
| 16 | |
| 17 | void msx_cart_hfox::device_start() |
| 18 | { |
| 19 | save_item(NAME(m_selected_bank)); |
| 20 | |
| 21 | machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_hfox::restore_banks), this)); |
| 22 | } |
| 23 | |
| 24 | |
| 25 | void msx_cart_hfox::restore_banks() |
| 26 | { |
| 27 | m_bank_base[0] = get_rom_base() + ((m_selected_bank[0] & 0x01) * 0x8000); |
| 28 | m_bank_base[1] = get_rom_base() + ((m_selected_bank[1] & 0x01) * 0x8000) + 0x4000; |
| 29 | } |
| 30 | |
| 31 | |
| 32 | void msx_cart_hfox::device_reset() |
| 33 | { |
| 34 | m_selected_bank[0] = m_selected_bank[1] = 0; |
| 35 | } |
| 36 | |
| 37 | |
| 38 | void msx_cart_hfox::initialize_cartridge() |
| 39 | { |
| 40 | if (get_rom_size() < 0x10000) |
| 41 | { |
| 42 | fatalerror("rtype: Invalid ROM size\n"); |
| 43 | } |
| 44 | |
| 45 | restore_banks(); |
| 46 | } |
| 47 | |
| 48 | |
| 49 | READ8_MEMBER(msx_cart_hfox::read_cart) |
| 50 | { |
| 51 | if (offset >= 0x4000 && offset < 0xc000) |
| 52 | { |
| 53 | return m_bank_base[offset >> 15][offset & 0x3fff]; |
| 54 | } |
| 55 | return 0xff; |
| 56 | } |
| 57 | |
| 58 | |
| 59 | WRITE8_MEMBER(msx_cart_hfox::write_cart) |
| 60 | { |
| 61 | switch (offset) |
| 62 | { |
| 63 | case 0x6000: |
| 64 | m_selected_bank[0] = data; |
| 65 | restore_banks(); |
| 66 | break; |
| 67 | |
| 68 | case 0x7000: |
| 69 | m_selected_bank[1] = data; |
| 70 | restore_banks(); |
| 71 | break; |
| 72 | |
| 73 | default: |
| 74 | printf("msx_cart_hfox: unhandled write %02x to %04x\n", data, offset); |
| 75 | break; |
| 76 | } |
| 77 | } |
| 78 | |
trunk/src/emu/bus/msx_cart/hfox.h
| r0 | r30779 | |
| 1 | #ifndef __MSX_CART_HFOX_H |
| 2 | #define __MSX_CART_HFOX_H |
| 3 | |
| 4 | #include "bus/msx_cart/cartridge.h" |
| 5 | |
| 6 | |
| 7 | extern const device_type MSX_CART_HFOX; |
| 8 | |
| 9 | |
| 10 | class msx_cart_hfox : public device_t |
| 11 | , public msx_cart_interface |
| 12 | { |
| 13 | public: |
| 14 | msx_cart_hfox(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 15 | |
| 16 | // device-level overrides |
| 17 | virtual void device_start(); |
| 18 | virtual void device_reset(); |
| 19 | |
| 20 | virtual void initialize_cartridge(); |
| 21 | |
| 22 | virtual DECLARE_READ8_MEMBER(read_cart); |
| 23 | virtual DECLARE_WRITE8_MEMBER(write_cart); |
| 24 | |
| 25 | void restore_banks(); |
| 26 | |
| 27 | private: |
| 28 | UINT8 m_selected_bank[2]; |
| 29 | UINT8 *m_bank_base[2]; |
| 30 | }; |
| 31 | |
| 32 | |
| 33 | #endif |
trunk/hash/msx1_cart.xml
| r30778 | r30779 | |
| 6535 | 6535 | </part> |
| 6536 | 6536 | </software> |
| 6537 | 6537 | |
| 6538 | | <software name="hfox2" cloneof="hfox" supported="no"> |
| 6538 | <software name="hfox2" cloneof="hfox"> |
| 6539 | 6539 | <description>Hurry Fox - Yuki no Maou hen (Jpn)</description> |
| 6540 | 6540 | <year>1985</year> |
| 6541 | 6541 | <publisher>MicroCabin</publisher> |
| 6542 | 6542 | <info name="alt_title" value="は~りぃふぉっくす雪の魔王編" /> |
| 6543 | 6543 | <part name="cart" interface="msx_cart"> |
| 6544 | | <feature name="slot" value="ascii16" /> |
| 6544 | <feature name="slot" value="hfox" /> |
| 6545 | 6545 | <feature name="mapper" value="M60002-0125SP-16" /> |
| 6546 | 6546 | <dataarea name="rom" size="65536"> |
| 6547 | 6547 | <rom name="harryfox yki no maoh (japan).rom" size="65536" crc="c7fe3ee1" sha1="3626b5dd3188ec2a16e102d05c79f8f242fbd892" offset="0" /> |