mirror of
https://github.com/holub/mame
synced 2025-06-30 16:00:01 +03:00
(MESS) pet: Added datassette slot interface. [Curt Coder]
This commit is contained in:
parent
518642d39e
commit
9cdbd18a0e
@ -653,6 +653,24 @@ static IEEE488_INTERFACE( ieee488_intf )
|
|||||||
DEVCB_NULL
|
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)
|
MCFG_PALETTE_LENGTH(ARRAY_LENGTH(pet_palette) / 3)
|
||||||
|
|
||||||
/* cassette */
|
/* cassette */
|
||||||
MCFG_CASSETTE_ADD( CASSETTE_TAG, cbm_cassette_interface )
|
MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, datassette_intf, cbm_datassette_devices, "c1530", NULL)
|
||||||
MCFG_CASSETTE_ADD( CASSETTE2_TAG, cbm_cassette_interface )
|
MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT2_TAG, datassette2_intf, cbm_datassette_devices, NULL, NULL)
|
||||||
|
|
||||||
/* via */
|
/* via */
|
||||||
MCFG_VIA6522_ADD( "via6522_0", 0, pet_via)
|
MCFG_VIA6522_ADD( "via6522_0", 0, pet_via)
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "machine/6522via.h"
|
#include "machine/6522via.h"
|
||||||
#include "machine/ieee488.h"
|
#include "machine/ieee488.h"
|
||||||
#include "imagedev/cartslot.h"
|
#include "imagedev/cartslot.h"
|
||||||
|
#include "machine/petcass.h"
|
||||||
|
|
||||||
struct spet_t
|
struct spet_t
|
||||||
{
|
{
|
||||||
@ -26,10 +27,15 @@ public:
|
|||||||
pet_state(const machine_config &mconfig, device_type type, const char *tag)
|
pet_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||||
: driver_device(mconfig, type, tag),
|
: driver_device(mconfig, type, tag),
|
||||||
m_ieee(*this, IEEE488_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_videoram(*this, "videoram"),
|
||||||
m_memory(*this, "memory"){ }
|
m_memory(*this, "memory")
|
||||||
|
{ }
|
||||||
|
|
||||||
required_device<ieee488_device> m_ieee;
|
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_pet_basic1; /* basic version 1 for quickloader */
|
||||||
int m_superpet;
|
int m_superpet;
|
||||||
@ -44,8 +50,6 @@ public:
|
|||||||
UINT8 *m_supermemory;
|
UINT8 *m_supermemory;
|
||||||
UINT8 *m_pet80_bank1_base;
|
UINT8 *m_pet80_bank1_base;
|
||||||
int m_keyline_select;
|
int m_keyline_select;
|
||||||
emu_timer *m_datasette1_timer;
|
|
||||||
emu_timer *m_datasette2_timer;
|
|
||||||
spet_t m_spet;
|
spet_t m_spet;
|
||||||
int m_pia_level;
|
int m_pia_level;
|
||||||
DECLARE_DRIVER_INIT(superpet);
|
DECLARE_DRIVER_INIT(superpet);
|
||||||
@ -58,8 +62,6 @@ public:
|
|||||||
UINT32 screen_update_pet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
UINT32 screen_update_pet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||||
INTERRUPT_GEN_MEMBER(pet_frame_interrupt);
|
INTERRUPT_GEN_MEMBER(pet_frame_interrupt);
|
||||||
TIMER_CALLBACK_MEMBER(pet_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_READ8_MEMBER(pia0_pa_r);
|
||||||
DECLARE_WRITE8_MEMBER(pia0_pa_w);
|
DECLARE_WRITE8_MEMBER(pia0_pa_w);
|
||||||
DECLARE_READ8_MEMBER(kin_r);
|
DECLARE_READ8_MEMBER(kin_r);
|
||||||
|
@ -27,6 +27,20 @@ const device_type C1530 = &device_creator<c1530_device>;
|
|||||||
const device_type C1531 = &device_creator<c1531_device>;
|
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 )
|
// MACHINE_CONFIG( c2n )
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "includes/cbm.h"
|
#include "formats/cbm_tap.h"
|
||||||
|
#include "imagedev/cassette.h"
|
||||||
#include "machine/petcass.h"
|
#include "machine/petcass.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
#include "includes/pet.h"
|
#include "includes/pet.h"
|
||||||
|
|
||||||
#include "imagedev/cartslot.h"
|
#include "imagedev/cartslot.h"
|
||||||
#include "imagedev/cassette.h"
|
|
||||||
#include "machine/ram.h"
|
#include "machine/ram.h"
|
||||||
|
|
||||||
#define VERBOSE_LEVEL 0
|
#define VERBOSE_LEVEL 0
|
||||||
@ -68,10 +67,10 @@ READ8_MEMBER(pet_state::pia0_pa_r)
|
|||||||
data |= m_keyline_select;
|
data |= m_keyline_select;
|
||||||
|
|
||||||
/* #1 cassette switch */
|
/* #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 */
|
/* #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 */
|
/* end or identify in */
|
||||||
data |= m_ieee->eoi_r() << 6;
|
data |= m_ieee->eoi_r() << 6;
|
||||||
@ -169,21 +168,12 @@ READ8_MEMBER(pet_state::petb_kin_r)
|
|||||||
READ8_MEMBER(pet_state::cass1_r)
|
READ8_MEMBER(pet_state::cass1_r)
|
||||||
{
|
{
|
||||||
// cassette 1 read
|
// 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)
|
WRITE8_MEMBER(pet_state::cass1_motor_w)
|
||||||
{
|
{
|
||||||
if (!data)
|
m_cassette->motor_w(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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE_LINE_MEMBER(pet_state::pia0_irq_w)
|
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)
|
WRITE_LINE_MEMBER(pet_state::pia1_irq_w)
|
||||||
{
|
{
|
||||||
m_pia1_irq = state;
|
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);
|
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)
|
READ_LINE_MEMBER(pet_state::cass2_r)
|
||||||
{
|
{
|
||||||
// cassette 2 read
|
return m_cassette2->read();
|
||||||
return (machine().device<cassette_image_device>(CASSETTE2_TAG)->input() > +0.0) ? 1 : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE8_MEMBER(pet_state::via_pb_w)
|
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));
|
m_ieee->atn_w(BIT(data, 2));
|
||||||
|
|
||||||
/* cassette write */
|
/* cassette write */
|
||||||
machine().device<cassette_image_device>(CASSETTE_TAG)->output(BIT(data, 3) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
|
m_cassette->write(BIT(data, 3));
|
||||||
machine().device<cassette_image_device>(CASSETTE2_TAG)->output(BIT(data, 3) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
|
m_cassette2->write(BIT(data, 3));
|
||||||
|
|
||||||
/* #2 cassette motor */
|
/* #2 cassette motor */
|
||||||
if (BIT(data, 4))
|
m_cassette2->motor_w(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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE_LINE_MEMBER(pet_state::gb_w)
|
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 )
|
static void pet_common_driver_init( running_machine &machine )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -656,10 +619,6 @@ static void pet_common_driver_init( running_machine &machine )
|
|||||||
|
|
||||||
/* pet clock */
|
/* pet clock */
|
||||||
machine.scheduler().timer_pulse(attotime::from_msec(10), timer_expired_delegate(FUNC(pet_state::pet_interrupt),state));
|
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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
|
|
||||||
#define PET_DATASSETTE_PORT_TAG "tape"
|
#define PET_DATASSETTE_PORT_TAG "tape"
|
||||||
|
#define PET_DATASSETTE_PORT2_TAG "tape2"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user