trunk/src/mess/machine/c64/partner.c
| r25384 | r25385 | |
| 43 | 43 | // INPUT_PORTS( c64_partner ) |
| 44 | 44 | //------------------------------------------------- |
| 45 | 45 | |
| 46 | WRITE_LINE_MEMBER( c64_partner_cartridge_device::nmi_w ) |
| 47 | { |
| 48 | if (!state && !m_a6 && !m_nmi) |
| 49 | { |
| 50 | m_slot->nmi_w(ASSERT_LINE); |
| 51 | m_nmi = 1; |
| 52 | } |
| 53 | } |
| 54 | |
| 46 | 55 | static INPUT_PORTS_START( c64_partner ) |
| 47 | | PORT_START("RESET") |
| 48 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F11) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_expansion_slot_device, reset_w) |
| 56 | PORT_START("NMI") |
| 57 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("NMI") PORT_CODE(KEYCODE_F11) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_partner_cartridge_device, nmi_w) |
| 49 | 58 | INPUT_PORTS_END |
| 50 | 59 | |
| 51 | 60 | |
| r25384 | r25385 | |
| 70 | 79 | |
| 71 | 80 | c64_partner_cartridge_device::c64_partner_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 72 | 81 | device_t(mconfig, C64_PARTNER, "C64 PARTNER 64 cartridge", tag, owner, clock, "c64_partner", __FILE__), |
| 73 | | device_c64_expansion_card_interface(mconfig, *this) |
| 82 | device_c64_expansion_card_interface(mconfig, *this), |
| 83 | m_a0(1), |
| 84 | m_a6(1), |
| 85 | m_nmi(0) |
| 74 | 86 | { |
| 75 | 87 | } |
| 76 | 88 | |
| r25384 | r25385 | |
| 92 | 104 | |
| 93 | 105 | void c64_partner_cartridge_device::device_reset() |
| 94 | 106 | { |
| 107 | m_a0 = 1; |
| 108 | m_a6 = 1; |
| 109 | |
| 110 | if (m_nmi && m_a6) |
| 111 | { |
| 112 | m_slot->nmi_w(CLEAR_LINE); |
| 113 | m_nmi = 0; |
| 114 | } |
| 95 | 115 | } |
| 96 | 116 | |
| 97 | 117 | |
| r25384 | r25385 | |
| 101 | 121 | |
| 102 | 122 | UINT8 c64_partner_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) |
| 103 | 123 | { |
| 124 | if (!io1) |
| 125 | { |
| 126 | data = m_romh[offset & 0x3fff]; |
| 127 | } |
| 128 | |
| 129 | if (m_nmi && (offset == 0xfffa || offset == 0xfffb)) |
| 130 | { |
| 131 | m_a0 = 1; |
| 132 | } |
| 133 | |
| 134 | if (m_a0 && BIT(offset, 15)) |
| 135 | { |
| 136 | switch ((offset >> 13) & 0x03) |
| 137 | { |
| 138 | case 0: case 3: |
| 139 | data = m_romh[offset & 0x3fff]; |
| 140 | break; |
| 141 | |
| 142 | case 1: |
| 143 | data = m_ram[offset & 0x1fff]; |
| 144 | break; |
| 145 | } |
| 146 | } |
| 147 | |
| 104 | 148 | return data; |
| 105 | 149 | } |
| 106 | 150 | |
| r25384 | r25385 | |
| 111 | 155 | |
| 112 | 156 | void c64_partner_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) |
| 113 | 157 | { |
| 114 | | } |
| 158 | if (!io1) |
| 159 | { |
| 160 | m_a0 = BIT(offset, 0); |
| 161 | m_a6 = BIT(offset, 6); |
| 115 | 162 | |
| 163 | if (m_nmi && m_a6) |
| 164 | { |
| 165 | m_slot->nmi_w(CLEAR_LINE); |
| 166 | m_nmi = 0; |
| 167 | } |
| 168 | } |
| 116 | 169 | |
| 117 | | //------------------------------------------------- |
| 118 | | // c64_exrom_r - EXROM read |
| 119 | | //------------------------------------------------- |
| 170 | if (m_a0 && BIT(offset, 15)) |
| 171 | { |
| 172 | switch ((offset >> 13) & 0x03) |
| 173 | { |
| 174 | case 1: |
| 175 | m_ram[offset & 0x1fff] = data; |
| 176 | break; |
| 177 | } |
| 178 | } |
| 120 | 179 | |
| 121 | | int c64_partner_cartridge_device::c64_exrom_r(offs_t offset, int sphi2, int ba, int rw) |
| 122 | | { |
| 123 | | return m_exrom; |
| 180 | if (m_nmi && (offset == 0xfffa || offset == 0xfffb)) |
| 181 | { |
| 182 | m_a0 = 1; |
| 183 | } |
| 124 | 184 | } |
| 125 | 185 | |
| 126 | 186 | |
| r25384 | r25385 | |
| 130 | 190 | |
| 131 | 191 | int c64_partner_cartridge_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw) |
| 132 | 192 | { |
| 133 | | return m_game; |
| 193 | int game = 1; |
| 194 | |
| 195 | if (m_a0 && BIT(offset, 15)) |
| 196 | { |
| 197 | switch ((offset >> 13) & 0x03) |
| 198 | { |
| 199 | case 0: case 1: case 3: |
| 200 | game = 0; |
| 201 | break; |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | // TODO if I/O1=0, GAME=0 |
| 206 | |
| 207 | return game; |
| 134 | 208 | } |
trunk/src/mess/machine/c64/partner.h
| r25384 | r25385 | |
| 33 | 33 | // optional information overrides |
| 34 | 34 | virtual ioport_constructor device_input_ports() const; |
| 35 | 35 | |
| 36 | DECLARE_WRITE_LINE_MEMBER( nmi_w ); |
| 37 | |
| 36 | 38 | protected: |
| 37 | 39 | // device-level overrides |
| 38 | 40 | virtual void device_start(); |
| r25384 | r25385 | |
| 41 | 43 | // device_c64_expansion_card_interface overrides |
| 42 | 44 | 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); |
| 43 | 45 | 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); |
| 44 | | virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw); |
| 45 | 46 | virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw); |
| 47 | |
| 48 | private: |
| 49 | int m_a0; |
| 50 | int m_a6; |
| 51 | int m_nmi; |
| 46 | 52 | }; |
| 47 | 53 | |
| 48 | 54 | |