diff options
author | 2013-01-26 12:45:37 +0000 | |
---|---|---|
committer | 2013-01-26 12:45:37 +0000 | |
commit | 44733ec39d211249003cd53936830cf9960c1345 (patch) | |
tree | c0d32cd8ebf15c263ab33168c68adff55a3f7889 /src/mess/machine | |
parent | d60c12e84fcfc4b8f38bb73760088664f7dc8935 (diff) |
(MESS) poly88.c: Cleanups (nw)
Diffstat (limited to 'src/mess/machine')
-rw-r--r-- | src/mess/machine/poly88.c | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/src/mess/machine/poly88.c b/src/mess/machine/poly88.c index f3d59e126fb..ff0eb279bbe 100644 --- a/src/mess/machine/poly88.c +++ b/src/mess/machine/poly88.c @@ -15,7 +15,7 @@ TIMER_CALLBACK_MEMBER(poly88_state::poly88_usart_timer_callback) { m_int_vector = 0xe7; - machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE); + m_maincpu->set_input_line(0, HOLD_LINE); } WRITE8_MEMBER(poly88_state::poly88_baud_rate_w) @@ -40,17 +40,25 @@ static UINT8 row_number(UINT8 code) { TIMER_CALLBACK_MEMBER(poly88_state::keyboard_callback) { - static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6" }; - int i; UINT8 code; UINT8 key_code = 0; - UINT8 shift = machine().root_device().ioport("LINEC")->read() & 0x02 ? 1 : 0; - UINT8 ctrl = machine().root_device().ioport("LINEC")->read() & 0x01 ? 1 : 0; + UINT8 shift = m_linec->read() & 0x02 ? 1 : 0; + UINT8 ctrl = m_linec->read() & 0x01 ? 1 : 0; for(i = 0; i < 7; i++) { - code = machine().root_device().ioport(keynames[i])->read(); + switch ( i ) + { + case 0: code = m_line0->read(); break; + case 1: code = m_line1->read(); break; + case 2: code = m_line2->read(); break; + case 3: code = m_line3->read(); break; + case 4: code = m_line4->read(); break; + case 5: code = m_line5->read(); break; + case 6: code = m_line6->read(); break; + default: code = 0; + } if (code != 0) { if (i==0 && shift==0) { @@ -116,7 +124,7 @@ TIMER_CALLBACK_MEMBER(poly88_state::keyboard_callback) } if (key_code==0 && m_last_code !=0){ m_int_vector = 0xef; - machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE); + m_maincpu->set_input_line(0, HOLD_LINE); } else { m_last_code = key_code; } @@ -132,29 +140,27 @@ TIMER_CALLBACK_MEMBER(poly88_state::poly88_cassette_timer_callback) { int data; int current_level; - i8251_device *uart = machine().device<i8251_device>("uart"); - serial_source_device *ser = machine().device<serial_source_device>("sercas"); // if (!(machine().root_device().ioport("DSW0")->read() & 0x02)) /* V.24 / Tape Switch */ //{ /* tape reading */ - if (machine().device<cassette_image_device>(CASSETTE_TAG)->get_state()&CASSETTE_PLAY) + if (m_cassette->get_state()&CASSETTE_PLAY) { if (m_clk_level_tape) { - m_previous_level = ((machine().device<cassette_image_device>(CASSETTE_TAG))->input() > 0.038) ? 1 : 0; + m_previous_level = (m_cassette->input() > 0.038) ? 1 : 0; m_clk_level_tape = 0; } else { - current_level = ((machine().device<cassette_image_device>(CASSETTE_TAG))->input() > 0.038) ? 1 : 0; + current_level = (m_cassette->input() > 0.038) ? 1 : 0; if (m_previous_level!=current_level) { data = (!m_previous_level && current_level) ? 1 : 0; //data = current_level; - ser->send_bit(data); - uart->receive_clock(); + m_sercas->send_bit(data); + m_uart->receive_clock(); m_clk_level_tape = 1; } @@ -162,14 +168,14 @@ TIMER_CALLBACK_MEMBER(poly88_state::poly88_cassette_timer_callback) } /* tape writing */ - if (machine().device<cassette_image_device>(CASSETTE_TAG)->get_state()&CASSETTE_RECORD) + if (m_cassette->get_state()&CASSETTE_RECORD) { - data = ser->get_in_data_bit(); + data = m_sercas->get_in_data_bit(); data ^= m_clk_level_tape; - machine().device<cassette_image_device>(CASSETTE_TAG)->output(data&0x01 ? 1 : -1); + m_cassette->output(data&0x01 ? 1 : -1); if (!m_clk_level_tape) - uart->transmit_clock(); + m_uart->transmit_clock(); m_clk_level_tape = m_clk_level_tape ? 0 : 1; @@ -179,7 +185,7 @@ TIMER_CALLBACK_MEMBER(poly88_state::poly88_cassette_timer_callback) m_clk_level_tape = 1; if (!m_clk_level) - uart->transmit_clock(); + m_uart->transmit_clock(); m_clk_level = m_clk_level ? 0 : 1; // } } @@ -187,9 +193,7 @@ TIMER_CALLBACK_MEMBER(poly88_state::poly88_cassette_timer_callback) TIMER_CALLBACK_MEMBER(poly88_state::setup_machine_state) { - i8251_device *uart = machine().device<i8251_device>("uart"); - serial_source_device *ser = machine().device<serial_source_device>("sercas"); - uart->connect(ser); + m_uart->connect(m_sercas); } DRIVER_INIT_MEMBER(poly88_state,poly88) @@ -204,7 +208,7 @@ DRIVER_INIT_MEMBER(poly88_state,poly88) void poly88_state::machine_reset() { - machine().device("maincpu")->execute().set_irq_acknowledge_callback(poly88_irq_callback); + m_maincpu->set_irq_acknowledge_callback(poly88_irq_callback); m_intr = 0; m_last_code = 0; @@ -239,14 +243,14 @@ const i8251_interface poly88_usart_interface= READ8_MEMBER(poly88_state::poly88_keyboard_r) { UINT8 retVal = m_last_code; - machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); + m_maincpu->set_input_line(0, CLEAR_LINE); m_last_code = 0x00; return retVal; } WRITE8_MEMBER(poly88_state::poly88_intr_w) { - machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); + m_maincpu->set_input_line(0, CLEAR_LINE); } SNAPSHOT_LOAD( poly88 ) |