diff options
Diffstat (limited to 'src/mess/machine/mz700.c')
-rw-r--r-- | src/mess/machine/mz700.c | 93 |
1 files changed, 43 insertions, 50 deletions
diff --git a/src/mess/machine/mz700.c b/src/mess/machine/mz700.c index fbec8946062..95efe76364a 100644 --- a/src/mess/machine/mz700.c +++ b/src/mess/machine/mz700.c @@ -36,32 +36,27 @@ } while (0) -static DECLARE_READ8_DEVICE_HANDLER ( pio_port_b_r ); -static DECLARE_READ8_DEVICE_HANDLER ( pio_port_c_r ); -static DECLARE_WRITE8_DEVICE_HANDLER ( pio_port_a_w ); -static DECLARE_WRITE8_DEVICE_HANDLER ( pio_port_c_w ); - I8255_INTERFACE( mz700_ppi8255_interface ) { DEVCB_NULL, - DEVCB_DEVICE_HANDLER("ls145", pio_port_a_w), - DEVCB_DEVICE_HANDLER("ls145", pio_port_b_r), + DEVCB_DRIVER_MEMBER(mz_state,pio_port_a_w), + DEVCB_DRIVER_MEMBER(mz_state,pio_port_b_r), DEVCB_NULL, - DEVCB_DEVICE_HANDLER("ppi8255", pio_port_c_r), - DEVCB_DEVICE_HANDLER("ppi8255", pio_port_c_w) + DEVCB_DRIVER_MEMBER(mz_state,pio_port_c_r), + DEVCB_DRIVER_MEMBER(mz_state,pio_port_c_w) }; -static WRITE_LINE_DEVICE_HANDLER( pit_out0_changed ); -static WRITE_LINE_DEVICE_HANDLER( pit_irq_2 ); + + const struct pit8253_config mz700_pit8253_config = { { /* clockin gate callback */ - { XTAL_17_73447MHz/20, DEVCB_NULL, DEVCB_DEVICE_LINE("pit8253", pit_out0_changed) }, + { XTAL_17_73447MHz/20, DEVCB_NULL, DEVCB_DRIVER_LINE_MEMBER(mz_state,pit_out0_changed) }, { 15611.0, DEVCB_LINE_VCC, DEVCB_DEVICE_LINE("pit8253", pit8253_clk2_w) }, - { 0, DEVCB_LINE_VCC, DEVCB_DEVICE_LINE("pit8253", pit_irq_2) }, + { 0, DEVCB_LINE_VCC, DEVCB_DRIVER_LINE_MEMBER(mz_state,pit_irq_2) }, } }; @@ -69,9 +64,9 @@ const struct pit8253_config mz800_pit8253_config = { { /* clockin gate callback */ - { XTAL_17_73447MHz/16, DEVCB_NULL, DEVCB_DEVICE_LINE("pit8253", pit_out0_changed) }, + { XTAL_17_73447MHz/16, DEVCB_NULL, DEVCB_DRIVER_LINE_MEMBER(mz_state,pit_out0_changed) }, { 15611.0, DEVCB_LINE_VCC, DEVCB_DEVICE_LINE("pit8253", pit8253_clk2_w) }, - { 0, DEVCB_LINE_VCC, DEVCB_DEVICE_LINE("pit8253", pit_irq_2) }, + { 0, DEVCB_LINE_VCC, DEVCB_DRIVER_LINE_MEMBER(mz_state,pit_irq_2) }, } }; @@ -407,24 +402,21 @@ WRITE8_MEMBER(mz_state::mz700_bank_6_w) /* Timer 0 is the clock for the speaker output */ -static WRITE_LINE_DEVICE_HANDLER( pit_out0_changed ) +WRITE_LINE_MEMBER(mz_state::pit_out0_changed) { - mz_state *drvstate = device->machine().driver_data<mz_state>(); - device_t *speaker = device->machine().device(SPEAKER_TAG); - if((drvstate->m_prev_state==0) && (state==1)) { - drvstate->m_speaker_level ^= 1; + device_t *speaker = machine().device(SPEAKER_TAG); + if((m_prev_state==0) && (state==1)) { + m_speaker_level ^= 1; } - drvstate->m_prev_state = state; - speaker_level_w( speaker, drvstate->m_speaker_level); + m_prev_state = state; + speaker_level_w( speaker, m_speaker_level); } /* timer 2 is the AM/PM (12 hour) interrupt */ -static WRITE_LINE_DEVICE_HANDLER( pit_irq_2 ) +WRITE_LINE_MEMBER(mz_state::pit_irq_2) { - mz_state *mz = device->machine().driver_data<mz_state>(); - - if (!mz->m_intmsk) - device->machine().device("maincpu")->execute().set_input_line(0, state); + if (!m_intmsk) + machine().device("maincpu")->execute().set_input_line(0, state); } @@ -432,8 +424,9 @@ static WRITE_LINE_DEVICE_HANDLER( pit_irq_2 ) 8255 PPI ***************************************************************************/ -static READ8_DEVICE_HANDLER( pio_port_b_r ) +READ8_MEMBER(mz_state::pio_port_b_r) { + device_t *device = machine().device("ls145"); int key_line = dynamic_cast<ttl74145_device *>(device)->read(); const char *const keynames[10] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8", "ROW9" }; int i; @@ -442,7 +435,7 @@ static READ8_DEVICE_HANDLER( pio_port_b_r ) for(i=0;i<10;i++) { if(key_line & (1 << i)) - res |= space.machine().root_device().ioport(keynames[i])->read(); + res |= machine().root_device().ioport(keynames[i])->read(); } return res; @@ -454,10 +447,9 @@ static READ8_DEVICE_HANDLER( pio_port_b_r ) * bit 5 in tape data (RDATA) * bit 4 in motor (1 = on) */ -static READ8_DEVICE_HANDLER( pio_port_c_r ) +READ8_MEMBER(mz_state::pio_port_c_r) { - cassette_image_device *cas = space.machine().device<cassette_image_device>(CASSETTE_TAG); - mz_state *mz = space.machine().driver_data<mz_state>(); + cassette_image_device *cas = machine().device<cassette_image_device>(CASSETTE_TAG); UINT8 data = 0; /* note: this is actually connected to Q output of the motor-control flip-flop (see below) */ @@ -467,20 +459,21 @@ static READ8_DEVICE_HANDLER( pio_port_c_r ) if ((cas)->input() > 0.0038) data |= 0x20; /* set the RDATA status */ - data |= mz->m_cursor_timer << 6; - data |= space.machine().primary_screen->vblank() << 7; + data |= m_cursor_timer << 6; + data |= machine().primary_screen->vblank() << 7; - LOG(2,"mz700_pio_port_c_r",("%02X\n", data),space.machine()); + LOG(2,"mz700_pio_port_c_r",("%02X\n", data),machine()); return data; } -static WRITE8_DEVICE_HANDLER( pio_port_a_w ) +WRITE8_MEMBER(mz_state::pio_port_a_w) { - timer_device *timer = space.machine().device<timer_device>("cursor"); + device_t *device = machine().device("ls145"); + timer_device *timer = machine().device<timer_device>("cursor"); - LOG(2,"mz700_pio_port_a_w",("%02X\n", data),space.machine()); + LOG(2,"mz700_pio_port_a_w",("%02X\n", data),machine()); /* the ls145 is connected to PA0-PA3 */ dynamic_cast<ttl74145_device *>(device)->write(data & 0x07); @@ -490,7 +483,7 @@ static WRITE8_DEVICE_HANDLER( pio_port_a_w ) } -static WRITE8_DEVICE_HANDLER( pio_port_c_w ) +WRITE8_MEMBER(mz_state::pio_port_c_w) { /* * bit 3 out motor control (0 = on) @@ -499,7 +492,7 @@ static WRITE8_DEVICE_HANDLER( pio_port_c_w ) * bit 0 out unused */ -// UINT8 state = cassette_get_state(space.machine().device<cassette_image_device>(CASSETTE_TAG)); +// UINT8 state = cassette_get_state(machine().device<cassette_image_device>(CASSETTE_TAG)); // UINT8 action = ((~pio_port_c_output & 8) & (data & 8)); /* detect low-to-high transition */ /* The motor control circuit consists of a resistor, capacitor, invertor, nand-gate, and D flip-flop. @@ -512,15 +505,15 @@ static WRITE8_DEVICE_HANDLER( pio_port_c_w ) If you load from the command-line or the software-picker, type in L <enter> immediately. */ #if 0 - space.machine().device<cassette_image_device>(CASSETTE_TAG)->change_state( + machine().device<cassette_image_device>(CASSETTE_TAG)->change_state( ((data & 0x08) && mz700_motor_on) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MOTOR_DISABLED); #endif - LOG(2,"mz700_pio_port_c_w",("%02X\n", data),space.machine()); + LOG(2,"mz700_pio_port_c_w",("%02X\n", data),machine()); - space.machine().device<cassette_image_device>(CASSETTE_TAG)->output((data & 0x02) ? +1.0 : -1.0); + machine().device<cassette_image_device>(CASSETTE_TAG)->output((data & 0x02) ? +1.0 : -1.0); } @@ -543,21 +536,21 @@ static void mz800_z80pio_irq(device_t *device, int which) device->machine().device("maincpu")->execute().set_input_line(0, which); } -static READ8_DEVICE_HANDLER( mz800_z80pio_port_a_r ) +READ8_MEMBER(mz_state::mz800_z80pio_port_a_r) { - centronics_device *centronics = space.machine().device<centronics_device>("centronics"); + centronics_device *centronics = machine().device<centronics_device>("centronics"); UINT8 result = 0; result |= centronics->busy_r(); result |= centronics->pe_r() << 1; - result |= space.machine().primary_screen->hblank() << 5; + result |= machine().primary_screen->hblank() << 5; return result; } -static WRITE8_DEVICE_HANDLER( mz800_z80pio_port_a_w ) +WRITE8_MEMBER(mz_state::mz800_z80pio_port_a_w) { - centronics_device *centronics = space.machine().device<centronics_device>("centronics"); + centronics_device *centronics = machine().device<centronics_device>("centronics"); centronics->init_prime_w(BIT(data, 6)); centronics->strobe_w(BIT(data, 7)); @@ -566,8 +559,8 @@ static WRITE8_DEVICE_HANDLER( mz800_z80pio_port_a_w ) const z80pio_interface mz800_z80pio_config = { DEVCB_DEVICE_LINE("z80pio", mz800_z80pio_irq), - DEVCB_DEVICE_HANDLER("z80pio", mz800_z80pio_port_a_r), - DEVCB_DEVICE_HANDLER("z80pio", mz800_z80pio_port_a_w), + DEVCB_DRIVER_MEMBER(mz_state,mz800_z80pio_port_a_r), + DEVCB_DRIVER_MEMBER(mz_state,mz800_z80pio_port_a_w), DEVCB_NULL, DEVCB_NULL, DEVCB_DEVICE_MEMBER("centronics", centronics_device, write), |