trunk/src/mess/drivers/pet.c
| r21328 | r21329 | |
| 213 | 213 | int norom = m_exp->norom_r(space, offset, sel); |
| 214 | 214 | UINT8 data = 0; |
| 215 | 215 | |
| 216 | data = m_exp->read(space, offset, data, sel); |
| 217 | |
| 216 | 218 | switch (sel) |
| 217 | 219 | { |
| 218 | 220 | case SEL0: case SEL1: case SEL2: case SEL3: case SEL4: case SEL5: case SEL6: case SEL7: |
| r21328 | r21329 | |
| 260 | 262 | break; |
| 261 | 263 | } |
| 262 | 264 | |
| 263 | | return m_exp->read(space, offset, data, sel); |
| 265 | return data; |
| 264 | 266 | } |
| 265 | 267 | |
| 266 | 268 | |
| r21328 | r21329 | |
| 272 | 274 | { |
| 273 | 275 | int sel = offset >> 12; |
| 274 | 276 | |
| 277 | m_exp->write(space, offset, data, sel); |
| 278 | |
| 275 | 279 | switch (sel) |
| 276 | 280 | { |
| 277 | 281 | case SEL0: case SEL1: case SEL2: case SEL3: case SEL4: case SEL5: case SEL6: case SEL7: |
| r21328 | r21329 | |
| 314 | 318 | } |
| 315 | 319 | break; |
| 316 | 320 | } |
| 317 | | |
| 318 | | m_exp->write(space, offset, data, sel); |
| 319 | 321 | } |
| 320 | 322 | |
| 321 | 323 | |
trunk/src/mess/machine/superpet.h
| r21328 | r21329 | |
| 52 | 52 | |
| 53 | 53 | // device_pet_expansion_card_interface overrides |
| 54 | 54 | virtual int pet_norom_r(address_space &space, offs_t offset, int sel); |
| 55 | | virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel); |
| 56 | | virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel); |
| 55 | virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int &sel); |
| 56 | virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int &sel); |
| 57 | 57 | virtual int pet_diag_r(); |
| 58 | 58 | virtual void pet_irq_w(int state); |
| 59 | 59 | |
trunk/src/mess/machine/petexp.c
| r21328 | r21329 | |
| 114 | 114 | // read - buffered data read |
| 115 | 115 | //------------------------------------------------- |
| 116 | 116 | |
| 117 | | UINT8 pet_expansion_slot_device::read(address_space &space, offs_t offset, UINT8 data, int sel) |
| 117 | UINT8 pet_expansion_slot_device::read(address_space &space, offs_t offset, UINT8 data, int &sel) |
| 118 | 118 | { |
| 119 | 119 | if (m_card != NULL) |
| 120 | 120 | { |
| r21328 | r21329 | |
| 129 | 129 | // write - buffered data write |
| 130 | 130 | //------------------------------------------------- |
| 131 | 131 | |
| 132 | | void pet_expansion_slot_device::write(address_space &space, offs_t offset, UINT8 data, int sel) |
| 132 | void pet_expansion_slot_device::write(address_space &space, offs_t offset, UINT8 data, int &sel) |
| 133 | 133 | { |
| 134 | 134 | if (m_card != NULL) |
| 135 | 135 | { |
trunk/src/mess/machine/petexp.h
| r21328 | r21329 | |
| 63 | 63 | |
| 64 | 64 | // computer interface |
| 65 | 65 | int norom_r(address_space &space, offs_t offset, int sel); |
| 66 | | UINT8 read(address_space &space, offs_t offset, UINT8 data, int sel); |
| 67 | | void write(address_space &space, offs_t offset, UINT8 data, int sel); |
| 66 | UINT8 read(address_space &space, offs_t offset, UINT8 data, int &sel); |
| 67 | void write(address_space &space, offs_t offset, UINT8 data, int &sel); |
| 68 | 68 | DECLARE_READ_LINE_MEMBER( diag_r ); |
| 69 | 69 | DECLARE_WRITE_LINE_MEMBER( irq_w ); |
| 70 | 70 | |
| r21328 | r21329 | |
| 75 | 75 | |
| 76 | 76 | enum |
| 77 | 77 | { |
| 78 | SEL_NONE = -1, |
| 78 | 79 | SEL0 = 0, |
| 79 | 80 | SEL1, |
| 80 | 81 | SEL2, |
| r21328 | r21329 | |
| 119 | 120 | protected: |
| 120 | 121 | // runtime |
| 121 | 122 | virtual int pet_norom_r(address_space &space, offs_t offset, int sel) { return 1; } |
| 122 | | virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel) { return data; }; |
| 123 | | virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel) { }; |
| 123 | virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int &sel) { return data; }; |
| 124 | virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int &sel) { }; |
| 124 | 125 | virtual int pet_diag_r() { return 1; } |
| 125 | 126 | virtual void pet_irq_w(int state) { } |
| 126 | 127 | |
trunk/src/mess/machine/pet_64k.c
| r21328 | r21329 | |
| 123 | 123 | // pet_bd_r - buffered data read |
| 124 | 124 | //------------------------------------------------- |
| 125 | 125 | |
| 126 | | UINT8 pet_64k_expansion_device::pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel) |
| 126 | UINT8 pet_64k_expansion_device::pet_bd_r(address_space &space, offs_t offset, UINT8 data, int &sel) |
| 127 | 127 | { |
| 128 | 128 | if (BIT(m_ctrl, 7)) |
| 129 | 129 | { |
| r21328 | r21329 | |
| 133 | 133 | if (!BIT(m_ctrl, 5)) |
| 134 | 134 | { |
| 135 | 135 | data = read_ram(offset); |
| 136 | sel = pet_expansion_slot_device::SEL_NONE; |
| 136 | 137 | } |
| 137 | 138 | break; |
| 138 | 139 | |
| r21328 | r21329 | |
| 140 | 141 | if (!BIT(m_ctrl, 6) || !BIT(offset, 11)) |
| 141 | 142 | { |
| 142 | 143 | data = read_ram(offset); |
| 144 | sel = pet_expansion_slot_device::SEL_NONE; |
| 143 | 145 | } |
| 144 | 146 | break; |
| 145 | 147 | |
| r21328 | r21329 | |
| 162 | 164 | // pet_bd_w - buffered data write |
| 163 | 165 | //------------------------------------------------- |
| 164 | 166 | |
| 165 | | void pet_64k_expansion_device::pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel) |
| 167 | void pet_64k_expansion_device::pet_bd_w(address_space &space, offs_t offset, UINT8 data, int &sel) |
| 166 | 168 | { |
| 167 | 169 | if (BIT(m_ctrl, 7)) |
| 168 | 170 | { |
| r21328 | r21329 | |
| 172 | 174 | if (!BIT(m_ctrl, 5)) |
| 173 | 175 | { |
| 174 | 176 | write_ram(offset, data); |
| 177 | sel = pet_expansion_slot_device::SEL_NONE; |
| 175 | 178 | } |
| 176 | 179 | break; |
| 177 | 180 | |
| r21328 | r21329 | |
| 179 | 182 | if (!BIT(m_ctrl, 6) || !BIT(offset, 11)) |
| 180 | 183 | { |
| 181 | 184 | write_ram(offset, data); |
| 185 | sel = pet_expansion_slot_device::SEL_NONE; |
| 182 | 186 | } |
| 183 | 187 | break; |
| 184 | 188 | |
| r21328 | r21329 | |
| 195 | 199 | |
| 196 | 200 | if (offset == 0xfff0) |
| 197 | 201 | { |
| 198 | | printf("CTRL %02x\n", data); |
| 199 | 202 | m_ctrl = data; |
| 200 | 203 | } |
| 201 | 204 | } |
trunk/src/mess/machine/pet_64k.h
| r21328 | r21329 | |
| 38 | 38 | |
| 39 | 39 | // device_pet_expansion_card_interface overrides |
| 40 | 40 | virtual int pet_norom_r(address_space &space, offs_t offset, int sel); |
| 41 | | virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel); |
| 42 | | virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel); |
| 41 | virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int &sel); |
| 42 | virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int &sel); |
| 43 | 43 | |
| 44 | 44 | private: |
| 45 | 45 | inline UINT8 read_ram(offs_t offset); |
trunk/src/mess/machine/superpet.c
| r21328 | r21329 | |
| 250 | 250 | // pet_bd_r - buffered data read |
| 251 | 251 | //------------------------------------------------- |
| 252 | 252 | |
| 253 | | UINT8 superpet_device::pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel) |
| 253 | UINT8 superpet_device::pet_bd_r(address_space &space, offs_t offset, UINT8 data, int &sel) |
| 254 | 254 | { |
| 255 | 255 | int norom = pet_norom_r(space, offset, sel); |
| 256 | 256 | |
| r21328 | r21329 | |
| 311 | 311 | // pet_bd_w - buffered data write |
| 312 | 312 | //------------------------------------------------- |
| 313 | 313 | |
| 314 | | void superpet_device::pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel) |
| 314 | void superpet_device::pet_bd_w(address_space &space, offs_t offset, UINT8 data, int &sel) |
| 315 | 315 | { |
| 316 | 316 | switch (sel) |
| 317 | 317 | { |