trunk/src/mess/machine/c1551.c
r17398 | r17399 | |
11 | 11 | |
12 | 12 | TODO: |
13 | 13 | |
14 | | - paddle expansion port passthru |
15 | 14 | - byte latching does not match hardware behavior |
16 | 15 | (CPU skips data bytes if implemented per schematics) |
17 | 16 | |
18 | 17 | */ |
19 | 18 | |
20 | | #include "c1541.h" |
21 | 19 | #include "c1551.h" |
22 | 20 | |
23 | 21 | |
r17398 | r17399 | |
32 | 30 | #define C64H156_TAG "u6" |
33 | 31 | #define PLA_TAG "u1" |
34 | 32 | |
| 33 | |
35 | 34 | enum |
36 | 35 | { |
37 | 36 | LED_POWER = 0, |
r17398 | r17399 | |
368 | 367 | |
369 | 368 | |
370 | 369 | //------------------------------------------------- |
| 370 | // PLUS4_EXPANSION_INTERFACE( expansion_intf ) |
| 371 | //------------------------------------------------- |
| 372 | |
| 373 | READ8_MEMBER( c1551_device::exp_dma_r ) |
| 374 | { |
| 375 | return m_slot->dma_cd_r(offset); |
| 376 | } |
| 377 | |
| 378 | WRITE8_MEMBER( c1551_device::exp_dma_w ) |
| 379 | { |
| 380 | m_slot->dma_cd_w(offset, data); |
| 381 | } |
| 382 | |
| 383 | WRITE_LINE_MEMBER( c1551_device::exp_irq_w ) |
| 384 | { |
| 385 | m_slot->irq_w(state); |
| 386 | } |
| 387 | |
| 388 | WRITE_LINE_MEMBER( c1551_device::exp_aec_w ) |
| 389 | { |
| 390 | m_slot->aec_w(state); |
| 391 | } |
| 392 | |
| 393 | static PLUS4_EXPANSION_INTERFACE( expansion_intf ) |
| 394 | { |
| 395 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1551_device, exp_dma_r), |
| 396 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1551_device, exp_dma_w), |
| 397 | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1551_device, exp_irq_w), |
| 398 | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1551_device, exp_aec_w) |
| 399 | }; |
| 400 | |
| 401 | |
| 402 | //------------------------------------------------- |
371 | 403 | // MACHINE_DRIVER( c1551 ) |
372 | 404 | //------------------------------------------------- |
373 | 405 | |
r17398 | r17399 | |
383 | 415 | |
384 | 416 | MCFG_LEGACY_FLOPPY_DRIVE_ADD(FLOPPY_0, c1541_floppy_interface) |
385 | 417 | MCFG_64H156_ADD(C64H156_TAG, XTAL_16MHz, ga_intf) |
| 418 | |
| 419 | MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, 0, expansion_intf, plus4_expansion_cards, NULL, NULL) |
386 | 420 | MACHINE_CONFIG_END |
387 | 421 | |
388 | 422 | |
r17398 | r17399 | |
437 | 471 | m_ga(*this, C64H156_TAG), |
438 | 472 | m_pla(*this, PLA_TAG), |
439 | 473 | m_image(*this, FLOPPY_0), |
| 474 | m_exp(*this, PLUS4_EXPANSION_SLOT_TAG), |
440 | 475 | m_tcbm_data(0xff), |
441 | 476 | m_status(1), |
442 | 477 | m_dav(1), |
r17398 | r17399 | |
465 | 500 | save_item(NAME(m_status)); |
466 | 501 | save_item(NAME(m_dav)); |
467 | 502 | save_item(NAME(m_ack)); |
| 503 | save_item(NAME(m_dev)); |
468 | 504 | } |
469 | 505 | |
470 | 506 | |
r17398 | r17399 | |
537 | 573 | |
538 | 574 | UINT8 c1551_device::plus4_cd_r(address_space &space, offs_t offset, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) |
539 | 575 | { |
540 | | UINT8 data = 0; |
| 576 | UINT8 data = m_exp->cd_r(space, offset, ba, cs0, c1l, c2l, cs1, c1h, c2h); |
541 | 577 | |
542 | 578 | if (tpi1_selected(offset)) |
543 | 579 | { |
r17398 | r17399 | |
558 | 594 | { |
559 | 595 | tpi6525_w(m_tpi1, offset & 0x07, data); |
560 | 596 | } |
| 597 | |
| 598 | m_exp->cd_w(space, offset, data, ba, cs0, c1l, c2l, cs1, c1h, c2h); |
561 | 599 | } |
562 | 600 | |
563 | 601 | |
564 | 602 | //------------------------------------------------- |
| 603 | // plus4_screen_update - screen update |
| 604 | //------------------------------------------------- |
| 605 | |
| 606 | UINT32 c1551_device::plus4_screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 607 | { |
| 608 | return m_exp->screen_update(screen, bitmap, cliprect); |
| 609 | } |
| 610 | |
| 611 | |
| 612 | //------------------------------------------------- |
565 | 613 | // plus4_breset_w - buffered reset write |
566 | 614 | //------------------------------------------------- |
567 | 615 | |
r17398 | r17399 | |
571 | 619 | { |
572 | 620 | device_reset(); |
573 | 621 | } |
| 622 | |
| 623 | m_exp->breset_w(state); |
574 | 624 | } |
575 | 625 | |
576 | 626 | |
trunk/src/mess/machine/c1551.h
r17398 | r17399 | |
20 | 20 | #include "formats/g64_dsk.h" |
21 | 21 | #include "machine/64h156.h" |
22 | 22 | #include "machine/6525tpi.h" |
| 23 | #include "machine/c1541.h" |
| 24 | #include "machine/cbmipt.h" |
23 | 25 | #include "machine/pls100.h" |
24 | 26 | #include "machine/plus4exp.h" |
25 | 27 | |
r17398 | r17399 | |
48 | 50 | |
49 | 51 | DECLARE_READ8_MEMBER( port_r ); |
50 | 52 | DECLARE_WRITE8_MEMBER( port_w ); |
| 53 | |
51 | 54 | DECLARE_READ8_MEMBER( tcbm_data_r ); |
52 | 55 | DECLARE_WRITE8_MEMBER( tcbm_data_w ); |
53 | 56 | DECLARE_READ8_MEMBER( yb_r ); |
54 | 57 | DECLARE_WRITE8_MEMBER( yb_w ); |
55 | 58 | DECLARE_READ8_MEMBER( tpi0_pc_r ); |
56 | 59 | DECLARE_WRITE8_MEMBER( tpi0_pc_w ); |
| 60 | |
57 | 61 | DECLARE_READ8_MEMBER( tpi1_pa_r ); |
58 | 62 | DECLARE_WRITE8_MEMBER( tpi1_pa_w ); |
59 | 63 | DECLARE_READ8_MEMBER( tpi1_pb_r ); |
60 | 64 | DECLARE_READ8_MEMBER( tpi1_pc_r ); |
61 | 65 | DECLARE_WRITE8_MEMBER( tpi1_pc_w ); |
62 | 66 | |
| 67 | DECLARE_READ8_MEMBER( exp_dma_r ); |
| 68 | DECLARE_WRITE8_MEMBER( exp_dma_w ); |
| 69 | DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); |
| 70 | DECLARE_WRITE_LINE_MEMBER( exp_aec_w ); |
| 71 | |
63 | 72 | protected: |
64 | 73 | // device-level overrides |
65 | 74 | virtual void device_config_complete() { m_shortname = "c1551"; } |
r17398 | r17399 | |
70 | 79 | // device_plus4_expansion_card_interface overrides |
71 | 80 | virtual UINT8 plus4_cd_r(address_space &space, offs_t offset, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h); |
72 | 81 | virtual void 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); |
| 82 | virtual UINT32 plus4_screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
73 | 83 | virtual void plus4_breset_w(int state); |
74 | 84 | |
75 | 85 | private: |
r17398 | r17399 | |
81 | 91 | required_device<c64h156_device> m_ga; |
82 | 92 | required_device<pls100_device> m_pla; |
83 | 93 | required_device<legacy_floppy_image_device> m_image; |
| 94 | required_device<plus4_expansion_slot_device> m_exp; |
84 | 95 | |
85 | 96 | // TCBM bus |
86 | 97 | UINT8 m_tcbm_data; // data |