trunk/src/mess/machine/concept.c
| r18043 | r18044 | |
| 62 | 62 | |
| 63 | 63 | /* Expansion slots */ |
| 64 | 64 | |
| 65 | | static void concept_fdc_init(running_machine &machine, int slot); |
| 66 | | static void concept_hdc_init(running_machine &machine, int slot); |
| 67 | | |
| 68 | 65 | void concept_state::machine_start() |
| 69 | 66 | { |
| 70 | 67 | /* initialize int state */ |
| r18043 | r18044 | |
| 80 | 77 | /* initialize expansion slots */ |
| 81 | 78 | memset(m_expansion_slots, 0, sizeof(m_expansion_slots)); |
| 82 | 79 | |
| 83 | | concept_hdc_init(machine(), 1); /* Flat cable Hard Disk Controller in Slot 2 */ |
| 84 | | concept_fdc_init(machine(), 2); /* Floppy Disk Controller in Slot 3 */ |
| 80 | concept_hdc_init(1); /* Flat cable Hard Disk Controller in Slot 2 */ |
| 81 | concept_fdc_init(2); /* Floppy Disk Controller in Slot 3 */ |
| 85 | 82 | } |
| 86 | 83 | |
| 87 | | static void install_expansion_slot(running_machine &machine, int slot, |
| 88 | | read8_space_func reg_read, write8_space_func reg_write, |
| 89 | | read8_space_func rom_read, write8_space_func rom_write) |
| 84 | void concept_state::install_expansion_slot( int slot, |
| 85 | read8_delegate reg_read, write8_delegate reg_write, |
| 86 | read8_delegate rom_read, write8_delegate rom_write) |
| 90 | 87 | { |
| 91 | | concept_state *state = machine.driver_data<concept_state>(); |
| 92 | | state->m_expansion_slots[slot].reg_read = reg_read; |
| 93 | | state->m_expansion_slots[slot].reg_write = reg_write; |
| 94 | | state->m_expansion_slots[slot].rom_read = rom_read; |
| 95 | | state->m_expansion_slots[slot].rom_write = rom_write; |
| 88 | m_expansion_slots[slot].reg_read = reg_read; |
| 89 | m_expansion_slots[slot].reg_write = reg_write; |
| 90 | m_expansion_slots[slot].rom_read = rom_read; |
| 91 | m_expansion_slots[slot].rom_write = rom_write; |
| 96 | 92 | } |
| 97 | 93 | |
| 98 | 94 | void concept_state::video_start() |
| r18043 | r18044 | |
| 274 | 270 | /* IO4 registers */ |
| 275 | 271 | { |
| 276 | 272 | int slot = ((offset >> 4) & 7) - 1; |
| 277 | | if (m_expansion_slots[slot].reg_read) |
| 273 | if (!m_expansion_slots[slot].reg_read.isnull()) |
| 278 | 274 | return m_expansion_slots[slot].reg_read(space, offset & 0xf, mem_mask); |
| 279 | 275 | } |
| 280 | 276 | break; |
| r18043 | r18044 | |
| 297 | 293 | { |
| 298 | 294 | int slot = ((offset >> 8) & 7) - 1; |
| 299 | 295 | LOG(("concept_io_r: Slot ROM memory accessed for slot %d at address 0x03%4.4x\n", slot, offset << 1)); |
| 300 | | if (m_expansion_slots[slot].rom_read) |
| 296 | if (!m_expansion_slots[slot].rom_read.isnull()) |
| 301 | 297 | return m_expansion_slots[slot].rom_read(space, offset & 0xff, mem_mask); |
| 302 | 298 | } |
| 303 | 299 | break; |
| r18043 | r18044 | |
| 416 | 412 | int slot = ((offset >> 4) & 7) - 1; |
| 417 | 413 | LOG(("concept_io_w: Slot I/O register written for slot %d at address 0x03%4.4x, data: 0x%4.4x\n", |
| 418 | 414 | slot, offset << 1, data)); |
| 419 | | if (m_expansion_slots[slot].reg_write) |
| 415 | if (!m_expansion_slots[slot].reg_write.isnull()) |
| 420 | 416 | m_expansion_slots[slot].reg_write(space, offset & 0xf, data, mem_mask); |
| 421 | 417 | } |
| 422 | 418 | break; |
| r18043 | r18044 | |
| 439 | 435 | { |
| 440 | 436 | int slot = ((offset >> 8) & 7) - 1; |
| 441 | 437 | LOG(("concept_io_w: Slot ROM memory written to for slot %d at address 0x03%4.4x, data: 0x%4.4x\n", slot, offset << 1, data)); |
| 442 | | if (m_expansion_slots[slot].rom_write) |
| 438 | if (!m_expansion_slots[slot].rom_write.isnull()) |
| 443 | 439 | m_expansion_slots[slot].rom_write(space, offset & 0xff, data, mem_mask); |
| 444 | 440 | } |
| 445 | 441 | break; |
| r18043 | r18044 | |
| 547 | 543 | }; |
| 548 | 544 | |
| 549 | 545 | |
| 550 | | static DECLARE_READ8_HANDLER(concept_fdc_reg_r); |
| 551 | | static DECLARE_WRITE8_HANDLER(concept_fdc_reg_w); |
| 552 | | static DECLARE_READ8_HANDLER(concept_fdc_rom_r); |
| 553 | | |
| 554 | | static void concept_fdc_init(running_machine &machine, int slot) |
| 546 | void concept_state::concept_fdc_init(int slot) |
| 555 | 547 | { |
| 556 | | concept_state *state = machine.driver_data<concept_state>(); |
| 557 | | state->m_fdc_local_status = 0; |
| 558 | | state->m_fdc_local_command = 0; |
| 548 | m_fdc_local_status = 0; |
| 549 | m_fdc_local_command = 0; |
| 559 | 550 | |
| 560 | | install_expansion_slot(machine, slot, concept_fdc_reg_r, concept_fdc_reg_w, concept_fdc_rom_r, NULL); |
| 551 | install_expansion_slot(slot, read8_delegate(FUNC(concept_state::concept_fdc_reg_r),this), write8_delegate(FUNC(concept_state::concept_fdc_reg_w),this), read8_delegate(FUNC(concept_state::concept_fdc_rom_r),this), write8_delegate()); |
| 561 | 552 | } |
| 562 | 553 | |
| 563 | 554 | static WRITE_LINE_DEVICE_HANDLER( concept_fdc_intrq_w ) |
| r18043 | r18044 | |
| 586 | 577 | {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3} |
| 587 | 578 | }; |
| 588 | 579 | |
| 589 | | static READ8_HANDLER(concept_fdc_reg_r) |
| 580 | READ8_MEMBER(concept_state::concept_fdc_reg_r) |
| 590 | 581 | { |
| 591 | | concept_state *state = space.machine().driver_data<concept_state>(); |
| 592 | | device_t *fdc = space.machine().device("wd179x"); |
| 582 | device_t *fdc = machine().device("wd179x"); |
| 593 | 583 | switch (offset) |
| 594 | 584 | { |
| 595 | 585 | case 0: |
| 596 | 586 | /* local Status reg */ |
| 597 | | return state->m_fdc_local_status; |
| 587 | return m_fdc_local_status; |
| 598 | 588 | |
| 599 | 589 | case 8: |
| 600 | 590 | /* FDC STATUS REG */ |
| r18043 | r18044 | |
| 616 | 606 | return 0; |
| 617 | 607 | } |
| 618 | 608 | |
| 619 | | static WRITE8_HANDLER(concept_fdc_reg_w) |
| 609 | WRITE8_MEMBER(concept_state::concept_fdc_reg_w) |
| 620 | 610 | { |
| 621 | | concept_state *state = space.machine().driver_data<concept_state>(); |
| 622 | 611 | int current_drive; |
| 623 | | device_t *fdc = space.machine().device("wd179x"); |
| 612 | device_t *fdc = machine().device("wd179x"); |
| 624 | 613 | switch (offset) |
| 625 | 614 | { |
| 626 | 615 | case 0: |
| 627 | 616 | /* local command reg */ |
| 628 | | state->m_fdc_local_command = data; |
| 617 | m_fdc_local_command = data; |
| 629 | 618 | |
| 630 | 619 | wd17xx_set_side(fdc,(data & LC_FLPSD1_mask) != 0); |
| 631 | 620 | current_drive = ((data >> LC_DE0_bit) & 1) | ((data >> (LC_DE1_bit-1)) & 2); |
| r18043 | r18044 | |
| 634 | 623 | // floppy_drive_set_motor_state(floppy_get_device(machine, current_drive), (data & LC_MOTOROF_mask) == 0 ? 1 : 0); |
| 635 | 624 | /*flp_8in = (data & LC_FLP8IN_mask) != 0;*/ |
| 636 | 625 | wd17xx_dden_w(fdc, BIT(data, 7)); |
| 637 | | floppy_drive_set_ready_state(floppy_get_device(space.machine(), current_drive), 1, 0); |
| 626 | floppy_drive_set_ready_state(floppy_get_device(machine(), current_drive), 1, 0); |
| 638 | 627 | break; |
| 639 | 628 | |
| 640 | 629 | case 8: |
| r18043 | r18044 | |
| 659 | 648 | } |
| 660 | 649 | } |
| 661 | 650 | |
| 662 | | static READ8_HANDLER(concept_fdc_rom_r) |
| 651 | READ8_MEMBER(concept_state::concept_fdc_rom_r) |
| 663 | 652 | { |
| 664 | 653 | static const UINT8 data[] = "CORVUS01"; |
| 665 | 654 | return (offset < 8) ? data[offset] : 0; |
| r18043 | r18044 | |
| 669 | 658 | * Concept Hard Disk Controller (hdc) |
| 670 | 659 | */ |
| 671 | 660 | |
| 672 | | static DECLARE_READ8_HANDLER(concept_hdc_reg_r); |
| 673 | | static DECLARE_WRITE8_HANDLER(concept_hdc_reg_w); |
| 674 | | static DECLARE_READ8_HANDLER(concept_hdc_rom_r); |
| 675 | | |
| 676 | 661 | /* |
| 677 | 662 | * Hook up the Register and ROM R/W routines into the Slot I/O Space |
| 678 | 663 | */ |
| 679 | 664 | |
| 680 | | static void concept_hdc_init(running_machine &machine, int slot) |
| 665 | void concept_state::concept_hdc_init(int slot) |
| 681 | 666 | { |
| 682 | | if(corvus_hdc_init(machine)) |
| 683 | | install_expansion_slot(machine, slot, concept_hdc_reg_r, concept_hdc_reg_w, concept_hdc_rom_r, NULL); |
| 667 | if(corvus_hdc_init(machine())) |
| 668 | install_expansion_slot(slot, read8_delegate(FUNC(concept_state::concept_hdc_reg_r),this), write8_delegate(FUNC(concept_state::concept_hdc_reg_w),this), read8_delegate(FUNC(concept_state::concept_hdc_rom_r),this), write8_delegate()); |
| 684 | 669 | } |
| 685 | 670 | |
| 686 | 671 | /* |
| 687 | 672 | * Handle reads against the Hard Disk Controller's onboard registers |
| 688 | 673 | */ |
| 689 | | static READ8_HANDLER(concept_hdc_reg_r) |
| 674 | READ8_MEMBER(concept_state::concept_hdc_reg_r) |
| 690 | 675 | { |
| 691 | 676 | switch (offset) |
| 692 | 677 | { |
| r18043 | r18044 | |
| 705 | 690 | /* |
| 706 | 691 | * Handle writes against the Hard Disk Controller's onboard registers |
| 707 | 692 | */ |
| 708 | | static WRITE8_HANDLER(concept_hdc_reg_w) |
| 693 | WRITE8_MEMBER(concept_state::concept_hdc_reg_w) |
| 709 | 694 | { |
| 710 | 695 | switch (offset) |
| 711 | 696 | { |
| r18043 | r18044 | |
| 719 | 704 | /* |
| 720 | 705 | * Handle reads agsint the Hard Disk Controller's onboard ROM |
| 721 | 706 | */ |
| 722 | | static READ8_HANDLER(concept_hdc_rom_r) |
| 707 | READ8_MEMBER(concept_state::concept_hdc_rom_r) |
| 723 | 708 | { |
| 724 | 709 | static const UINT8 data[8] = { 0xa9, 0x20, 0xa9, 0x00, 0xa9, 0x03, 0xa9, 0x3c }; /* Same as Apple II */ |
| 725 | 710 | return (offset < 8) ? data[offset] : 0; |
trunk/src/mess/includes/concept.h
| r18043 | r18044 | |
| 23 | 23 | |
| 24 | 24 | struct expansion_slot_t |
| 25 | 25 | { |
| 26 | | read8_space_func reg_read; |
| 27 | | write8_space_func reg_write; |
| 28 | | read8_space_func rom_read; |
| 29 | | write8_space_func rom_write; |
| 26 | read8_delegate reg_read; |
| 27 | write8_delegate reg_write; |
| 28 | read8_delegate rom_read; |
| 29 | write8_delegate rom_write; |
| 30 | 30 | }; |
| 31 | 31 | |
| 32 | 32 | |
| r18043 | r18044 | |
| 50 | 50 | expansion_slot_t m_expansion_slots[4]; |
| 51 | 51 | DECLARE_READ16_MEMBER(concept_io_r); |
| 52 | 52 | DECLARE_WRITE16_MEMBER(concept_io_w); |
| 53 | | DECLARE_WRITE8_MEMBER(concept_fdc_reg_w); |
| 54 | | DECLARE_READ8_MEMBER(concept_hdc_reg_r); |
| 55 | | DECLARE_WRITE8_MEMBER(concept_hdc_reg_w); |
| 56 | 53 | virtual void machine_start(); |
| 57 | 54 | virtual void video_start(); |
| 58 | 55 | UINT32 screen_update_concept(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 59 | 56 | INTERRUPT_GEN_MEMBER(concept_interrupt); |
| 57 | |
| 58 | void install_expansion_slot(int slot, |
| 59 | read8_delegate reg_read, write8_delegate reg_write, |
| 60 | read8_delegate rom_read, write8_delegate rom_write); |
| 61 | |
| 62 | void concept_fdc_init(int slot); |
| 63 | void concept_hdc_init(int slot); |
| 64 | |
| 65 | DECLARE_READ8_MEMBER(concept_fdc_reg_r); |
| 66 | DECLARE_WRITE8_MEMBER(concept_fdc_reg_w); |
| 67 | DECLARE_READ8_MEMBER(concept_fdc_rom_r); |
| 68 | |
| 69 | DECLARE_READ8_MEMBER(concept_hdc_reg_r); |
| 70 | DECLARE_WRITE8_MEMBER(concept_hdc_reg_w); |
| 71 | DECLARE_READ8_MEMBER(concept_hdc_rom_r); |
| 60 | 72 | }; |
| 61 | 73 | |
| 62 | 74 | |