trunk/src/mess/machine/c1551.c
r17380 | r17381 | |
11 | 11 | |
12 | 12 | TODO: |
13 | 13 | |
| 14 | - paddle expansion port passthru |
14 | 15 | - byte latching does not match hardware behavior |
15 | 16 | (CPU skips data bytes if implemented per schematics) |
16 | 17 | |
r17380 | r17381 | |
101 | 102 | return data; |
102 | 103 | } |
103 | 104 | |
104 | | |
105 | 105 | WRITE8_MEMBER( c1551_device::port_w ) |
106 | 106 | { |
107 | 107 | /* |
r17380 | r17381 | |
132 | 132 | m_ga->ds_w((data >> 5) & 0x03); |
133 | 133 | } |
134 | 134 | |
135 | | |
136 | 135 | static const m6502_interface m6510t_intf = |
137 | 136 | { |
138 | 137 | NULL, // read_indexed_func |
r17380 | r17381 | |
166 | 165 | return m_tcbm_data; |
167 | 166 | } |
168 | 167 | |
169 | | |
170 | 168 | WRITE8_MEMBER( c1551_device::tcbm_data_w ) |
171 | 169 | { |
172 | 170 | /* |
r17380 | r17381 | |
187 | 185 | m_tcbm_data = data; |
188 | 186 | } |
189 | 187 | |
190 | | |
191 | 188 | READ8_MEMBER( c1551_device::tpi0_pc_r ) |
192 | 189 | { |
193 | 190 | /* |
r17380 | r17381 | |
219 | 216 | return data; |
220 | 217 | } |
221 | 218 | |
222 | | |
223 | 219 | WRITE8_MEMBER( c1551_device::tpi0_pc_w ) |
224 | 220 | { |
225 | 221 | /* |
r17380 | r17381 | |
250 | 246 | m_ga->oe_w(BIT(data, 4)); |
251 | 247 | } |
252 | 248 | |
253 | | |
254 | 249 | static const tpi6525_interface tpi0_intf = |
255 | 250 | { |
256 | 251 | DEVCB_NULL, |
r17380 | r17381 | |
289 | 284 | return m_status & 0x03; |
290 | 285 | } |
291 | 286 | |
292 | | |
293 | 287 | READ8_MEMBER( c1551_device::tpi1_pc_r ) |
294 | 288 | { |
295 | 289 | /* |
r17380 | r17381 | |
315 | 309 | return data; |
316 | 310 | } |
317 | 311 | |
318 | | |
319 | 312 | WRITE8_MEMBER( c1551_device::tpi1_pc_w ) |
320 | 313 | { |
321 | 314 | /* |
r17380 | r17381 | |
337 | 330 | m_dav = BIT(data, 6); |
338 | 331 | } |
339 | 332 | |
340 | | |
341 | 333 | static const tpi6525_interface tpi1_intf = |
342 | 334 | { |
343 | 335 | DEVCB_NULL, |
r17380 | r17381 | |
443 | 435 | m_tpi0(*this, M6523_0_TAG), |
444 | 436 | m_tpi1(*this, M6523_1_TAG), |
445 | 437 | m_ga(*this, C64H156_TAG), |
| 438 | m_pla(*this, PLA_TAG), |
446 | 439 | m_image(*this, FLOPPY_0), |
447 | 440 | m_tcbm_data(0xff), |
448 | 441 | m_status(1), |
r17380 | r17381 | |
515 | 508 | |
516 | 509 | |
517 | 510 | //------------------------------------------------- |
| 511 | // tpi1_selected - |
| 512 | //------------------------------------------------- |
| 513 | |
| 514 | bool c1551_device::tpi1_selected(offs_t offset) |
| 515 | { |
| 516 | #ifdef PLA_DUMPED |
| 517 | int mux = 0, ras = 0, phi0 = 0, f7 = 0; |
| 518 | UINT16 input = A5 << 15 | A6 << 14 | A7 << 13 | A8 << 12 | A9 << 11 | mux << 10 | A10 << 9 | m_dev << 8 | ras << 7 | phi0 << 6 | A15 << 5 | A14 << 4 | A13 << 3 | A12 << 2 | A11 << 1 | f7; |
| 519 | UINT8 data = m_pla->read(input); |
| 520 | return BIT(data, 0) ? true : false; |
| 521 | #endif |
| 522 | |
| 523 | offs_t start_address = m_dev ? 0xfee0 : 0xfec0; |
| 524 | |
| 525 | if (offset >= start_address && offset < (start_address + 0x20)) |
| 526 | { |
| 527 | return true; |
| 528 | } |
| 529 | |
| 530 | return false; |
| 531 | } |
| 532 | |
| 533 | |
| 534 | //------------------------------------------------- |
518 | 535 | // plus4_cd_r - cartridge data read |
519 | 536 | //------------------------------------------------- |
520 | 537 | |
r17380 | r17381 | |
522 | 539 | { |
523 | 540 | UINT8 data = 0; |
524 | 541 | |
525 | | offs_t start_address = m_dev ? 0xfef0 : 0xfec0; |
526 | | |
527 | | if (offset >= start_address && offset < (start_address + 8)) |
| 542 | if (tpi1_selected(offset)) |
528 | 543 | { |
529 | 544 | data = tpi6525_r(m_tpi1, offset & 0x07); |
530 | 545 | } |
r17380 | r17381 | |
539 | 554 | |
540 | 555 | void c1551_device::plus4_cd_w(address_space &space, offs_t offset, UINT8 data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) |
541 | 556 | { |
542 | | offs_t start_address = m_dev ? 0xfef0 : 0xfec0; |
543 | | |
544 | | if (offset >= start_address && offset < (start_address + 8)) |
| 557 | if (tpi1_selected(offset)) |
545 | 558 | { |
546 | 559 | tpi6525_w(m_tpi1, offset & 0x07, data); |
547 | 560 | } |