Previous 199869 Revisions Next

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

trunk/src/mess/includes/poly88.h
r26764r26765
1818   {
1919      TIMER_USART,
2020      TIMER_KEYBOARD,
21      TIMER_CASSETTE,
22      TIMER_SETUP_MACHINE_STATE
21      TIMER_CASSETTE
2322   };
2423
2524   poly88_state(const machine_config &mconfig, device_type type, const char *tag)
r26764r26765
2726      m_video_ram(*this, "video_ram"),
2827      m_maincpu(*this, "maincpu"),
2928      m_uart(*this, "uart"),
30      m_sercas(*this, "sercas"),
3129      m_cassette(*this, "cassette"),
3230      m_linec(*this, "LINEC"),
3331      m_line0(*this, "LINE0"),
r26764r26765
5957   TIMER_CALLBACK_MEMBER(poly88_usart_timer_callback);
6058   TIMER_CALLBACK_MEMBER(keyboard_callback);
6159   TIMER_CALLBACK_MEMBER(poly88_cassette_timer_callback);
62   TIMER_CALLBACK_MEMBER(setup_machine_state);
60   DECLARE_WRITE_LINE_MEMBER(write_cas_tx);
6361   DECLARE_WRITE_LINE_MEMBER(poly88_usart_rxready);
6462   IRQ_CALLBACK_MEMBER(poly88_irq_callback);
6563   DECLARE_SNAPSHOT_LOAD_MEMBER( poly88 );
r26764r26765
6765protected:
6866   required_device<cpu_device> m_maincpu;
6967   required_device<i8251_device> m_uart;
70   required_device<serial_source_device> m_sercas;
7168   required_device<cassette_image_device> m_cassette;
7269   required_ioport m_linec;
7370   required_ioport m_line0;
r26764r26765
7976   required_ioport m_line6;
8077   UINT8 row_number(UINT8 code);
8178   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
79
80   int m_cas_tx;
8281};
8382
8483
trunk/src/mess/drivers/poly88.c
r26764r26765
197197
198198   /* uart */
199199   MCFG_I8251_ADD("uart", poly88_usart_interface)
200   MCFG_SERIAL_SOURCE_ADD("sercas")
201200
202201   /* snapshot */
203202   MCFG_SNAPSHOT_ADD("snapshot", poly88_state, poly88, "img", 0)
trunk/src/mess/machine/poly88.c
r26764r26765
2525   case TIMER_CASSETTE:
2626      poly88_cassette_timer_callback(ptr, param);
2727      break;
28   case TIMER_SETUP_MACHINE_STATE:
29      setup_machine_state(ptr, param);
30      break;
3128   default:
3229      assert_always(FALSE, "Unknown id in poly88_state::device_timer");
3330   }
r26764r26765
159156   return m_int_vector;
160157}
161158
159WRITE_LINE_MEMBER(poly88_state::write_cas_tx)
160{
161   m_cas_tx = state;
162}
163
162164TIMER_CALLBACK_MEMBER(poly88_state::poly88_cassette_timer_callback)
163165{
164166   int data;
r26764r26765
182184                  {
183185                     data = (!m_previous_level && current_level) ? 1 : 0;
184186//data = current_level;
185                     m_sercas->send_bit(data);
187                     m_uart->write_rx(data);
186188                     m_uart->receive_clock();
187189
188190                     m_clk_level_tape = 1;
r26764r26765
193195      /* tape writing */
194196      if (m_cassette->get_state()&CASSETTE_RECORD)
195197      {
196         data = m_sercas->get_in_data_bit();
198         data = m_cas_tx;
197199         data ^= m_clk_level_tape;
198200         m_cassette->output(data&0x01 ? 1 : -1);
199201
r26764r26765
214216}
215217
216218
217TIMER_CALLBACK_MEMBER(poly88_state::setup_machine_state)
218{
219   m_uart->connect(m_sercas);
220}
221
222219DRIVER_INIT_MEMBER(poly88_state,poly88)
223220{
224221   m_previous_level = 0;
r26764r26765
234231   m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(poly88_state::poly88_irq_callback),this));
235232   m_intr = 0;
236233   m_last_code = 0;
237
238   timer_set(attotime::zero, TIMER_SETUP_MACHINE_STATE);
239234}
240235
241236INTERRUPT_GEN_MEMBER(poly88_state::poly88_interrupt)
r26764r26765
252247
253248const i8251_interface poly88_usart_interface=
254249{
250   DEVCB_DRIVER_LINE_MEMBER(poly88_state,write_cas_tx),
255251   DEVCB_NULL,
256252   DEVCB_NULL,
257   DEVCB_NULL,
258253   DEVCB_DRIVER_LINE_MEMBER(poly88_state,poly88_usart_rxready),
259254   DEVCB_NULL,
260255   DEVCB_NULL,

Previous 199869 Revisions Next


© 1997-2024 The MAME Team