From 1f63dae13292c3bb8a610f51a533447254e79eec Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Sat, 11 Apr 2015 20:16:13 +0300 Subject: [PATCH] (MESS) c8050fdc: Fixed write protect sense. (nw) --- src/emu/bus/ieee488/c2040fdc.c | 1 - src/emu/bus/ieee488/c8050.c | 8 +- src/emu/bus/ieee488/c8050fdc.c | 54 ++----------- src/emu/bus/ieee488/c8050fdc.h | 14 +--- src/emu/machine/mos6530n.c | 131 ++++++++++++++++++-------------- src/mess/machine/victor9k_fdc.c | 14 ++-- src/mess/machine/victor9k_fdc.h | 3 - 7 files changed, 90 insertions(+), 135 deletions(-) diff --git a/src/emu/bus/ieee488/c2040fdc.c b/src/emu/bus/ieee488/c2040fdc.c index e709f9026db..bfb59db97ca 100644 --- a/src/emu/bus/ieee488/c2040fdc.c +++ b/src/emu/bus/ieee488/c2040fdc.c @@ -93,7 +93,6 @@ c2040_fdc_t::c2040_fdc_t(const machine_config &mconfig, const char *tag, device_ } - //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- diff --git a/src/emu/bus/ieee488/c8050.c b/src/emu/bus/ieee488/c8050.c index 98a21743a5e..b4c6dc4bace 100644 --- a/src/emu/bus/ieee488/c8050.c +++ b/src/emu/bus/ieee488/c8050.c @@ -549,6 +549,7 @@ static MACHINE_CONFIG_FRAGMENT( c8050 ) MCFG_MOS6530n_OUT_PB0_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, drv_sel_w)) MCFG_MOS6530n_OUT_PB1_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, ds0_w)) MCFG_MOS6530n_OUT_PB2_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, ds1_w)) + MCFG_MOS6530n_IN_PB3_CB(DEVREADLINE(FDC_TAG, c8050_fdc_t, wps_r)) MCFG_MOS6530n_IN_PB6_CB(VCC) // SINGLE SIDED MCFG_DEVICE_ADD(FDC_TAG, C8050_FDC, XTAL_12MHz/2) @@ -556,7 +557,6 @@ static MACHINE_CONFIG_FRAGMENT( c8050 ) MCFG_C8050_READY_CALLBACK(DEVWRITELINE(M6522_TAG, via6522_device, write_ca1)) MCFG_C8050_BRDY_CALLBACK(INPUTLINE(M6504_TAG, M6502_SET_OVERFLOW)) MCFG_DEVCB_XOR(1) MCFG_C8050_ERROR_CALLBACK(DEVWRITELINE(M6522_TAG, via6522_device, write_cb1)) - MCFG_C8050_WPS_CALLBACK(DEVWRITELINE(M6530_TAG, mos6530_t, pb3_w)) MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":0", c8050_floppies, "525ssqd", c8050_device::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":1", c8050_floppies, "525ssqd", c8050_device::floppy_formats) MACHINE_CONFIG_END @@ -609,6 +609,7 @@ static MACHINE_CONFIG_FRAGMENT( c8250 ) MCFG_MOS6530n_OUT_PB0_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, drv_sel_w)) MCFG_MOS6530n_OUT_PB1_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, ds0_w)) MCFG_MOS6530n_OUT_PB2_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, ds1_w)) + MCFG_MOS6530n_IN_PB3_CB(DEVREADLINE(FDC_TAG, c8050_fdc_t, wps_r)) MCFG_MOS6530n_OUT_PB4_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, odd_hd_w)) MCFG_MOS6530n_IN_PB6_CB(GND) // DOUBLE SIDED @@ -617,7 +618,6 @@ static MACHINE_CONFIG_FRAGMENT( c8250 ) MCFG_C8050_READY_CALLBACK(DEVWRITELINE(M6522_TAG, via6522_device, write_ca1)) MCFG_C8050_BRDY_CALLBACK(INPUTLINE(M6504_TAG, M6502_SET_OVERFLOW)) MCFG_DEVCB_XOR(1) MCFG_C8050_ERROR_CALLBACK(DEVWRITELINE(M6522_TAG, via6522_device, write_cb1)) - MCFG_C8050_WPS_CALLBACK(DEVWRITELINE(M6530_TAG, mos6530_t, pb3_w)) MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":0", c8250_floppies, "525qd", c8250_device::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":1", c8250_floppies, "525qd", c8250_device::floppy_formats) MACHINE_CONFIG_END @@ -670,6 +670,7 @@ static MACHINE_CONFIG_FRAGMENT( c8250lp ) MCFG_MOS6530n_OUT_PB0_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, drv_sel_w)) MCFG_MOS6530n_OUT_PB1_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, ds0_w)) MCFG_MOS6530n_OUT_PB2_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, ds1_w)) + MCFG_MOS6530n_IN_PB3_CB(DEVREADLINE(FDC_TAG, c8050_fdc_t, wps_r)) MCFG_MOS6530n_OUT_PB4_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, odd_hd_w)) MCFG_MOS6530n_IN_PB6_CB(GND) // DOUBLE SIDED @@ -678,7 +679,6 @@ static MACHINE_CONFIG_FRAGMENT( c8250lp ) MCFG_C8050_READY_CALLBACK(DEVWRITELINE(M6522_TAG, via6522_device, write_ca1)) MCFG_C8050_BRDY_CALLBACK(INPUTLINE(M6504_TAG, M6502_SET_OVERFLOW)) MCFG_DEVCB_XOR(1) MCFG_C8050_ERROR_CALLBACK(DEVWRITELINE(M6522_TAG, via6522_device, write_cb1)) - MCFG_C8050_WPS_CALLBACK(DEVWRITELINE(M6530_TAG, mos6530_t, pb3_w)) MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":0", c8250_floppies, "525qd", c8250lp_device::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":1", c8250_floppies, "525qd", c8250lp_device::floppy_formats) MACHINE_CONFIG_END @@ -731,6 +731,7 @@ static MACHINE_CONFIG_FRAGMENT( sfd1001 ) MCFG_MOS6530n_OUT_PB0_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, drv_sel_w)) MCFG_MOS6530n_OUT_PB1_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, ds0_w)) MCFG_MOS6530n_OUT_PB2_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, ds1_w)) + MCFG_MOS6530n_IN_PB3_CB(DEVREADLINE(FDC_TAG, c8050_fdc_t, wps_r)) MCFG_MOS6530n_OUT_PB4_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, odd_hd_w)) MCFG_MOS6530n_IN_PB6_CB(GND) // DOUBLE SIDED @@ -739,7 +740,6 @@ static MACHINE_CONFIG_FRAGMENT( sfd1001 ) MCFG_C8050_READY_CALLBACK(DEVWRITELINE(M6522_TAG, via6522_device, write_ca1)) MCFG_C8050_BRDY_CALLBACK(INPUTLINE(M6504_TAG, M6502_SET_OVERFLOW)) MCFG_DEVCB_XOR(1) MCFG_C8050_ERROR_CALLBACK(DEVWRITELINE(M6522_TAG, via6522_device, write_cb1)) - MCFG_C8050_WPS_CALLBACK(DEVWRITELINE(M6530_TAG, mos6530_t, pb3_w)) MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":0", c8250_floppies, "525qd", sfd1001_device::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":1", c8250_floppies, NULL, sfd1001_device::floppy_formats) MACHINE_CONFIG_END diff --git a/src/emu/bus/ieee488/c8050fdc.c b/src/emu/bus/ieee488/c8050fdc.c index da627628e0b..a2d6344a3fd 100644 --- a/src/emu/bus/ieee488/c8050fdc.c +++ b/src/emu/bus/ieee488/c8050fdc.c @@ -79,7 +79,6 @@ c8050_fdc_t::c8050_fdc_t(const machine_config &mconfig, const char *tag, device_ m_write_ready(*this), m_write_brdy(*this), m_write_error(*this), - m_write_wps(*this), m_gcr_rom(*this, "gcr"), m_floppy0(NULL), m_floppy1(NULL), @@ -90,10 +89,7 @@ c8050_fdc_t::c8050_fdc_t(const machine_config &mconfig, const char *tag, device_ m_ds(0), m_drv_sel(0), m_mode_sel(0), - m_rw_sel(0), - m_wps(0), - m_wps0(0), - m_wps1(0) + m_rw_sel(0) { cur_live.tm = attotime::never; cur_live.state = IDLE; @@ -113,7 +109,6 @@ void c8050_fdc_t::device_start() m_write_ready.resolve_safe(); m_write_brdy.resolve_safe(); m_write_error.resolve_safe(); - m_write_wps.resolve_safe(); // allocate timer t_gen = timer_alloc(0); @@ -127,6 +122,8 @@ void c8050_fdc_t::device_start() save_item(NAME(m_drv_sel)); save_item(NAME(m_mode_sel)); save_item(NAME(m_rw_sel)); + save_item(NAME(m_odd_hd)); + save_item(NAME(m_pi)); } @@ -222,47 +219,7 @@ void c8050_fdc_t::ds_w(int ds) void c8050_fdc_t::set_floppy(floppy_image_device *floppy0, floppy_image_device *floppy1) { m_floppy0 = floppy0; - m_floppy0->setup_wpt_cb(floppy_image_device::wpt_cb(FUNC(c8050_fdc_t::wps0_w), this)); - - if (floppy1) { - m_floppy1 = floppy1; - m_floppy1->setup_wpt_cb(floppy_image_device::wpt_cb(FUNC(c8050_fdc_t::wps1_w), this)); - } -} - -void c8050_fdc_t::update_wps() -{ - int state = m_drv_sel ? m_wps1 : m_wps0; - - if (m_wps != state) - { - m_wps = state; - m_write_wps(m_wps); - } -} - -void c8050_fdc_t::wps0_w(floppy_image_device *floppy, int state) -{ - if (m_wps0 != state) - { - live_sync(); - m_wps0 = state; - update_wps(); - checkpoint(); - live_run(); - } -} - -void c8050_fdc_t::wps1_w(floppy_image_device *floppy, int state) -{ - if (m_wps1 != state) - { - live_sync(); - m_wps0 = state; - update_wps(); - checkpoint(); - live_run(); - } + m_floppy1 = floppy1; } void c8050_fdc_t::live_start() @@ -281,7 +238,6 @@ void c8050_fdc_t::live_start() cur_live.mode_sel = m_mode_sel; cur_live.rw_sel = m_rw_sel; cur_live.pi = m_pi; - cur_live.wps = m_wps; pll_reset(cur_live.tm, attotime::from_hz(clock() / (16 - m_ds))); checkpoint_live = cur_live; @@ -408,6 +364,7 @@ void c8050_fdc_t::live_run(const attotime &limit) if (cur_live.tm > limit) return; + // read bit int bit = pll_get_next_bit(cur_live.tm, get_floppy(), limit); if(bit < 0) return; @@ -563,7 +520,6 @@ WRITE_LINE_MEMBER( c8050_fdc_t::drv_sel_w ) { live_sync(); m_drv_sel = cur_live.drv_sel = state; - update_wps(); checkpoint(); if (LOG) logerror("%s %s DRV SEL %u\n", machine().time().as_string(), machine().describe_context(), state); live_run(); diff --git a/src/emu/bus/ieee488/c8050fdc.h b/src/emu/bus/ieee488/c8050fdc.h index 7d72bdfafe8..d5ef221d0f4 100644 --- a/src/emu/bus/ieee488/c8050fdc.h +++ b/src/emu/bus/ieee488/c8050fdc.h @@ -38,9 +38,6 @@ #define MCFG_C8050_ERROR_CALLBACK(_write) \ devcb = &c8050_fdc_t::set_error_wr_callback(*device, DEVCB_##_write); -#define MCFG_C8050_WPS_CALLBACK(_write) \ - devcb = &c8050_fdc_t::set_wps_wr_callback(*device, DEVCB_##_write); - //************************************************************************** @@ -59,7 +56,6 @@ public: template static devcb_base &set_ready_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_ready.set_callback(object); } template static devcb_base &set_brdy_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_brdy.set_callback(object); } template static devcb_base &set_error_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_error.set_callback(object); } - template static devcb_base &set_wps_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_wps.set_callback(object); } DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); @@ -74,13 +70,13 @@ public: DECLARE_WRITE_LINE_MEMBER( odd_hd_w ); DECLARE_WRITE_LINE_MEMBER( pull_sync_w ); + DECLARE_READ_LINE_MEMBER( wps_r ) { return checkpoint_live.drv_sel ? m_floppy1->wpt_r() : m_floppy0->wpt_r(); } + void stp0_w(int stp); void stp1_w(int stp); void ds_w(int ds); void set_floppy(floppy_image_device *floppy0, floppy_image_device *floppy1); - void wps0_w(floppy_image_device *floppy, int state); - void wps1_w(floppy_image_device *floppy, int state); protected: // device-level overrides @@ -92,7 +88,6 @@ protected: virtual const rom_entry *device_rom_region() const; void stp_w(floppy_image_device *floppy, int mtr, int &old_stp, int stp); - void update_wps(); enum { IDLE, @@ -123,14 +118,12 @@ protected: UINT8 pi; UINT16 shift_reg_write; - int wps; }; devcb_write_line m_write_sync; devcb_write_line m_write_ready; devcb_write_line m_write_brdy; devcb_write_line m_write_error; - devcb_write_line m_write_wps; required_memory_region m_gcr_rom; @@ -149,9 +142,6 @@ protected: int m_rw_sel; int m_odd_hd; UINT8 m_pi; - int m_wps; - int m_wps0; - int m_wps1; live_info cur_live, checkpoint_live; fdc_pll_t cur_pll, checkpoint_pll; diff --git a/src/emu/machine/mos6530n.c b/src/emu/machine/mos6530n.c index 3d5c42b88da..7afbf84b110 100644 --- a/src/emu/machine/mos6530n.c +++ b/src/emu/machine/mos6530n.c @@ -18,6 +18,7 @@ //************************************************************************** #define LOG 0 +#define LOG_TIMER 0 @@ -111,10 +112,10 @@ void mos6530_t::device_start() { // resolve callbacks m_irq_cb.resolve_safe(); - m_in_pa_cb.resolve_safe(0xff); - m_out_pa_cb.resolve_safe(); - m_in_pb_cb.resolve_safe(0xff); - m_out_pb_cb.resolve_safe(); + m_in_pa_cb.resolve(); + m_out_pa_cb.resolve(); + m_in_pb_cb.resolve(); + m_out_pb_cb.resolve(); m_in_pa0_cb.resolve_safe(1); m_in_pa1_cb.resolve_safe(1); m_in_pa2_cb.resolve_safe(1); @@ -198,16 +199,21 @@ void mos6530_t::update_pa() UINT8 ddr = m_pa_ddr; UINT8 data = (out & ddr) | (ddr ^ 0xff); - m_out_pa_cb(data); - - m_out_pa0_cb(BIT(data, 0)); - m_out_pa1_cb(BIT(data, 1)); - m_out_pa2_cb(BIT(data, 2)); - m_out_pa3_cb(BIT(data, 3)); - m_out_pa4_cb(BIT(data, 4)); - m_out_pa5_cb(BIT(data, 5)); - m_out_pa6_cb(BIT(data, 6)); - m_out_pa7_cb(BIT(data, 7)); + if (m_out_pa_cb.isnull()) + { + m_out_pa0_cb(BIT(data, 0)); + m_out_pa1_cb(BIT(data, 1)); + m_out_pa2_cb(BIT(data, 2)); + m_out_pa3_cb(BIT(data, 3)); + m_out_pa4_cb(BIT(data, 4)); + m_out_pa5_cb(BIT(data, 5)); + m_out_pa6_cb(BIT(data, 6)); + m_out_pa7_cb(BIT(data, 7)); + } + else + { + m_out_pa_cb(data); + } } @@ -228,16 +234,21 @@ void mos6530_t::update_pb() m_irq_cb(m_irq ? ASSERT_LINE : CLEAR_LINE); } - m_out_pb_cb(data); - - m_out_pb0_cb(BIT(data, 0)); - m_out_pb1_cb(BIT(data, 1)); - m_out_pb2_cb(BIT(data, 2)); - m_out_pb3_cb(BIT(data, 3)); - m_out_pb4_cb(BIT(data, 4)); - m_out_pb5_cb(BIT(data, 5)); - m_out_pb6_cb(BIT(data, 6)); - m_out_pb7_cb(BIT(data, 7)); + if (m_out_pb_cb.isnull()) + { + m_out_pb0_cb(BIT(data, 0)); + m_out_pb1_cb(BIT(data, 1)); + m_out_pb2_cb(BIT(data, 2)); + m_out_pb3_cb(BIT(data, 3)); + m_out_pb4_cb(BIT(data, 4)); + m_out_pb5_cb(BIT(data, 5)); + m_out_pb6_cb(BIT(data, 6)); + m_out_pb7_cb(BIT(data, 7)); + } + else + { + m_out_pb_cb(data); + } } @@ -247,9 +258,8 @@ void mos6530_t::update_pb() void mos6530_t::pa_w(int bit, int state) { - m_pa_in &= ~(2 << bit); - - if (state) m_pa_in |= (2 << bit); + m_pa_in &= ~(1 << bit); + m_pa_in |= (state << bit); } @@ -259,9 +269,8 @@ void mos6530_t::pa_w(int bit, int state) void mos6530_t::pb_w(int bit, int state) { - m_pb_in &= ~(2 << bit); - - if (state) m_pb_in |= (2 << bit); + m_pb_in &= ~(1 << bit); + m_pb_in |= (state << bit); } @@ -275,14 +284,14 @@ READ8_MEMBER( mos6530_t::pa_data_r ) if (m_in_pa_cb.isnull()) { - in |= m_in_pa0_cb.isnull() ? BIT(m_pa_in, 0) : m_in_pa0_cb() << 0; - in |= m_in_pa1_cb.isnull() ? BIT(m_pa_in, 1) : m_in_pa1_cb() << 1; - in |= m_in_pa2_cb.isnull() ? BIT(m_pa_in, 2) : m_in_pa2_cb() << 2; - in |= m_in_pa3_cb.isnull() ? BIT(m_pa_in, 3) : m_in_pa3_cb() << 3; - in |= m_in_pa4_cb.isnull() ? BIT(m_pa_in, 4) : m_in_pa4_cb() << 4; - in |= m_in_pa5_cb.isnull() ? BIT(m_pa_in, 5) : m_in_pa5_cb() << 5; - in |= m_in_pa6_cb.isnull() ? BIT(m_pa_in, 6) : m_in_pa6_cb() << 6; - in |= m_in_pa7_cb.isnull() ? BIT(m_pa_in, 7) : m_in_pa7_cb() << 7; + in |= (m_in_pa0_cb.isnull() ? BIT(m_pa_in, 0) : m_in_pa0_cb()); + in |= (m_in_pa1_cb.isnull() ? BIT(m_pa_in, 1) : m_in_pa1_cb()) << 1; + in |= (m_in_pa2_cb.isnull() ? BIT(m_pa_in, 2) : m_in_pa2_cb()) << 2; + in |= (m_in_pa3_cb.isnull() ? BIT(m_pa_in, 3) : m_in_pa3_cb()) << 3; + in |= (m_in_pa4_cb.isnull() ? BIT(m_pa_in, 4) : m_in_pa4_cb()) << 4; + in |= (m_in_pa5_cb.isnull() ? BIT(m_pa_in, 5) : m_in_pa5_cb()) << 5; + in |= (m_in_pa6_cb.isnull() ? BIT(m_pa_in, 6) : m_in_pa6_cb()) << 6; + in |= (m_in_pa7_cb.isnull() ? BIT(m_pa_in, 7) : m_in_pa7_cb()) << 7; } else { @@ -290,9 +299,13 @@ READ8_MEMBER( mos6530_t::pa_data_r ) } UINT8 out = m_pa_out; - UINT8 ddr = m_pa_ddr; + UINT8 ddr_out = m_pa_ddr; + UINT8 ddr_in = m_pa_ddr ^ 0xff; + UINT8 data = (out & ddr_out) | (in & ddr_in); - return (out & ddr) | (in & (ddr ^ 0xff)); + if (LOG) logerror("%s %s MOS6530 '%s' Port A Data In %02x\n", machine().time().as_string(), machine().describe_context(), tag(), data); + + return data; } @@ -304,7 +317,7 @@ WRITE8_MEMBER( mos6530_t::pa_data_w ) { m_pa_out = data; - if (LOG) logerror("%s %s MOS6530 '%s' Port A data %02x\n", machine().time().as_string(), machine().describe_context(), tag(), data); + if (LOG) logerror("%s %s MOS6530 '%s' Port A Data Out %02x\n", machine().time().as_string(), machine().describe_context(), tag(), data); update_pa(); } @@ -334,14 +347,14 @@ READ8_MEMBER( mos6530_t::pb_data_r ) if (m_in_pb_cb.isnull()) { - in |= m_in_pb0_cb.isnull() ? BIT(m_pb_in, 0) : m_in_pb0_cb() << 0; - in |= m_in_pb1_cb.isnull() ? BIT(m_pb_in, 1) : m_in_pb1_cb() << 1; - in |= m_in_pb2_cb.isnull() ? BIT(m_pb_in, 2) : m_in_pb2_cb() << 2; - in |= m_in_pb3_cb.isnull() ? BIT(m_pb_in, 3) : m_in_pb3_cb() << 3; - in |= m_in_pb4_cb.isnull() ? BIT(m_pb_in, 4) : m_in_pb4_cb() << 4; - in |= m_in_pb5_cb.isnull() ? BIT(m_pb_in, 5) : m_in_pb5_cb() << 5; - in |= m_in_pb6_cb.isnull() ? BIT(m_pb_in, 6) : m_in_pb6_cb() << 6; - in |= m_in_pb7_cb.isnull() ? BIT(m_pb_in, 7) : m_in_pb7_cb() << 7; + in |= (m_in_pb0_cb.isnull() ? BIT(m_pb_in, 0) : m_in_pb0_cb()); + in |= (m_in_pb1_cb.isnull() ? BIT(m_pb_in, 1) : m_in_pb1_cb()) << 1; + in |= (m_in_pb2_cb.isnull() ? BIT(m_pb_in, 2) : m_in_pb2_cb()) << 2; + in |= (m_in_pb3_cb.isnull() ? BIT(m_pb_in, 3) : m_in_pb3_cb()) << 3; + in |= (m_in_pb4_cb.isnull() ? BIT(m_pb_in, 4) : m_in_pb4_cb()) << 4; + in |= (m_in_pb5_cb.isnull() ? BIT(m_pb_in, 5) : m_in_pb5_cb()) << 5; + in |= (m_in_pb6_cb.isnull() ? BIT(m_pb_in, 6) : m_in_pb6_cb()) << 6; + in |= (m_in_pb7_cb.isnull() ? BIT(m_pb_in, 7) : m_in_pb7_cb()) << 7; } else { @@ -349,9 +362,13 @@ READ8_MEMBER( mos6530_t::pb_data_r ) } UINT8 out = m_pb_out; - UINT8 ddr = m_pb_ddr; + UINT8 ddr_out = m_pb_ddr; + UINT8 ddr_in = m_pb_ddr ^ 0xff; + UINT8 data = (out & ddr_out) | (in & ddr_in); - return (out & ddr) | (in & (ddr ^ 0xff)); + if (LOG) logerror("%s %s MOS6530 '%s' Port B Data In %02x\n", machine().time().as_string(), machine().describe_context(), tag(), data); +logerror("PB data read %02x\n",data); + return data; } @@ -363,7 +380,7 @@ WRITE8_MEMBER( mos6530_t::pb_data_w ) { m_pb_out = data; - if (LOG) logerror("%s %s MOS6530 '%s' Port B data %02x\n", machine().time().as_string(), machine().describe_context(), tag(), data); + if (LOG) logerror("%s %s MOS6530 '%s' Port B Data Out %02x\n", machine().time().as_string(), machine().describe_context(), tag(), data); update_pb(); } @@ -438,7 +455,7 @@ WRITE8_MEMBER( mos6530_t::timer_w ) m_ie = BIT(offset, 3) ? true : false; - if (LOG) logerror("%s %s MOS6530 '%s' Timer value %02x shift %u IE %u\n", machine().time().as_string(), machine().describe_context(), tag(), data, m_shift, m_ie ? 1 : 0); + if (LOG_TIMER) logerror("%s %s MOS6530 '%s' Timer value %02x shift %u IE %u\n", machine().time().as_string(), machine().describe_context(), tag(), data, m_shift, m_ie ? 1 : 0); if (m_irq) { m_irq = false; @@ -541,7 +558,7 @@ void mos6530_t::live_run(const attotime &limit) cur_live.value--; - if (LOG) logerror("%s MOS6530 '%s' timer %02x IRQ 1\n", cur_live.tm.as_string(), tag(), cur_live.value); + if (LOG_TIMER) logerror("%s MOS6530 '%s' timer %02x IRQ 1\n", cur_live.tm.as_string(), tag(), cur_live.value); if (!cur_live.value) { cur_live.period = attotime::from_hz(clock()); @@ -559,7 +576,7 @@ void mos6530_t::live_run(const attotime &limit) cur_live.value--; cur_live.irq = true; - if (LOG) logerror("%s MOS6530 '%s' timer %02x IRQ 0\n", cur_live.tm.as_string(), tag(), cur_live.value); + if (LOG_TIMER) logerror("%s MOS6530 '%s' timer %02x IRQ 0\n", cur_live.tm.as_string(), tag(), cur_live.value); live_delay(RUNNING_SYNCPOINT); @@ -568,7 +585,7 @@ void mos6530_t::live_run(const attotime &limit) } case RUNNING_SYNCPOINT: { - if (LOG) logerror("%s MOS6530 '%s' IRQ\n", machine().time().as_string(), tag()); + if (LOG_TIMER) logerror("%s MOS6530 '%s' IRQ\n", machine().time().as_string(), tag()); m_irq = true; update_pb(); @@ -584,7 +601,7 @@ void mos6530_t::live_run(const attotime &limit) cur_live.value--; - if (LOG) logerror("%s MOS6530 '%s' timer %02x IRQ 0\n", cur_live.tm.as_string(), tag(), cur_live.value); + if (LOG_TIMER) logerror("%s MOS6530 '%s' timer %02x IRQ 0\n", cur_live.tm.as_string(), tag(), cur_live.value); if (!cur_live.value) { live_abort(); diff --git a/src/mess/machine/victor9k_fdc.c b/src/mess/machine/victor9k_fdc.c index 2bdfbc85d2e..43a024a46d0 100644 --- a/src/mess/machine/victor9k_fdc.c +++ b/src/mess/machine/victor9k_fdc.c @@ -260,8 +260,6 @@ victor_9000_fdc_t::victor_9000_fdc_t(const machine_config &mconfig, const char * cur_live.tm = attotime::never; cur_live.state = IDLE; cur_live.next_state = -1; - cur_live.write_position = 0; - cur_live.write_start_time = attotime::never; } @@ -271,6 +269,11 @@ victor_9000_fdc_t::victor_9000_fdc_t(const machine_config &mconfig, const char * void victor_9000_fdc_t::device_start() { + // resolve callbacks + m_irq_cb.resolve_safe(); + m_syn_cb.resolve_safe(); + m_lbrdy_cb.resolve_safe(); + // allocate timer t_gen = timer_alloc(TM_GEN); t_tach0 = timer_alloc(TM_TACH0); @@ -314,11 +317,6 @@ void victor_9000_fdc_t::device_reset() { live_abort(); - // resolve callbacks - m_irq_cb.resolve_safe(); - m_syn_cb.resolve_safe(); - m_lbrdy_cb.resolve_safe(); - // reset devices m_via4->reset(); m_via5->reset(); @@ -1176,8 +1174,6 @@ void victor_9000_fdc_t::live_abort() cur_live.tm = attotime::never; cur_live.state = IDLE; cur_live.next_state = -1; - cur_live.write_position = 0; - cur_live.write_start_time = attotime::never; cur_live.brdy = 1; cur_live.lbrdy_changed = true; diff --git a/src/mess/machine/victor9k_fdc.h b/src/mess/machine/victor9k_fdc.h index 42ceb0a7380..f107e718452 100644 --- a/src/mess/machine/victor9k_fdc.h +++ b/src/mess/machine/victor9k_fdc.h @@ -148,9 +148,6 @@ private: // write UINT16 shift_reg_write; - attotime write_start_time; - attotime write_buffer[32]; - int write_position; UINT8 wd; int wrsync; int gcr_data;