trunk/src/mess/machine/c64_mach5.c
| r20942 | r20943 | |
| 18 | 18 | const device_type C64_MACH5 = &device_creator<c64_mach5_cartridge_device>; |
| 19 | 19 | |
| 20 | 20 | |
| 21 | //------------------------------------------------- |
| 22 | // INPUT_PORTS( c64_mach5 ) |
| 23 | //------------------------------------------------- |
| 21 | 24 | |
| 25 | INPUT_CHANGED_MEMBER( c64_mach5_cartridge_device::reset ) |
| 26 | { |
| 27 | if (!newval) |
| 28 | { |
| 29 | device_reset(); |
| 30 | } |
| 31 | |
| 32 | m_slot->reset_w(newval ? CLEAR_LINE : ASSERT_LINE); |
| 33 | } |
| 34 | |
| 35 | static INPUT_PORTS_START( c64_mach5 ) |
| 36 | PORT_START("S1") |
| 37 | PORT_DIPNAME( 0x01, 0x00, "Mode" ) |
| 38 | PORT_DIPSETTING( 0x00, "C64" ) |
| 39 | PORT_DIPSETTING( 0x01, "C128" ) |
| 40 | |
| 41 | PORT_START("S2") |
| 42 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("Reset") PORT_CHANGED_MEMBER(DEVICE_SELF, c64_mach5_cartridge_device, reset, 0) |
| 43 | INPUT_PORTS_END |
| 44 | |
| 45 | |
| 46 | //------------------------------------------------- |
| 47 | // input_ports - device-specific input ports |
| 48 | //------------------------------------------------- |
| 49 | |
| 50 | ioport_constructor c64_mach5_cartridge_device::device_input_ports() const |
| 51 | { |
| 52 | return INPUT_PORTS_NAME( c64_mach5 ); |
| 53 | } |
| 54 | |
| 55 | |
| 56 | |
| 22 | 57 | //************************************************************************** |
| 23 | 58 | // LIVE DEVICE |
| 24 | 59 | //************************************************************************** |
| r20942 | r20943 | |
| 29 | 64 | |
| 30 | 65 | c64_mach5_cartridge_device::c64_mach5_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 31 | 66 | device_t(mconfig, C64_MACH5, "C64 MACH5 cartridge", tag, owner, clock), |
| 32 | | device_c64_expansion_card_interface(mconfig, *this) |
| 67 | device_c64_expansion_card_interface(mconfig, *this), |
| 68 | m_s1(*this, "S1") |
| 33 | 69 | { |
| 34 | 70 | } |
| 35 | 71 | |
| r20942 | r20943 | |
| 49 | 85 | |
| 50 | 86 | void c64_mach5_cartridge_device::device_reset() |
| 51 | 87 | { |
| 52 | | m_exrom = 0; |
| 88 | m_c128 = m_s1->read(); |
| 89 | |
| 90 | if (!m_c128) |
| 91 | { |
| 92 | m_exrom = 0; |
| 93 | } |
| 53 | 94 | } |
| 54 | 95 | |
| 55 | 96 | |
| r20942 | r20943 | |
| 59 | 100 | |
| 60 | 101 | UINT8 c64_mach5_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2) |
| 61 | 102 | { |
| 62 | | if (!roml || !io1 || !io2) |
| 103 | if (!roml || !romh || !io1 || !io2) |
| 63 | 104 | { |
| 64 | 105 | data = m_roml[offset & 0x1fff]; |
| 65 | 106 | } |
| r20942 | r20943 | |
| 74 | 115 | |
| 75 | 116 | void c64_mach5_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2) |
| 76 | 117 | { |
| 77 | | if (!io1) |
| 118 | if (!m_c128) |
| 78 | 119 | { |
| 79 | | m_exrom = 0; |
| 120 | if (!io1) |
| 121 | { |
| 122 | m_exrom = 0; |
| 123 | } |
| 124 | else if (!io2) |
| 125 | { |
| 126 | m_exrom = 1; |
| 127 | } |
| 80 | 128 | } |
| 81 | | else if (!io2) |
| 82 | | { |
| 83 | | m_exrom = 1; |
| 84 | | } |
| 85 | 129 | } |
trunk/src/mess/machine/c64_mach5.h
| r20942 | r20943 | |
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | | Cinemaware Warp Speed cartridge emulation |
| 3 | Access Software MACH 5 cartridge emulation |
| 4 | 4 | |
| 5 | 5 | Copyright MESS Team. |
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| r20942 | r20943 | |
| 12 | 12 | #ifndef __MACH5__ |
| 13 | 13 | #define __MACH5__ |
| 14 | 14 | |
| 15 | | |
| 16 | 15 | #include "emu.h" |
| 17 | 16 | #include "machine/c64exp.h" |
| 18 | 17 | |
| r20942 | r20943 | |
| 31 | 30 | // construction/destruction |
| 32 | 31 | c64_mach5_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 33 | 32 | |
| 33 | // optional information overrides |
| 34 | virtual ioport_constructor device_input_ports() const; |
| 35 | |
| 36 | DECLARE_INPUT_CHANGED_MEMBER( reset ); |
| 37 | |
| 34 | 38 | protected: |
| 35 | 39 | // device-level overrides |
| 36 | 40 | virtual void device_config_complete() { m_shortname = "c64_mach5"; } |
| r20942 | r20943 | |
| 40 | 44 | // device_c64_expansion_card_interface overrides |
| 41 | 45 | virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2); |
| 42 | 46 | virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2); |
| 47 | |
| 48 | private: |
| 49 | required_ioport m_s1; |
| 50 | |
| 51 | bool m_c128; |
| 43 | 52 | }; |
| 44 | 53 | |
| 45 | 54 | |