Previous 199869 Revisions Next

r26763 Thursday 26th December, 2013 at 19:20:59 UTC by smf
changed pmd85 driver to use callbacks instead of diserial connect() [smf]
[src/mess/drivers]pmd85.c
[src/mess/includes]pmd85.h
[src/mess/machine]pmd85.c

trunk/src/mess/machine/pmd85.c
r26762r26763
762762   case TIMER_RESET:
763763      pmd_reset(ptr, param);
764764      break;
765   case TIMER_SETUP_MACHINE_STATE:
766      setup_machine_state(ptr, param);
767      break;
768765   default:
769766      assert_always(FALSE, "Unknown id in pmd85_state::device_timer");
770767   }
771768}
772769
770WRITE_LINE_MEMBER(pmd85_state::write_cas_tx)
771{
772   m_cas_tx = state;
773}
773774
774775TIMER_CALLBACK_MEMBER(pmd85_state::pmd85_cassette_timer_callback)
775776{
r26762r26763
797798                  {
798799                     data = (!m_previous_level && current_level) ? 1 : 0;
799800
800                     m_sercas->send_bit(data);
801                     m_uart->write_rx(data);
801802                     m_uart->receive_clock();
802803
803804                     m_clk_level_tape = 1;
r26762r26763
817818      /* tape writing */
818819      if (m_cassette->get_state()&CASSETTE_RECORD)
819820      {
820         data = m_sercas->get_in_data_bit();
821         data = m_cas_tx;
821822         data ^= m_clk_level_tape;
822823         m_cassette->output(data&0x01 ? 1 : -1);
823824
r26762r26763
921922   pmd85_common_driver_init();
922923}
923924
924TIMER_CALLBACK_MEMBER(pmd85_state::setup_machine_state)
925{
926   if (m_model != MATO)
927   {
928      m_uart->connect(m_sercas);
929   }
930}
931
932
933925void pmd85_state::machine_reset()
934926{
935927   int i, j;
r26762r26763
958950   m_startup_mem_map = 1;
959951   (this->*update_memory)();
960952
961   timer_set(attotime::zero, TIMER_SETUP_MACHINE_STATE);
962
963953   m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(pmd85_state::pmd85_opbaseoverride), this));
964954}
trunk/src/mess/includes/pmd85.h
r26762r26763
2020   enum
2121   {
2222      TIMER_CASSETTE,
23      TIMER_RESET,
24      TIMER_SETUP_MACHINE_STATE
23      TIMER_RESET
2524   };
2625
2726   pmd85_state(const machine_config &mconfig, device_type type, const char *tag)
r26762r26763
2928      m_maincpu(*this, "maincpu"),
3029      m_ram(*this, RAM_TAG),
3130      m_cassette(*this, "cassette"),
32      m_sercas(*this, "sercas"),
3331      m_pit8253(*this, "pit8253"),
3432      m_uart(*this, "uart"),
3533      m_ppi8255_0(*this, "ppi8255_0"),
r26762r26763
8381   UINT32 screen_update_pmd85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
8482   TIMER_CALLBACK_MEMBER(pmd85_cassette_timer_callback);
8583   TIMER_CALLBACK_MEMBER(pmd_reset);
86   TIMER_CALLBACK_MEMBER(setup_machine_state);
84   DECLARE_WRITE_LINE_MEMBER(write_cas_tx);
8785   DECLARE_READ8_MEMBER(pmd85_ppi_0_porta_r);
8886   DECLARE_READ8_MEMBER(pmd85_ppi_0_portb_r);
8987   DECLARE_READ8_MEMBER(pmd85_ppi_0_portc_r);
r26762r26763
116114   required_device<cpu_device> m_maincpu;
117115   required_device<ram_device> m_ram;
118116   required_device<cassette_image_device> m_cassette;
119   required_device<serial_source_device> m_sercas;
120117   required_device<pit8253_device> m_pit8253;
121118   optional_device<i8251_device> m_uart;
122119   optional_device<i8255_device> m_ppi8255_0;
r26762r26763
153150   void pmd85_common_driver_init();
154151   void pmd85_draw_scanline(bitmap_ind16 &bitmap, int pmd85_scanline);
155152   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
153
154   int m_cas_tx;
156155};
157156
158157
trunk/src/mess/drivers/pmd85.c
r26762r26763
542542   NULL
543543};
544544
545const i8251_interface pmd85_i8251_interface =
546{
547   DEVCB_DRIVER_LINE_MEMBER(pmd85_state, write_cas_tx),
548   DEVCB_NULL,
549   DEVCB_NULL,
550   DEVCB_NULL,
551   DEVCB_NULL,
552   DEVCB_NULL,
553   DEVCB_NULL
554};
545555
556
546557/* machine definition */
547558static MACHINE_CONFIG_START( pmd85, pmd85_state )
548559   /* basic machine hardware */
r26762r26763
574585   MCFG_CASSETTE_ADD( "cassette", pmd85_cassette_interface )
575586
576587   /* uart */
577   MCFG_I8251_ADD("uart", default_i8251_interface)
578   MCFG_SERIAL_SOURCE_ADD("sercas")
588   MCFG_I8251_ADD("uart", pmd85_i8251_interface)
579589
580590   /* internal ram */
581591   MCFG_RAM_ADD(RAM_TAG)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team