mirror of
https://github.com/holub/mame
synced 2025-05-04 05:23:22 +03:00
6522via: Used core clock/attotime functions. [Curt Coder]
(MESS) c1551: Fixed floppy loading. [Curt Coder] (MESS) c1571: Fixed fast serial mode on C128. [Curt Coder] (MESS) 64h156: Fixed 2 MHz mode. (nw)
This commit is contained in:
parent
29c463da90
commit
dda48dfe3e
@ -118,17 +118,6 @@ inline void via6522_device::set_irq_line(int state)
|
||||
}
|
||||
}
|
||||
|
||||
attotime via6522_device::cycles_to_time(int c)
|
||||
{
|
||||
return attotime::from_hz(clock()) * c;
|
||||
}
|
||||
|
||||
|
||||
UINT32 via6522_device::time_to_cycles(attotime t)
|
||||
{
|
||||
return (t * clock()).as_double();
|
||||
}
|
||||
|
||||
|
||||
UINT16 via6522_device::get_counter1_value()
|
||||
{
|
||||
@ -136,11 +125,11 @@ UINT16 via6522_device::get_counter1_value()
|
||||
|
||||
if(m_t1_active)
|
||||
{
|
||||
val = time_to_cycles(m_t1->remaining()) - IFR_DELAY;
|
||||
val = attotime_to_clocks(m_t1->remaining()) - IFR_DELAY;
|
||||
}
|
||||
else
|
||||
{
|
||||
val = 0xffff - time_to_cycles(machine().time() - m_time1);
|
||||
val = 0xffff - attotime_to_clocks(machine().time() - m_time1);
|
||||
}
|
||||
|
||||
return val;
|
||||
@ -369,9 +358,9 @@ void via6522_device::shift()
|
||||
if (m_shift_counter)
|
||||
{
|
||||
if (SO_O2_CONTROL(m_acr)) {
|
||||
m_shift_timer->adjust(cycles_to_time(2));
|
||||
m_shift_timer->adjust(clocks_to_attotime(2));
|
||||
} else {
|
||||
m_shift_timer->adjust(cycles_to_time((m_t2ll + 2)*2));
|
||||
m_shift_timer->adjust(clocks_to_attotime((m_t2ll + 2)*2));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -419,9 +408,9 @@ void via6522_device::shift()
|
||||
if (m_shift_counter)
|
||||
{
|
||||
if (SI_O2_CONTROL(m_acr)) {
|
||||
m_shift_timer->adjust(cycles_to_time(2));
|
||||
m_shift_timer->adjust(clocks_to_attotime(2));
|
||||
} else {
|
||||
m_shift_timer->adjust(cycles_to_time((m_t2ll + 2)*2));
|
||||
m_shift_timer->adjust(clocks_to_attotime((m_t2ll + 2)*2));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -472,7 +461,7 @@ void via6522_device::device_timer(emu_timer &timer, device_timer_id id, int para
|
||||
{
|
||||
m_out_b ^= 0x80;
|
||||
}
|
||||
m_t1->adjust(cycles_to_time(TIMER1_VALUE + IFR_DELAY));
|
||||
m_t1->adjust(clocks_to_attotime(TIMER1_VALUE + IFR_DELAY));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -570,10 +559,14 @@ READ8_MEMBER( via6522_device::read )
|
||||
logerror("%s:6522VIA chip %s: Port A is being read but has no handler\n", machine().describe_context(), tag());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* combine input and output values */
|
||||
val = (m_out_a & m_ddr_a) + (m_in_a & ~m_ddr_a);
|
||||
/* combine input and output values */
|
||||
val = (m_out_a & m_ddr_a) + (m_in_a & ~m_ddr_a);
|
||||
}
|
||||
else
|
||||
{
|
||||
val = m_in_a;
|
||||
}
|
||||
|
||||
CLR_PA_INT();
|
||||
|
||||
@ -585,7 +578,7 @@ READ8_MEMBER( via6522_device::read )
|
||||
m_out_ca2_func(0);
|
||||
m_out_ca2 = 0;
|
||||
|
||||
m_ca2_timer->adjust(cycles_to_time(1));
|
||||
m_ca2_timer->adjust(clocks_to_attotime(1));
|
||||
}
|
||||
/* If CA2 is configured as output and in pulse or handshake mode,
|
||||
CA2 is set now */
|
||||
@ -650,7 +643,7 @@ READ8_MEMBER( via6522_device::read )
|
||||
clear_int(INT_T2);
|
||||
if (m_t2_active)
|
||||
{
|
||||
val = time_to_cycles(m_t2->remaining()) & 0xff;
|
||||
val = attotime_to_clocks(m_t2->remaining()) & 0xff;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -660,7 +653,7 @@ READ8_MEMBER( via6522_device::read )
|
||||
}
|
||||
else
|
||||
{
|
||||
val = (0x10000 - (time_to_cycles(machine().time() - m_time2) & 0xffff) - 1) & 0xff;
|
||||
val = (0x10000 - (attotime_to_clocks(machine().time() - m_time2) & 0xffff) - 1) & 0xff;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -668,7 +661,7 @@ READ8_MEMBER( via6522_device::read )
|
||||
case VIA_T2CH:
|
||||
if (m_t2_active)
|
||||
{
|
||||
val = time_to_cycles(m_t2->remaining()) >> 8;
|
||||
val = attotime_to_clocks(m_t2->remaining()) >> 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -678,7 +671,7 @@ READ8_MEMBER( via6522_device::read )
|
||||
}
|
||||
else
|
||||
{
|
||||
val = (0x10000 - (time_to_cycles(machine().time() - m_time2) & 0xffff) - 1) >> 8;
|
||||
val = (0x10000 - (attotime_to_clocks(machine().time() - m_time2) & 0xffff) - 1) >> 8;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -689,11 +682,11 @@ READ8_MEMBER( via6522_device::read )
|
||||
clear_int(INT_SR);
|
||||
if (SI_O2_CONTROL(m_acr))
|
||||
{
|
||||
m_shift_timer->adjust(cycles_to_time(2));
|
||||
m_shift_timer->adjust(clocks_to_attotime(2));
|
||||
}
|
||||
if (SI_T2_CONTROL(m_acr))
|
||||
{
|
||||
m_shift_timer->adjust(cycles_to_time((m_t2ll + 2)*2));
|
||||
m_shift_timer->adjust(clocks_to_attotime((m_t2ll + 2)*2));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -775,7 +768,7 @@ WRITE8_MEMBER( via6522_device::write )
|
||||
m_out_ca2_func(0);
|
||||
m_out_ca2 = 0;
|
||||
|
||||
m_ca2_timer->adjust(cycles_to_time(1));
|
||||
m_ca2_timer->adjust(clocks_to_attotime(1));
|
||||
}
|
||||
else if (CA2_AUTO_HS(m_pcr))
|
||||
{
|
||||
@ -856,7 +849,7 @@ WRITE8_MEMBER( via6522_device::write )
|
||||
m_out_b_func(0, write_data);
|
||||
}
|
||||
}
|
||||
m_t1->adjust(cycles_to_time(TIMER1_VALUE + IFR_DELAY));
|
||||
m_t1->adjust(clocks_to_attotime(TIMER1_VALUE + IFR_DELAY));
|
||||
m_t1_active = 1;
|
||||
break;
|
||||
|
||||
@ -872,12 +865,12 @@ WRITE8_MEMBER( via6522_device::write )
|
||||
|
||||
if (!T2_COUNT_PB6(m_acr))
|
||||
{
|
||||
m_t2->adjust(cycles_to_time(TIMER2_VALUE + IFR_DELAY));
|
||||
m_t2->adjust(clocks_to_attotime(TIMER2_VALUE + IFR_DELAY));
|
||||
m_t2_active = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_t2->adjust(cycles_to_time(TIMER2_VALUE));
|
||||
m_t2->adjust(clocks_to_attotime(TIMER2_VALUE));
|
||||
m_t2_active = 1;
|
||||
m_time2 = machine().time();
|
||||
}
|
||||
@ -889,11 +882,11 @@ WRITE8_MEMBER( via6522_device::write )
|
||||
clear_int(INT_SR);
|
||||
if (SO_O2_CONTROL(m_acr))
|
||||
{
|
||||
m_shift_timer->adjust(cycles_to_time(2));
|
||||
m_shift_timer->adjust(clocks_to_attotime(2));
|
||||
}
|
||||
if (SO_T2_CONTROL(m_acr))
|
||||
{
|
||||
m_shift_timer->adjust(cycles_to_time((m_t2ll + 2)*2));
|
||||
m_shift_timer->adjust(clocks_to_attotime((m_t2ll + 2)*2));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -941,7 +934,7 @@ WRITE8_MEMBER( via6522_device::write )
|
||||
}
|
||||
if (T1_CONTINUOUS(data))
|
||||
{
|
||||
m_t1->adjust(cycles_to_time(counter1 + IFR_DELAY));
|
||||
m_t1->adjust(clocks_to_attotime(counter1 + IFR_DELAY));
|
||||
m_t1_active = 1;
|
||||
}
|
||||
}
|
||||
|
@ -121,8 +121,6 @@ private:
|
||||
static const device_timer_id TIMER_T2 = 2;
|
||||
static const device_timer_id TIMER_CA2 = 3;
|
||||
|
||||
attotime cycles_to_time(int c);
|
||||
UINT32 time_to_cycles(attotime t);
|
||||
UINT16 get_counter1_value();
|
||||
|
||||
inline void set_irq_line(int state);
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
- cassette motor is turned on only for a moment while LOADing
|
||||
- c16 function ROM test fails
|
||||
- c1551 won't load anything
|
||||
- clean up keyboard handling
|
||||
- clean up TED
|
||||
- dump PLA
|
||||
@ -910,7 +909,7 @@ static MACHINE_CONFIG_START( ntsc, plus4_state )
|
||||
MCFG_QUICKLOAD_ADD("quickload", cbm_c16, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
|
||||
MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, datassette_intf, plus4_datassette_devices, "c1531", NULL)
|
||||
MCFG_CBM_IEC_ADD(iec_intf, NULL)
|
||||
MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_14_31818MHz/16, expansion_intf, plus4_expansion_cards, NULL, NULL)
|
||||
MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_14_31818MHz/16, expansion_intf, plus4_expansion_cards, "c1551", NULL)
|
||||
MCFG_PLUS4_USER_PORT_ADD(PLUS4_USER_PORT_TAG, plus4_user_port_cards, NULL, NULL)
|
||||
|
||||
// internal ram
|
||||
@ -950,7 +949,7 @@ static MACHINE_CONFIG_START( pal, plus4_state )
|
||||
MCFG_QUICKLOAD_ADD("quickload", cbm_c16, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
|
||||
MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, datassette_intf, plus4_datassette_devices, "c1531", NULL)
|
||||
MCFG_CBM_IEC_ADD(iec_intf, NULL)
|
||||
MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_17_73447MHz/20, expansion_intf, plus4_expansion_cards, NULL, NULL)
|
||||
MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_17_73447MHz/20, expansion_intf, plus4_expansion_cards, "c1551", NULL)
|
||||
MCFG_PLUS4_USER_PORT_ADD(PLUS4_USER_PORT_TAG, plus4_user_port_cards, NULL, NULL)
|
||||
|
||||
// internal ram
|
||||
|
@ -329,7 +329,7 @@ inline void c64h156_device::decode_bit()
|
||||
|
||||
int byte_sync = !(uc1b && m_soe && !uf4_qb);
|
||||
|
||||
if (LOG) logerror("BYTE %u SOE %u\n", m_byte_sync, m_soe);
|
||||
if (LOG) logerror("BYTE %u SOE %u\n", byte_sync, m_soe);
|
||||
|
||||
// UD3
|
||||
|
||||
@ -365,7 +365,20 @@ inline void c64h156_device::decode_bit()
|
||||
if (m_byte_sync != byte_sync)
|
||||
{
|
||||
m_byte_sync = byte_sync;
|
||||
m_out_byte_func(m_byte_sync);
|
||||
|
||||
if (m_accl)
|
||||
{
|
||||
if (!byte_sync)
|
||||
{
|
||||
m_accl_yb = m_ud2;
|
||||
m_accl_byte_sync = byte_sync;
|
||||
m_out_byte_func(m_accl_byte_sync);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_out_byte_func(m_byte_sync);
|
||||
}
|
||||
}
|
||||
|
||||
m_uf4_qb = uf4_qb;
|
||||
@ -405,12 +418,14 @@ c64h156_device::c64h156_device(const machine_config &mconfig, const char *tag, d
|
||||
m_last_bit_sync(0),
|
||||
m_bit_sync(0),
|
||||
m_byte_sync(1),
|
||||
m_accl_byte_sync(1),
|
||||
m_block_sync(1),
|
||||
m_ue7(0),
|
||||
m_ue7_tc(0),
|
||||
m_uf4(0),
|
||||
m_uf4_qb(0),
|
||||
m_ud2(0),
|
||||
m_accl_yb(0),
|
||||
m_u4a(0),
|
||||
m_u4b(0),
|
||||
m_ue3(0),
|
||||
@ -458,12 +473,14 @@ void c64h156_device::device_start()
|
||||
save_item(NAME(m_last_bit_sync));
|
||||
save_item(NAME(m_bit_sync));
|
||||
save_item(NAME(m_byte_sync));
|
||||
save_item(NAME(m_accl_byte_sync));
|
||||
save_item(NAME(m_block_sync));
|
||||
save_item(NAME(m_ue7));
|
||||
save_item(NAME(m_ue7_tc));
|
||||
save_item(NAME(m_uf4));
|
||||
save_item(NAME(m_uf4_qb));
|
||||
save_item(NAME(m_ud2));
|
||||
save_item(NAME(m_accl_yb));
|
||||
save_item(NAME(m_u4a));
|
||||
save_item(NAME(m_u4b));
|
||||
save_item(NAME(m_ue3));
|
||||
@ -504,10 +521,17 @@ READ8_MEMBER( c64h156_device::yb_r )
|
||||
|
||||
if (m_soe)
|
||||
{
|
||||
data = m_ud2;
|
||||
if (m_accl)
|
||||
{
|
||||
data = m_accl_yb;
|
||||
}
|
||||
else
|
||||
{
|
||||
data = m_ud2;
|
||||
}
|
||||
}
|
||||
|
||||
if (LOG) logerror("YB read %02x:%02x\n", m_ud2, data);
|
||||
if (LOG) logerror("%s YB read %02x:%02x\n", machine().describe_context(), m_ud2, data);
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -558,7 +582,32 @@ READ_LINE_MEMBER( c64h156_device::sync_r )
|
||||
|
||||
READ_LINE_MEMBER( c64h156_device::byte_r )
|
||||
{
|
||||
return m_byte_sync;
|
||||
int state = 1;
|
||||
|
||||
if (m_accl)
|
||||
{
|
||||
state = m_accl_byte_sync;
|
||||
}
|
||||
else
|
||||
{
|
||||
state = m_byte_sync;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// ted_w -
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE_LINE_MEMBER( c64h156_device::ted_w )
|
||||
{
|
||||
if (m_accl && !m_accl_byte_sync && !state)
|
||||
{
|
||||
m_accl_byte_sync = 1;
|
||||
m_out_byte_func(m_accl_byte_sync);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -110,6 +110,7 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER( accl_w );
|
||||
DECLARE_READ_LINE_MEMBER( sync_r );
|
||||
DECLARE_READ_LINE_MEMBER( byte_r );
|
||||
DECLARE_WRITE_LINE_MEMBER( ted_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( mtr_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( oe_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( soe_w );
|
||||
@ -165,7 +166,7 @@ private:
|
||||
// signals
|
||||
int m_accl; // 1/2 MHz select
|
||||
int m_ds; // density select
|
||||
int m_soe; // s? output enable
|
||||
int m_soe; // serial output enable
|
||||
int m_oe; // output enable (0 = write, 1 = read)
|
||||
|
||||
// IEC
|
||||
@ -176,12 +177,14 @@ private:
|
||||
int m_last_bit_sync;
|
||||
int m_bit_sync;
|
||||
int m_byte_sync;
|
||||
int m_accl_byte_sync;
|
||||
int m_block_sync;
|
||||
int m_ue7;
|
||||
int m_ue7_tc;
|
||||
int m_uf4;
|
||||
int m_uf4_qb;
|
||||
UINT8 m_ud2;
|
||||
UINT8 m_accl_yb;
|
||||
int m_u4a;
|
||||
int m_u4b;
|
||||
int m_ue3;
|
||||
|
@ -7,15 +7,6 @@
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
/*
|
||||
|
||||
TODO:
|
||||
|
||||
- byte latching does not match hardware behavior
|
||||
(CPU skips data bytes if implemented per schematics)
|
||||
|
||||
*/
|
||||
|
||||
#include "c1551.h"
|
||||
|
||||
|
||||
@ -118,12 +109,12 @@ WRITE8_MEMBER( c1551_device::port_w )
|
||||
|
||||
*/
|
||||
|
||||
// spindle motor
|
||||
m_ga->mtr_w(BIT(data, 2));
|
||||
|
||||
// stepper motor
|
||||
m_ga->stp_w(data & 0x03);
|
||||
|
||||
// spindle motor
|
||||
m_ga->mtr_w(BIT(data, 2));
|
||||
|
||||
// activity LED
|
||||
output_set_led_value(LED_ACT, BIT(data, 3));
|
||||
|
||||
@ -175,6 +166,24 @@ WRITE8_MEMBER( c1551_device::tcbm_data_w )
|
||||
m_tcbm_data = data;
|
||||
}
|
||||
|
||||
READ8_MEMBER( c1551_device::tpi0_r )
|
||||
{
|
||||
UINT8 data = m_tpi0->read(space, offset);
|
||||
|
||||
m_ga->ted_w(0);
|
||||
m_ga->ted_w(1);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( c1551_device::tpi0_w )
|
||||
{
|
||||
m_tpi0->write(space, offset, data);
|
||||
|
||||
m_ga->ted_w(0);
|
||||
m_ga->ted_w(1);
|
||||
}
|
||||
|
||||
READ8_MEMBER( c1551_device::tpi0_pc_r )
|
||||
{
|
||||
/*
|
||||
@ -340,7 +349,7 @@ static const tpi6525_interface tpi1_intf =
|
||||
|
||||
static ADDRESS_MAP_START( c1551_mem, AS_PROGRAM, 8, c1551_device )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x0800) AM_RAM
|
||||
AM_RANGE(0x4000, 0x4007) AM_MIRROR(0x3ff8) AM_DEVREADWRITE_LEGACY(M6523_0_TAG, tpi6525_r, tpi6525_w)
|
||||
AM_RANGE(0x4000, 0x4007) AM_MIRROR(0x3ff8) AM_READWRITE(tpi0_r, tpi0_w)
|
||||
AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION(M6510T_TAG, 0)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -353,7 +362,7 @@ static C64H156_INTERFACE( ga_intf )
|
||||
{
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL,
|
||||
DEVCB_DEVICE_LINE_MEMBER(C64H156_TAG, c64h156_device, atni_w)
|
||||
DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF, c64h156_device, atni_w)
|
||||
};
|
||||
|
||||
|
||||
@ -569,7 +578,7 @@ UINT8 c1551_device::plus4_cd_r(address_space &space, offs_t offset, UINT8 data,
|
||||
|
||||
if (tpi1_selected(offset))
|
||||
{
|
||||
data = tpi6525_r(m_tpi1, space, offset & 0x07);
|
||||
data = m_tpi1->read(space, offset & 0x07);
|
||||
}
|
||||
|
||||
return data;
|
||||
@ -584,7 +593,7 @@ void c1551_device::plus4_cd_w(address_space &space, offs_t offset, UINT8 data, i
|
||||
{
|
||||
if (tpi1_selected(offset))
|
||||
{
|
||||
tpi6525_w(m_tpi1, space, offset & 0x07, data);
|
||||
m_tpi1->write(space, offset & 0x07, data);
|
||||
}
|
||||
|
||||
m_exp->cd_w(space, offset, data, ba, cs0, c1l, c2l, cs1, c1h, c2h);
|
||||
|
@ -53,6 +53,8 @@ public:
|
||||
|
||||
DECLARE_READ8_MEMBER( tcbm_data_r );
|
||||
DECLARE_WRITE8_MEMBER( tcbm_data_w );
|
||||
DECLARE_READ8_MEMBER( tpi0_r );
|
||||
DECLARE_WRITE8_MEMBER( tpi0_w );
|
||||
DECLARE_READ8_MEMBER( yb_r );
|
||||
DECLARE_WRITE8_MEMBER( yb_w );
|
||||
DECLARE_READ8_MEMBER( tpi0_pc_r );
|
||||
|
@ -11,9 +11,8 @@
|
||||
|
||||
TODO:
|
||||
|
||||
- fast serial
|
||||
- refactor to use wd_fdc and modern floppy
|
||||
- 1541/1571 Alignment shows drive speed as 266 rpm, should be 310
|
||||
- CP/M disks
|
||||
|
||||
*/
|
||||
|
||||
@ -164,7 +163,7 @@ const rom_entry *base_c1571_device::device_rom_region() const
|
||||
static ADDRESS_MAP_START( c1571_mem, AS_PROGRAM, 8, base_c1571_device )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM
|
||||
AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x03f0) AM_DEVREADWRITE(M6522_0_TAG, via6522_device, read, write)
|
||||
AM_RANGE(0x1c00, 0x1c0f) AM_MIRROR(0x03f0) AM_DEVREADWRITE(M6522_1_TAG, via6522_device, read, write)
|
||||
AM_RANGE(0x1c00, 0x1c0f) AM_MIRROR(0x03f0) AM_READWRITE(via1_r, via1_w)
|
||||
AM_RANGE(0x2000, 0x2003) AM_MIRROR(0x1ffc) AM_DEVREADWRITE_LEGACY(WD1770_TAG, wd17xx_r, wd17xx_w)
|
||||
AM_RANGE(0x4000, 0x400f) AM_MIRROR(0x3ff0) AM_DEVREADWRITE(M6526_TAG, mos6526_device, read, write)
|
||||
AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION(M6502_TAG, 0)
|
||||
@ -227,6 +226,12 @@ WRITE8_MEMBER( base_c1571_device::via0_pa_w )
|
||||
|
||||
*/
|
||||
|
||||
// fast serial direction
|
||||
m_ser_dir = BIT(data, 1);
|
||||
|
||||
// side select
|
||||
m_ga->set_side(BIT(data, 2));
|
||||
|
||||
// 1/2 MHz
|
||||
int clock_1_2 = BIT(data, 5);
|
||||
|
||||
@ -243,25 +248,10 @@ WRITE8_MEMBER( base_c1571_device::via0_pa_w )
|
||||
m_1_2mhz = clock_1_2;
|
||||
}
|
||||
|
||||
// fast serial direction
|
||||
int ser_dir = BIT(data, 1);
|
||||
|
||||
if (m_ser_dir != ser_dir)
|
||||
{
|
||||
m_ser_dir = ser_dir;
|
||||
|
||||
set_iec_data();
|
||||
set_iec_srq();
|
||||
|
||||
m_cia->cnt_w(m_ser_dir || m_bus->srq_r());
|
||||
m_cia->sp_w(m_ser_dir || m_bus->data_r());
|
||||
}
|
||||
|
||||
// side select
|
||||
m_ga->set_side(BIT(data, 2));
|
||||
|
||||
// attention out
|
||||
m_bus->atn_w(this, !BIT(data, 6));
|
||||
|
||||
update_iec();
|
||||
}
|
||||
|
||||
READ8_MEMBER( base_c1571_device::via0_pb_r )
|
||||
@ -318,11 +308,13 @@ WRITE8_MEMBER( base_c1571_device::via0_pb_w )
|
||||
// data out
|
||||
m_data_out = BIT(data, 1);
|
||||
|
||||
// clock out
|
||||
m_bus->clk_w(this, !BIT(data, 3));
|
||||
|
||||
// attention acknowledge
|
||||
m_ga->atna_w(BIT(data, 4));
|
||||
|
||||
// clock out
|
||||
m_bus->clk_w(this, !BIT(data, 3));
|
||||
update_iec();
|
||||
}
|
||||
|
||||
READ_LINE_MEMBER( base_c1571_device::atn_in_r )
|
||||
@ -359,6 +351,24 @@ static const via6522_interface via0_intf =
|
||||
// via6522_interface via1_intf
|
||||
//-------------------------------------------------
|
||||
|
||||
READ8_MEMBER( base_c1571_device::via1_r )
|
||||
{
|
||||
UINT8 data = m_via1->read(space, offset);
|
||||
|
||||
m_ga->ted_w(!m_1_2mhz);
|
||||
m_ga->ted_w(1);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( base_c1571_device::via1_w )
|
||||
{
|
||||
m_via1->write(space, offset, data);
|
||||
|
||||
m_ga->ted_w(!m_1_2mhz);
|
||||
m_ga->ted_w(1);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( base_c1571_device::via1_irq_w )
|
||||
{
|
||||
m_via1_irq = state;
|
||||
@ -465,16 +475,14 @@ WRITE_LINE_MEMBER( base_c1571_device::cia_pc_w )
|
||||
|
||||
WRITE_LINE_MEMBER( base_c1571_device::cia_cnt_w )
|
||||
{
|
||||
// fast serial clock out
|
||||
m_cnt_out = state;
|
||||
set_iec_srq();
|
||||
update_iec();
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( base_c1571_device::cia_sp_w )
|
||||
{
|
||||
// fast serial data out
|
||||
m_sp_out = state;
|
||||
set_iec_data();
|
||||
update_iec();
|
||||
}
|
||||
|
||||
READ8_MEMBER( base_c1571_device::cia_pb_r )
|
||||
@ -507,21 +515,15 @@ static MOS6526_INTERFACE( cia_intf )
|
||||
// C64H156_INTERFACE( ga_intf )
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE_LINE_MEMBER( base_c1571_device::atn_w )
|
||||
{
|
||||
set_iec_data();
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( base_c1571_device::byte_w )
|
||||
{
|
||||
m_maincpu->set_input_line(M6502_SET_OVERFLOW, state);
|
||||
|
||||
m_via1->write_ca1(state);
|
||||
m_maincpu->set_input_line(M6502_SET_OVERFLOW, state);
|
||||
}
|
||||
|
||||
static C64H156_INTERFACE( ga_intf )
|
||||
{
|
||||
DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, atn_w),
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL,
|
||||
DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, byte_w)
|
||||
};
|
||||
@ -672,41 +674,6 @@ machine_config_constructor base_c1571_device::device_mconfig_additions() const
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// INLINE HELPERS
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// base_c1571_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
inline void base_c1571_device::set_iec_data()
|
||||
{
|
||||
int data = !m_data_out && !m_ga->atn_r();
|
||||
|
||||
// fast serial data
|
||||
if (m_ser_dir) data &= m_sp_out;
|
||||
|
||||
m_bus->data_w(this, data);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// base_c1571_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
inline void base_c1571_device::set_iec_srq()
|
||||
{
|
||||
int srq = 1;
|
||||
|
||||
// fast serial clock
|
||||
if (m_ser_dir) srq &= m_cnt_out;
|
||||
|
||||
m_bus->srq_w(this, srq);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
@ -809,10 +776,9 @@ void base_c1571_device::device_reset()
|
||||
wd17xx_mr_w(m_fdc, 1);
|
||||
|
||||
m_sp_out = 1;
|
||||
set_iec_data();
|
||||
|
||||
m_cnt_out = 1;
|
||||
set_iec_srq();
|
||||
|
||||
update_iec();
|
||||
}
|
||||
|
||||
|
||||
@ -822,7 +788,7 @@ void base_c1571_device::device_reset()
|
||||
|
||||
void base_c1571_device::cbm_iec_srq(int state)
|
||||
{
|
||||
m_cia->cnt_w(m_ser_dir || state);
|
||||
update_iec();
|
||||
}
|
||||
|
||||
|
||||
@ -832,10 +798,7 @@ void base_c1571_device::cbm_iec_srq(int state)
|
||||
|
||||
void base_c1571_device::cbm_iec_atn(int state)
|
||||
{
|
||||
m_via0->write_ca1(!state);
|
||||
m_ga->atni_w(!state);
|
||||
|
||||
set_iec_data();
|
||||
update_iec();
|
||||
}
|
||||
|
||||
|
||||
@ -845,7 +808,7 @@ void base_c1571_device::cbm_iec_atn(int state)
|
||||
|
||||
void base_c1571_device::cbm_iec_data(int state)
|
||||
{
|
||||
m_cia->sp_w(m_ser_dir || state);
|
||||
update_iec();
|
||||
}
|
||||
|
||||
|
||||
@ -893,3 +856,28 @@ void base_c1571_device::on_disk_change(device_image_interface &image)
|
||||
int wp = floppy_wpt_r(image);
|
||||
c1571->m_ga->on_disk_changed(wp);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// update_iec -
|
||||
//-------------------------------------------------
|
||||
|
||||
void base_c1571_device::update_iec()
|
||||
{
|
||||
m_cia->cnt_w(m_ser_dir || m_bus->srq_r());
|
||||
m_cia->sp_w(m_ser_dir || m_bus->data_r());
|
||||
|
||||
int atn = m_bus->atn_r();
|
||||
m_via0->write_ca1(!atn);
|
||||
m_ga->atni_w(!atn);
|
||||
|
||||
// serial data
|
||||
int data = !m_data_out && !m_ga->atn_r();
|
||||
if (m_ser_dir) data &= m_sp_out;
|
||||
m_bus->data_w(this, data);
|
||||
|
||||
// fast clock
|
||||
int srq = 1;
|
||||
if (m_ser_dir) srq &= m_cnt_out;
|
||||
m_bus->srq_w(this, srq);
|
||||
}
|
||||
|
@ -71,6 +71,8 @@ public:
|
||||
DECLARE_WRITE8_MEMBER( via0_pb_w );
|
||||
DECLARE_READ_LINE_MEMBER( atn_in_r );
|
||||
DECLARE_READ_LINE_MEMBER( wprt_r );
|
||||
DECLARE_READ8_MEMBER( via1_r );
|
||||
DECLARE_WRITE8_MEMBER( via1_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( via1_irq_w );
|
||||
DECLARE_READ8_MEMBER( via1_pb_r );
|
||||
DECLARE_WRITE8_MEMBER( via1_pb_w );
|
||||
@ -80,7 +82,6 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER( cia_sp_w );
|
||||
DECLARE_READ8_MEMBER( cia_pb_r );
|
||||
DECLARE_WRITE8_MEMBER( cia_pb_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( atn_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( byte_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( wpt_w );
|
||||
|
||||
@ -100,8 +101,7 @@ protected:
|
||||
virtual void parallel_data_w(UINT8 data);
|
||||
virtual void parallel_strobe_w(int state);
|
||||
|
||||
inline void set_iec_data();
|
||||
inline void set_iec_srq();
|
||||
void update_iec();
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<via6522_device> m_via0;
|
||||
|
@ -453,23 +453,19 @@ void base_c1581_device::cbm_iec_reset(int state)
|
||||
|
||||
void base_c1581_device::update_iec()
|
||||
{
|
||||
int atn = m_bus->atn_r();
|
||||
|
||||
m_cia->cnt_w(m_fast_ser_dir || m_bus->srq_r());
|
||||
m_cia->sp_w(m_fast_ser_dir || m_bus->data_r());
|
||||
|
||||
int atn = m_bus->atn_r();
|
||||
m_cia->flag_w(atn);
|
||||
|
||||
// serial data
|
||||
int data = !m_data_out && !(m_atn_ack && !atn);
|
||||
|
||||
if (m_fast_ser_dir) data &= m_sp_out;
|
||||
|
||||
m_bus->data_w(this, data);
|
||||
|
||||
// fast clock
|
||||
int srq = 1;
|
||||
|
||||
if (m_fast_ser_dir) srq &= m_cnt_out;
|
||||
|
||||
m_bus->srq_w(this, srq);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user