Modernized 6525tpi device. (nw)

This commit is contained in:
Ivan Vangelista 2013-10-07 18:07:46 +00:00
parent 2aba7da865
commit 6f4d8b8423
4 changed files with 508 additions and 584 deletions

File diff suppressed because it is too large Load Diff

View File

@ -36,19 +36,19 @@
struct tpi6525_interface
{
devcb_write_line out_irq_func;
devcb_write_line m_out_irq_cb;
devcb_read8 in_pa_func;
devcb_write8 out_pa_func;
devcb_read8 m_in_pa_cb;
devcb_write8 m_out_pa_cb;
devcb_read8 in_pb_func;
devcb_write8 out_pb_func;
devcb_read8 m_in_pb_cb;
devcb_write8 m_out_pb_cb;
devcb_read8 in_pc_func;
devcb_write8 out_pc_func;
devcb_read8 m_in_pc_cb;
devcb_write8 m_out_pc_cb;
devcb_write_line out_ca_func;
devcb_write_line out_cb_func;
devcb_write_line m_out_ca_cb;
devcb_write_line m_out_cb_cb;
};
@ -56,14 +56,12 @@ struct tpi6525_interface
DEVICE CONFIGURATION MACROS
***************************************************************************/
class tpi6525_device : public device_t
class tpi6525_device : public device_t,
public tpi6525_interface
{
public:
tpi6525_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~tpi6525_device() { global_free(m_token); }
// access to legacy token
void *token() const { assert(m_token != NULL); return m_token; }
~tpi6525_device() {}
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@ -77,15 +75,45 @@ public:
DECLARE_READ8_MEMBER( pa_r );
DECLARE_READ8_MEMBER( pb_r );
DECLARE_READ8_MEMBER( pc_r );
DECLARE_WRITE8_MEMBER( pa_w );
DECLARE_WRITE8_MEMBER( pb_w );
DECLARE_WRITE8_MEMBER( pc_w );
UINT8 get_ddr_a();
UINT8 get_ddr_b();
UINT8 get_ddr_c();
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
void *m_token;
devcb_resolved_write_line m_out_irq_func;
devcb_resolved_read8 m_in_pa_func;
devcb_resolved_write8 m_out_pa_func;
devcb_resolved_read8 m_in_pb_func;
devcb_resolved_write8 m_out_pb_func;
devcb_resolved_read8 m_in_pc_func;
devcb_resolved_write8 m_out_pc_func;
devcb_resolved_write_line m_out_ca_func;
devcb_resolved_write_line m_out_cb_func;
UINT8 m_port_a, m_ddr_a, m_in_a;
UINT8 m_port_b, m_ddr_b, m_in_b;
UINT8 m_port_c, m_ddr_c, m_in_c;
UINT8 m_ca_level, m_cb_level, m_interrupt_level;
UINT8 m_cr;
UINT8 m_air;
UINT8 m_irq_level[5];
void set_interrupt();
void clear_interrupt();
};
extern const device_type TPI6525;
@ -96,31 +124,5 @@ extern const device_type TPI6525;
MCFG_DEVICE_CONFIG(_intrf)
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
DECLARE_READ8_DEVICE_HANDLER( tpi6525_r );
DECLARE_WRITE8_DEVICE_HANDLER( tpi6525_w );
DECLARE_READ8_DEVICE_HANDLER( tpi6525_porta_r );
DECLARE_WRITE8_DEVICE_HANDLER( tpi6525_porta_w );
DECLARE_READ8_DEVICE_HANDLER( tpi6525_portb_r );
DECLARE_WRITE8_DEVICE_HANDLER( tpi6525_portb_w );
DECLARE_READ8_DEVICE_HANDLER( tpi6525_portc_r );
DECLARE_WRITE8_DEVICE_HANDLER( tpi6525_portc_w );
WRITE_LINE_DEVICE_HANDLER( tpi6525_i0_w );
WRITE_LINE_DEVICE_HANDLER( tpi6525_i1_w );
WRITE_LINE_DEVICE_HANDLER( tpi6525_i2_w );
WRITE_LINE_DEVICE_HANDLER( tpi6525_i3_w );
WRITE_LINE_DEVICE_HANDLER( tpi6525_i4_w );
UINT8 tpi6525_get_ddr_a(device_t *device);
UINT8 tpi6525_get_ddr_b(device_t *device);
UINT8 tpi6525_get_ddr_c(device_t *device);
#endif /* __TPI6525_H__ */

View File

