diff options
author | 2013-01-28 14:49:55 +0000 | |
---|---|---|
committer | 2013-01-28 14:49:55 +0000 | |
commit | 9cdbd18a0e66f9edb1d99994581b994db92d34dd (patch) | |
tree | a5e55d29e15b8dd4e6b384e71b864f2e2c3eb40b /src | |
parent | 518642d39eb133ff9b5ebdc08d1623403d6576d2 (diff) |
(MESS) pet: Added datassette slot interface. [Curt Coder]
Diffstat (limited to 'src')
-rw-r--r-- | src/mess/drivers/pet.c | 22 | ||||
-rw-r--r-- | src/mess/includes/pet.h | 12 | ||||
-rw-r--r-- | src/mess/machine/c2n.c | 14 | ||||
-rw-r--r-- | src/mess/machine/c2n.h | 3 | ||||
-rw-r--r-- | src/mess/machine/pet.c | 59 | ||||
-rw-r--r-- | src/mess/machine/petcass.h | 1 |
6 files changed, 53 insertions, 58 deletions
diff --git a/src/mess/drivers/pet.c b/src/mess/drivers/pet.c index 31c0ed09870..cffded964bd 100644 --- a/src/mess/drivers/pet.c +++ b/src/mess/drivers/pet.c @@ -653,6 +653,24 @@ static IEEE488_INTERFACE( ieee488_intf ) DEVCB_NULL }; +//------------------------------------------------- +// PET_DATASSETTE_PORT_INTERFACE( datassette_intf ) +//------------------------------------------------- + +static PET_DATASSETTE_PORT_INTERFACE( datassette_intf ) +{ + DEVCB_DEVICE_LINE_MEMBER("pia_0", pia6821_device, cb1_w) +}; + +//------------------------------------------------- +// PET_DATASSETTE_PORT_INTERFACE( datassette2_intf ) +//------------------------------------------------- + +static PET_DATASSETTE_PORT_INTERFACE( datassette2_intf ) +{ + DEVCB_DEVICE_LINE_MEMBER("via6522_0", via6522_device, write_cb1) +}; + /************************************* * @@ -679,8 +697,8 @@ static MACHINE_CONFIG_START( pet_general, pet_state ) MCFG_PALETTE_LENGTH(ARRAY_LENGTH(pet_palette) / 3) /* cassette */ - MCFG_CASSETTE_ADD( CASSETTE_TAG, cbm_cassette_interface ) - MCFG_CASSETTE_ADD( CASSETTE2_TAG, cbm_cassette_interface ) + MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, datassette_intf, cbm_datassette_devices, "c1530", NULL) + MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT2_TAG, datassette2_intf, cbm_datassette_devices, NULL, NULL) /* via */ MCFG_VIA6522_ADD( "via6522_0", 0, pet_via) diff --git a/src/mess/includes/pet.h b/src/mess/includes/pet.h index 7d7df39ab04..b8b9c7380f7 100644 --- a/src/mess/includes/pet.h +++ b/src/mess/includes/pet.h @@ -12,6 +12,7 @@ #include "machine/6522via.h" #include "machine/ieee488.h" #include "imagedev/cartslot.h" +#include "machine/petcass.h" struct spet_t { @@ -26,10 +27,15 @@ public: pet_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_ieee(*this, IEEE488_TAG), + m_cassette(*this, PET_DATASSETTE_PORT_TAG), + m_cassette2(*this, PET_DATASSETTE_PORT2_TAG), m_videoram(*this, "videoram"), - m_memory(*this, "memory"){ } + m_memory(*this, "memory") + { } required_device<ieee488_device> m_ieee; + required_device<pet_datassette_port_device> m_cassette; + required_device<pet_datassette_port_device> m_cassette2; int m_pet_basic1; /* basic version 1 for quickloader */ int m_superpet; @@ -44,8 +50,6 @@ public: UINT8 *m_supermemory; UINT8 *m_pet80_bank1_base; int m_keyline_select; - emu_timer *m_datasette1_timer; - emu_timer *m_datasette2_timer; spet_t m_spet; int m_pia_level; DECLARE_DRIVER_INIT(superpet); @@ -58,8 +62,6 @@ public: UINT32 screen_update_pet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(pet_frame_interrupt); TIMER_CALLBACK_MEMBER(pet_interrupt); - TIMER_CALLBACK_MEMBER(pet_tape1_timer); - TIMER_CALLBACK_MEMBER(pet_tape2_timer); DECLARE_READ8_MEMBER(pia0_pa_r); DECLARE_WRITE8_MEMBER(pia0_pa_w); DECLARE_READ8_MEMBER(kin_r); diff --git a/src/mess/machine/c2n.c b/src/mess/machine/c2n.c index 4e162c86fd7..f70db0c8c53 100644 --- a/src/mess/machine/c2n.c +++ b/src/mess/machine/c2n.c @@ -28,6 +28,20 @@ const device_type C1531 = &device_creator<c1531_device>; //------------------------------------------------- +// cassette_interface cbm_cassette_interface +//------------------------------------------------- + +const cassette_interface cbm_cassette_interface = +{ + cbm_cassette_formats, + NULL, + (cassette_state) (CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED), + NULL, + NULL +}; + + +//------------------------------------------------- // MACHINE_CONFIG( c2n ) //------------------------------------------------- diff --git a/src/mess/machine/c2n.h b/src/mess/machine/c2n.h index d7049af1889..bf1bb0c1e88 100644 --- a/src/mess/machine/c2n.h +++ b/src/mess/machine/c2n.h @@ -14,7 +14,8 @@ #include "emu.h" -#include "includes/cbm.h" +#include "formats/cbm_tap.h" +#include "imagedev/cassette.h" #include "machine/petcass.h" diff --git a/src/mess/machine/pet.c b/src/mess/machine/pet.c index aa0522551e5..c645e1df99b 100644 --- a/src/mess/machine/pet.c +++ b/src/mess/machine/pet.c @@ -15,7 +15,6 @@ #include "includes/pet.h" #include "imagedev/cartslot.h" -#include "imagedev/cassette.h" #include "machine/ram.h" #define VERBOSE_LEVEL 0 @@ -68,10 +67,10 @@ READ8_MEMBER(pet_state::pia0_pa_r) data |= m_keyline_select; /* #1 cassette switch */ - data |= ((machine().device<cassette_image_device>(CASSETTE_TAG)->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED) << 4; + data |= m_cassette->sense_r() << 4; /* #2 cassette switch */ - data |= ((machine().device<cassette_image_device>(CASSETTE2_TAG)->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED) << 5; + data |= m_cassette2->sense_r() << 5; /* end or identify in */ data |= m_ieee->eoi_r() << 6; @@ -169,21 +168,12 @@ READ8_MEMBER(pet_state::petb_kin_r) READ8_MEMBER(pet_state::cass1_r) { // cassette 1 read - return (machine().device<cassette_image_device>(CASSETTE_TAG)->input() > +0.0) ? 1 : 0; + return m_cassette->read(); } WRITE8_MEMBER(pet_state::cass1_motor_w) { - if (!data) - { - machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); - m_datasette1_timer->adjust(attotime::zero, 0, attotime::from_hz(48000)); // I put 48000 because I was given some .wav with this freq - } - else - { - machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(CASSETTE_MOTOR_DISABLED ,CASSETTE_MASK_MOTOR); - m_datasette1_timer->reset(); - } + m_cassette->motor_w(data); } WRITE_LINE_MEMBER(pet_state::pia0_irq_w) @@ -238,7 +228,7 @@ const pia6821_interface petb_pia0 = WRITE_LINE_MEMBER(pet_state::pia1_irq_w) { m_pia1_irq = state; - int level = (m_pia0_irq | m_pia1_irq | m_via_irq) ? ASSERT_LINE : CLEAR_LINE; + int level = (m_pia0_irq || m_pia1_irq || m_via_irq) ? ASSERT_LINE : CLEAR_LINE; machine().firstcpu->set_input_line(INPUT_LINE_IRQ0, level); } @@ -311,8 +301,7 @@ READ8_MEMBER(pet_state::via_pb_r) READ_LINE_MEMBER(pet_state::cass2_r) { - // cassette 2 read - return (machine().device<cassette_image_device>(CASSETTE2_TAG)->input() > +0.0) ? 1 : 0; + return m_cassette2->read(); } WRITE8_MEMBER(pet_state::via_pb_w) @@ -339,20 +328,11 @@ WRITE8_MEMBER(pet_state::via_pb_w) m_ieee->atn_w(BIT(data, 2)); /* cassette write */ - machine().device<cassette_image_device>(CASSETTE_TAG)->output(BIT(data, 3) ? -(0x5a9e >> 1) : +(0x5a9e >> 1)); - machine().device<cassette_image_device>(CASSETTE2_TAG)->output(BIT(data, 3) ? -(0x5a9e >> 1) : +(0x5a9e >> 1)); + m_cassette->write(BIT(data, 3)); + m_cassette2->write(BIT(data, 3)); /* #2 cassette motor */ - if (BIT(data, 4)) - { - machine().device<cassette_image_device>(CASSETTE2_TAG)->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); - m_datasette2_timer->adjust(attotime::zero, 0, attotime::from_hz(48000)); // I put 48000 because I was given some .wav with this freq - } - else - { - machine().device<cassette_image_device>(CASSETTE2_TAG)->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - m_datasette2_timer->reset(); - } + m_cassette2->motor_w(BIT(data, 4)); } WRITE_LINE_MEMBER(pet_state::gb_w) @@ -612,23 +592,6 @@ TIMER_CALLBACK_MEMBER(pet_state::pet_interrupt) } -TIMER_CALLBACK_MEMBER(pet_state::pet_tape1_timer) -{ - pia6821_device *pia_0 = machine().device<pia6821_device>("pia_0"); -// cassette 1 - UINT8 data = (machine().device<cassette_image_device>(CASSETTE_TAG)->input() > +0.0) ? 1 : 0; - pia_0->ca1_w(data); -} - -TIMER_CALLBACK_MEMBER(pet_state::pet_tape2_timer) -{ - via6522_device *via_0 = machine().device<via6522_device>("via6522_0"); -// cassette 2 - UINT8 data = (machine().device<cassette_image_device>(CASSETTE2_TAG)->input() > +0.0) ? 1 : 0; - via_0->write_cb1(data); -} - - static void pet_common_driver_init( running_machine &machine ) { int i; @@ -656,10 +619,6 @@ static void pet_common_driver_init( running_machine &machine ) /* pet clock */ machine.scheduler().timer_pulse(attotime::from_msec(10), timer_expired_delegate(FUNC(pet_state::pet_interrupt),state)); - - /* datasette */ - state->m_datasette1_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(pet_state::pet_tape1_timer),state)); - state->m_datasette2_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(pet_state::pet_tape2_timer),state)); } diff --git a/src/mess/machine/petcass.h b/src/mess/machine/petcass.h index cb020d8093d..99353ea657b 100644 --- a/src/mess/machine/petcass.h +++ b/src/mess/machine/petcass.h @@ -30,6 +30,7 @@ //************************************************************************** #define PET_DATASSETTE_PORT_TAG "tape" +#define PET_DATASSETTE_PORT2_TAG "tape2" |