trunk/src/mame/drivers/bfm_sc4h.c
| r26390 | r26391 | |
| 213 | 213 | if ((offset>=base) && (offset<end)) |
| 214 | 214 | { |
| 215 | 215 | offset-=base; |
| 216 | | return duart68681_r(m_duart,space,offset); |
| 216 | return m_duart->read(space,offset); |
| 217 | 217 | } |
| 218 | 218 | else |
| 219 | 219 | { |
| r26390 | r26391 | |
| 364 | 364 | if ((offset>=base) && (offset<end)) |
| 365 | 365 | { |
| 366 | 366 | offset-=base; |
| 367 | | duart68681_w(m_duart,space,offset,data&0x00ff); |
| 367 | m_duart->write(space,offset,data&0x00ff); |
| 368 | 368 | } |
| 369 | 369 | else |
| 370 | 370 | { |
| r26390 | r26391 | |
| 610 | 610 | bfm_sc4_68307_porta_w, |
| 611 | 611 | bfm_sc4_68307_portb_r, |
| 612 | 612 | bfm_sc4_68307_portb_w ); |
| 613 | | m68307_set_duart68681(m_maincpu,machine().device("m68307_68681")); |
| 613 | m68307_set_duart68681(m_maincpu,machine().device<duartn68681_device>("m68307_68681")); |
| 614 | 614 | |
| 615 | 615 | |
| 616 | 616 | |
| r26390 | r26391 | |
| 631 | 631 | |
| 632 | 632 | |
| 633 | 633 | |
| 634 | | void bfm_sc4_duart_irq_handler(device_t *device, int state, UINT8 vector) |
| 634 | WRITE_LINE_MEMBER(sc4_state::bfm_sc4_duart_irq_handler) |
| 635 | 635 | { |
| 636 | | sc4_state *drvstate = device->machine().driver_data<sc4_state>(); |
| 637 | 636 | // triggers after reel tests on luckb, at the start on dnd... |
| 638 | 637 | // not sure this is right, causes some games to crash |
| 639 | 638 | logerror("bfm_sc4_duart_irq_handler\n"); |
| 640 | 639 | if (state == ASSERT_LINE) |
| 641 | 640 | { |
| 642 | | m68307_licr2_interrupt(drvstate->m_maincpu); |
| 641 | m68307_licr2_interrupt(m_maincpu); |
| 643 | 642 | } |
| 644 | | }; |
| 643 | } |
| 645 | 644 | |
| 646 | | void bfm_sc4_duart_tx(device_t *device, int channel, UINT8 data) |
| 645 | WRITE_LINE_MEMBER(sc4_state::bfm_sc4_duart_txa) |
| 647 | 646 | { |
| 648 | 647 | logerror("bfm_sc4_duart_tx\n"); |
| 649 | | }; |
| 648 | } |
| 650 | 649 | |
| 651 | 650 | |
| 652 | 651 | |
| 653 | | UINT8 bfm_sc4_duart_input_r(device_t *device) |
| 652 | READ8_MEMBER(sc4_state::bfm_sc4_duart_input_r) |
| 654 | 653 | { |
| 655 | | sc4_state *state = device->machine().driver_data<sc4_state>(); |
| 656 | | // printf("bfm_sc4_duart_input_r\n"); |
| 657 | | return state->m_optic_pattern; |
| 654 | // printf("bfm_sc4_duart_input_r\n"); |
| 655 | return m_optic_pattern; |
| 658 | 656 | } |
| 659 | 657 | |
| 660 | | void bfm_sc4_duart_output_w(device_t *device, UINT8 data) |
| 658 | WRITE8_MEMBER(sc4_state::bfm_sc4_duart_output_w) |
| 661 | 659 | { |
| 662 | 660 | // logerror("bfm_sc4_duart_output_w\n"); |
| 663 | | sc4_state *state = device->machine().driver_data<sc4_state>(); |
| 661 | m_reel56_latch = data; |
| 664 | 662 | |
| 665 | | state->m_reel56_latch = data; |
| 663 | if ( stepper_update(4, data&0x0f ) ) m_reel_changed |= 0x10; |
| 664 | if ( stepper_update(5, (data>>4)&0x0f) ) m_reel_changed |= 0x20; |
| 666 | 665 | |
| 667 | | if ( stepper_update(4, data&0x0f ) ) state->m_reel_changed |= 0x10; |
| 668 | | if ( stepper_update(5, (data>>4)&0x0f) ) state->m_reel_changed |= 0x20; |
| 666 | if ( stepper_optic_state(4) ) m_optic_pattern |= 0x10; |
| 667 | else m_optic_pattern &= ~0x10; |
| 668 | if ( stepper_optic_state(5) ) m_optic_pattern |= 0x20; |
| 669 | else m_optic_pattern &= ~0x20; |
| 669 | 670 | |
| 670 | | if ( stepper_optic_state(4) ) state->m_optic_pattern |= 0x10; |
| 671 | | else state->m_optic_pattern &= ~0x10; |
| 672 | | if ( stepper_optic_state(5) ) state->m_optic_pattern |= 0x20; |
| 673 | | else state->m_optic_pattern &= ~0x20; |
| 674 | | |
| 675 | 671 | awp_draw_reel(4); |
| 676 | 672 | awp_draw_reel(5); |
| 677 | 673 | } |
| 678 | 674 | |
| 679 | 675 | |
| 680 | | static const duart68681_config bfm_sc4_duart68681_config = |
| 676 | static const duartn68681_config bfm_sc4_duart68681_config = |
| 681 | 677 | { |
| 682 | | bfm_sc4_duart_irq_handler, |
| 683 | | bfm_sc4_duart_tx, |
| 684 | | bfm_sc4_duart_input_r, |
| 685 | | bfm_sc4_duart_output_w, |
| 678 | DEVCB_DRIVER_LINE_MEMBER(sc4_state, bfm_sc4_duart_irq_handler), |
| 679 | DEVCB_DRIVER_LINE_MEMBER(sc4_state, bfm_sc4_duart_txa), |
| 680 | DEVCB_NULL, |
| 681 | DEVCB_DRIVER_MEMBER(sc4_state, bfm_sc4_duart_input_r), |
| 682 | DEVCB_DRIVER_MEMBER(sc4_state, bfm_sc4_duart_output_w), |
| 686 | 683 | // TODO: What are the actual frequencies? |
| 687 | 684 | XTAL_16MHz/2/8, /* IP2/RxCB clock */ |
| 688 | 685 | XTAL_16MHz/2/16, /* IP3/TxCA clock */ |
| r26390 | r26391 | |
| 692 | 689 | |
| 693 | 690 | |
| 694 | 691 | |
| 695 | | void m68307_duart_irq_handler(device_t *device, int state, UINT8 vector) |
| 692 | WRITE_LINE_MEMBER(sc4_state::m68307_duart_irq_handler) |
| 696 | 693 | { |
| 697 | | sc4_state *drvstate = device->machine().driver_data<sc4_state>(); |
| 698 | 694 | logerror("m68307_duart_irq_handler\n"); |
| 699 | 695 | if (state == ASSERT_LINE) |
| 700 | 696 | { |
| 701 | | m68307_serial_interrupt(drvstate->m_maincpu, vector); |
| 697 | m68307_serial_interrupt(m_maincpu, machine().device<duartn68681_device>("m68307_68681")->get_irq_vector()); |
| 702 | 698 | } |
| 703 | | }; |
| 699 | } |
| 704 | 700 | |
| 705 | | void m68307_duart_tx(device_t *device, int channel, UINT8 data) |
| 701 | WRITE_LINE_MEMBER(sc4_state::m68307_duart_txa) |
| 706 | 702 | { |
| 707 | | if (channel==0) |
| 708 | | { |
| 709 | | logerror("m68307_duart_tx %02x\n",data); |
| 710 | | } |
| 711 | | else |
| 712 | | { |
| 713 | | printf("(illegal channel 1) m68307_duart_tx %02x\n",data); |
| 714 | | } |
| 715 | | }; |
| 703 | logerror("m68307_duart_tx %02x\n", state); |
| 704 | } |
| 716 | 705 | |
| 717 | | UINT8 m68307_duart_input_r(device_t *device) |
| 706 | WRITE_LINE_MEMBER(sc4_state::m68307_duart_txb) |
| 718 | 707 | { |
| 708 | printf("(illegal channel 1) m68307_duart_tx %02x\n", state); |
| 709 | } |
| 710 | |
| 711 | READ8_MEMBER(sc4_state::m68307_duart_input_r) |
| 712 | { |
| 719 | 713 | logerror("m68307_duart_input_r\n"); |
| 720 | 714 | return 0x00; |
| 721 | 715 | } |
| 722 | 716 | |
| 723 | | void m68307_duart_output_w(device_t *device, UINT8 data) |
| 717 | WRITE8_MEMBER(sc4_state::m68307_duart_output_w) |
| 724 | 718 | { |
| 725 | 719 | logerror("m68307_duart_output_w %02x\n", data); |
| 726 | 720 | } |
| 727 | 721 | |
| 728 | 722 | |
| 729 | 723 | |
| 730 | | static const duart68681_config m68307_duart68681_config = |
| 724 | static const duartn68681_config m68307_duart68681_config = |
| 731 | 725 | { |
| 732 | | m68307_duart_irq_handler, |
| 733 | | m68307_duart_tx, |
| 734 | | m68307_duart_input_r, |
| 735 | | m68307_duart_output_w |
| 726 | DEVCB_DRIVER_LINE_MEMBER(sc4_state, m68307_duart_irq_handler), |
| 727 | DEVCB_DRIVER_LINE_MEMBER(sc4_state, m68307_duart_txa), |
| 728 | DEVCB_DRIVER_LINE_MEMBER(sc4_state, m68307_duart_txb), |
| 729 | DEVCB_DRIVER_MEMBER(sc4_state, m68307_duart_input_r), |
| 730 | DEVCB_DRIVER_MEMBER(sc4_state, m68307_duart_output_w) |
| 736 | 731 | }; |
| 737 | 732 | |
| 738 | 733 | /* default dmd */ |
| r26390 | r26391 | |
| 753 | 748 | MCFG_CPU_PROGRAM_MAP(sc4_map) |
| 754 | 749 | |
| 755 | 750 | // internal duart of the 68307... paired in machine start |
| 756 | | MCFG_DUART68681_ADD("m68307_68681", 16000000/4, m68307_duart68681_config) // ?? Mhz |
| 751 | MCFG_DUARTN68681_ADD("m68307_68681", 16000000/4, m68307_duart68681_config) // ?? Mhz |
| 757 | 752 | |
| 758 | 753 | MCFG_MACHINE_START_OVERRIDE(sc4_state, sc4 ) |
| 759 | 754 | MCFG_MACHINE_RESET_OVERRIDE(sc4_state, sc4 ) |
| r26390 | r26391 | |
| 763 | 758 | |
| 764 | 759 | MCFG_NVRAM_ADD_1FILL("nvram") |
| 765 | 760 | |
| 766 | | MCFG_DUART68681_ADD("duart68681", 16000000/4, bfm_sc4_duart68681_config) // ?? Mhz |
| 761 | MCFG_DUARTN68681_ADD("duart68681", 16000000/4, bfm_sc4_duart68681_config) // ?? Mhz |
| 767 | 762 | |
| 768 | 763 | MCFG_BFMBDA_ADD("vfd0",0) |
| 769 | 764 | |
trunk/src/mame/drivers/bfm_sc5.c
| r26390 | r26391 | |
| 27 | 27 | |
| 28 | 28 | if (mem_mask &0xff00) |
| 29 | 29 | { |
| 30 | | duart68681_w(m_duart,space,offset,(data>>8)&0x00ff); |
| 30 | m_duart->write(space,offset,(data>>8)&0x00ff); |
| 31 | 31 | } |
| 32 | 32 | else |
| 33 | 33 | { |
| r26390 | r26391 | |
| 193 | 193 | |
| 194 | 194 | |
| 195 | 195 | |
| 196 | | void bfm_sc5_duart_irq_handler(device_t *device, int state, UINT8 vector) |
| 196 | WRITE_LINE_MEMBER(bfm_sc5_state::bfm_sc5_duart_irq_handler) |
| 197 | 197 | { |
| 198 | 198 | printf("bfm_sc5_duart_irq_handler\n"); |
| 199 | | }; |
| 199 | } |
| 200 | 200 | |
| 201 | | void bfm_sc5_duart_tx(device_t *device, int channel, UINT8 data) |
| 201 | WRITE_LINE_MEMBER(bfm_sc5_state::bfm_sc5_duart_txa) |
| 202 | 202 | { |
| 203 | 203 | logerror("bfm_sc5_duart_tx\n"); |
| 204 | | }; |
| 204 | } |
| 205 | 205 | |
| 206 | | |
| 207 | | |
| 208 | | UINT8 bfm_sc5_duart_input_r(device_t *device) |
| 206 | READ8_MEMBER(bfm_sc5_state::bfm_sc5_duart_input_r) |
| 209 | 207 | { |
| 210 | | //bfm_sc5_state *state = device->machine().driver_data<bfm_sc5_state>(); |
| 211 | 208 | printf("bfm_sc5_duart_input_r\n"); |
| 212 | 209 | return 0xff; |
| 213 | 210 | } |
| 214 | 211 | |
| 215 | | void bfm_sc5_duart_output_w(device_t *device, UINT8 data) |
| 212 | WRITE8_MEMBER(bfm_sc5_state::bfm_sc5_duart_output_w) |
| 216 | 213 | { |
| 217 | 214 | logerror("bfm_sc5_duart_output_w\n"); |
| 218 | 215 | } |
| 219 | 216 | |
| 220 | 217 | |
| 221 | | static const duart68681_config bfm_sc5_duart68681_config = |
| 218 | static const duartn68681_config bfm_sc5_duart68681_config = |
| 222 | 219 | { |
| 223 | | bfm_sc5_duart_irq_handler, |
| 224 | | bfm_sc5_duart_tx, |
| 225 | | bfm_sc5_duart_input_r, |
| 226 | | bfm_sc5_duart_output_w, |
| 220 | DEVCB_DRIVER_LINE_MEMBER(bfm_sc5_state, bfm_sc5_duart_irq_handler), |
| 221 | DEVCB_DRIVER_LINE_MEMBER(bfm_sc5_state, bfm_sc5_duart_txa), |
| 222 | DEVCB_NULL, |
| 223 | DEVCB_DRIVER_MEMBER(bfm_sc5_state, bfm_sc5_duart_input_r), |
| 224 | DEVCB_DRIVER_MEMBER(bfm_sc5_state, bfm_sc5_duart_output_w), |
| 227 | 225 | // TODO: What are the actual frequencies? |
| 228 | 226 | 16000000/2/8, /* IP2/RxCB clock */ |
| 229 | 227 | 16000000/2/16, /* IP3/TxCA clock */ |
| r26390 | r26391 | |
| 240 | 238 | /* sound hardware */ |
| 241 | 239 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 242 | 240 | |
| 243 | | MCFG_DUART68681_ADD("duart68681", 16000000/4, bfm_sc5_duart68681_config) // ?? Mhz |
| 241 | MCFG_DUARTN68681_ADD("duart68681", 16000000/4, bfm_sc5_duart68681_config) // ?? Mhz |
| 244 | 242 | |
| 245 | 243 | |
| 246 | 244 | MCFG_BFMBDA_ADD("vfd0",0) |
trunk/src/mame/includes/bfm_sc45.h
| r26390 | r26391 | |
| 7 | 7 | #include "machine/bfm_bda.h" |
| 8 | 8 | |
| 9 | 9 | #include "sound/ymz280b.h" |
| 10 | | #include "machine/68681.h" |
| 10 | #include "machine/n68681.h" |
| 11 | 11 | #include "machine/nvram.h" |
| 12 | 12 | #include "machine/68307.h" |
| 13 | 13 | #include "machine/68340.h" |
| r26390 | r26391 | |
| 28 | 28 | |
| 29 | 29 | public: |
| 30 | 30 | |
| 31 | | required_device<duart68681_device> m_duart; |
| 31 | required_device<duartn68681_device> m_duart; |
| 32 | 32 | optional_device<bfm_bda_t> m_vfd0; |
| 33 | 33 | optional_device<bfmdm01_device> m_dm01; |
| 34 | 34 | required_device<ymz280b_device> m_ymz; |
| r26390 | r26391 | |
| 103 | 103 | DECLARE_WRITE16_MEMBER(sc4_mem_w); |
| 104 | 104 | |
| 105 | 105 | DECLARE_READ16_MEMBER(sc4_cs1_r); |
| 106 | |
| 107 | DECLARE_WRITE_LINE_MEMBER(bfm_sc4_duart_irq_handler); |
| 108 | DECLARE_WRITE_LINE_MEMBER(bfm_sc4_duart_txa); |
| 109 | DECLARE_READ8_MEMBER(bfm_sc4_duart_input_r); |
| 110 | DECLARE_WRITE8_MEMBER(bfm_sc4_duart_output_w); |
| 111 | |
| 112 | DECLARE_WRITE_LINE_MEMBER(m68307_duart_irq_handler); |
| 113 | DECLARE_WRITE_LINE_MEMBER(m68307_duart_txa); |
| 114 | DECLARE_WRITE_LINE_MEMBER(m68307_duart_txb); |
| 115 | DECLARE_READ8_MEMBER(m68307_duart_input_r); |
| 116 | DECLARE_WRITE8_MEMBER(m68307_duart_output_w); |
| 106 | 117 | |
| 107 | 118 | DECLARE_DRIVER_INIT(sc4); |
| 108 | 119 | DECLARE_DRIVER_INIT(sc4mbus); |