@ -216,9 +216,9 @@ static READ16_HANDLER( amiga_dmac_r )
case 0x66:
case 0x67:
{
device_t *tpi = space.machine().device("tpi6525");
tpi6525_device *tpi = space.machine().device<tpi6525_device>("tpi6525");
LOG(( "DMAC: PC=%08x - TPI6525 Read(%d)\n", space.device().safe_pc(), (offset - 0x58) ));
return tpi6525_r(tpi, space, offset - 0x58);
return tpi->read(space, offset - 0x58);
}
break;
@ -343,9 +343,9 @@ static WRITE16_HANDLER( amiga_dmac_w )
case 0x66:
case 0x67:
{
device_t *tpi = space.machine().device("tpi6525");
tpi6525_device *tpi = space.machine().device<tpi6525_device>("tpi6525");
LOG(( "DMAC: PC=%08x - TPI6525 Write(%d) - data = %04x\n", space.device().safe_pc(), (offset - 0x58), data ));
tpi6525_w(tpi, space, offset - 0x58, data);
tpi->write(space, offset - 0x58, data);
}
break;
@ -431,13 +431,15 @@ static const amiga_autoconfig_device dmac_device =
READ8_DEVICE_HANDLER( amigacd_tpi6525_portc_r )
{
int ret = 0;
tpi6525_device *tpi = space.machine().device<tpi6525_device>("tpi6525");
if ( (tpi6525_get_ddr_c(device) & 0x04) == 0 ) /* if pin 2 is set to input */
if ( (tpi->get_ddr_c() & 0x04) == 0 ) /* if pin 2 is set to input */
{
ret |= matsucd_stch_r() ? 0x00 : 0x04; /* read status change signal */
}
if ( (tpi6525_get_ddr_c(device) & 0x08) == 0 ) /* if pin 3 is set to input */
if ( (tpi->get_ddr_c() & 0x08) == 0 ) /* if pin 3 is set to input */
ret |= matsucd_sten_r() ? 0x08 : 0x00; /* read enable signal */
return ret;
@ -445,10 +447,12 @@ READ8_DEVICE_HANDLER( amigacd_tpi6525_portc_r )
WRITE8_DEVICE_HANDLER( amigacd_tpi6525_portb_w )
{
if ( tpi6525_get_ddr_b(device) & 0x01 ) /* if pin 0 is set to output */
tpi6525_device *tpi = space.machine().device<tpi6525_device>("tpi6525");
if ( tpi->get_ddr_b() & 0x01 ) /* if pin 0 is set to output */
matsucd_cmd_w( data & 1 ); /* write to the /CMD signal */
if ( tpi6525_get_ddr_b(device) & 0x02 ) /* if pin 1 is set to output */
if ( tpi->get_ddr_b() & 0x02 ) /* if pin 1 is set to output */
matsucd_enable_w( data & 2 ); /* write to the /ENABLE signal */
}
@ -495,29 +499,29 @@ WRITE_LINE_DEVICE_HANDLER( amigacd_tpi6525_irq )
static void cdrom_status_enabled( running_machine &machine, int level )
{
device_t *tpi = machine.device("tpi6525");
tpi6525_device *tpi = machine.device<tpi6525_device>("tpi6525");
/* PC3 on the 6525 */
tpi6525_i3_w(tpi, level);
tpi->i3_w(level);
}
static void cdrom_status_change( running_machine &machine, int level )
{
device_t *tpi = machine.device("tpi6525");
tpi6525_device *tpi = machine.device<tpi6525_device>("tpi6525");
/* invert */
level = level ? 0 : 1;
/* PC2 on the 6525 */
tpi6525_i2_w(tpi, level);
tpi->i2_w(level);
}
static void cdrom_subcode_ready( running_machine &machine, int level )
{
device_t *tpi = machine.device("tpi6525");
tpi6525_device *tpi = machine.device<tpi6525_device>("tpi6525");
/* PC1 on the 6525 */
tpi6525_i1_w(tpi, level);
tpi->i1_w(level);
}
MACHINE_START( amigacd )

View File

@ -226,7 +226,7 @@ UINT8 c64_ieee488_device::c64_cd_r(address_space &space, offs_t offset, UINT8 da
}
else if (!io2)
{
data = tpi6525_r(m_tpi, space, offset & 0x07);
data = m_tpi->read(space, offset & 0x07);
}
return data;
@ -241,7 +241,7 @@ void c64_ieee488_device::c64_cd_w(address_space &space, offs_t offset, UINT8 dat
{
if (!io2)
{
tpi6525_w(m_tpi, space, offset & 0x07, data);
m_tpi->write(space, offset & 0x07, data);
}
m_exp->cd_w(space, offset, data, sphi2, ba, roml, romh, io1, io2);