summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Curt Coder <curtcoder@mail.com>2013-01-09 17:56:14 +0000
committer Curt Coder <curtcoder@mail.com>2013-01-09 17:56:14 +0000
commit1568a656f86633b0c31af12ea496ceb66726d128 (patch)
treee70449545a64f974af84d386b58115d6d15bb04a
parent8cc9070d278adbc634b8e88f88bc266025a93ad9 (diff)
(MESS) bw12, xerox820, wangpc: Fixed floppy. [Curt Coder]
-rw-r--r--src/emu/machine/upd765.c1
-rw-r--r--src/emu/machine/z80dart.c1
-rw-r--r--src/lib/formats/upd765_dsk.c2
-rw-r--r--src/mess/drivers/bw12.c30
-rw-r--r--src/mess/drivers/wangpc.c150
-rw-r--r--src/mess/drivers/xerox820.c35
-rw-r--r--src/mess/includes/bw12.h4
-rw-r--r--src/mess/includes/wangpc.h17
-rw-r--r--src/mess/includes/xerox820.h9
9 files changed, 107 insertions, 142 deletions
diff --git a/src/emu/machine/upd765.c b/src/emu/machine/upd765.c
index b8c866b59e1..057b081562c 100644
--- a/src/emu/machine/upd765.c
+++ b/src/emu/machine/upd765.c
@@ -387,6 +387,7 @@ WRITE8_MEMBER(upd765_family_device::fifo_w)
main_phase = PHASE_RESULT;
result[0] = ST0_UNK;
result_pos = 1;
+ command_pos = 0;
return;
}
start_command(cmd);
diff --git a/src/emu/machine/z80dart.c b/src/emu/machine/z80dart.c
index ff90187c642..074e136f183 100644
--- a/src/emu/machine/z80dart.c
+++ b/src/emu/machine/z80dart.c
@@ -639,6 +639,7 @@ void z80dart_device::dart_channel::reset()
// disable transmitter
m_wr[5] &= ~WR5_TX_ENABLE;
m_tx_state = STATE_START;
+ m_rr[0] |= RR0_TX_BUFFER_EMPTY;
// reset external lines
RTS(1);
diff --git a/src/lib/formats/upd765_dsk.c b/src/lib/formats/upd765_dsk.c
index 0762f274ad7..77e0bf07aa9 100644
--- a/src/lib/formats/upd765_dsk.c
+++ b/src/lib/formats/upd765_dsk.c
@@ -108,7 +108,7 @@ void upd765_format::build_sector_description(const format &f, UINT8 *sectdata, d
floppy_image_format_t::desc_e* upd765_format::get_desc_fm(const format &f, int &current_size, int &end_gap_index)
{
- static floppy_image_format_t::desc_e desc[29] = {
+ static floppy_image_format_t::desc_e desc[26] = {
/* 00 */ { FM, 0xff, f.gap_4a },
/* 01 */ { FM, 0x00, 6 },
/* 02 */ { RAW, 0xf77a, 1 },
diff --git a/src/mess/drivers/bw12.c b/src/mess/drivers/bw12.c
index 74d7c1b831f..dc5a26c65bf 100644
--- a/src/mess/drivers/bw12.c
+++ b/src/mess/drivers/bw12.c
@@ -29,7 +29,6 @@
TODO:
- - floppy is broken
- floppy motor off timer
*/
@@ -126,30 +125,21 @@ void bw12_state::ls259_w(int address, int data)
case 5: /* MOTOR 0 */
m_motor0 = data;
-
- if (data)
- {
- m_floppy0->mon_w(0);
- }
-
- set_floppy_motor_off_timer();
break;
case 6: /* MOTOR 1 */
m_motor1 = data;
-
- if (data)
- {
- m_floppy1->mon_w(0);
- }
-
- set_floppy_motor_off_timer();
break;
case 7: /* FDC TC */
m_fdc->tc_w(data);
break;
}
+
+ m_motor_on = m_motor0 || m_motor1;
+
+ m_floppy0->mon_w(!m_motor_on);
+ m_floppy1->mon_w(!m_motor_on);
}
WRITE8_MEMBER( bw12_state::ls259_w )
@@ -664,7 +654,7 @@ static MACHINE_CONFIG_START( common, bw12_state )
/* devices */
MCFG_TIMER_DRIVER_ADD(FLOPPY_TIMER_TAG, bw12_state, floppy_motor_off_tick)
- MCFG_UPD765A_ADD(UPD765_TAG, true, true)
+ MCFG_UPD765A_ADD(UPD765_TAG, false, true)
MCFG_PIA6821_ADD(PIA6821_TAG, pia_intf)
MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_16MHz/4, sio_intf)
MCFG_PIT8253_ADD(PIT8253_TAG, pit_intf)
@@ -676,8 +666,8 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( bw12, common )
/* floppy drives */
- MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", bw12_floppies, "525dd", 0, bw12_state::bw12_floppy_formats)
MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", bw12_floppies, "525dd", 0, bw12_state::bw12_floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":2", bw12_floppies, "525dd", 0, bw12_state::bw12_floppy_formats)
// software lists
MCFG_SOFTWARE_LIST_ADD("flop_list", "bw12")
@@ -689,8 +679,8 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( bw14, common )
/* floppy drives */
- MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", bw14_floppies, "525dd", 0, bw12_state::bw14_floppy_formats)
MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", bw14_floppies, "525dd", 0, bw12_state::bw14_floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":2", bw14_floppies, "525dd", 0, bw12_state::bw14_floppy_formats)
/* internal ram */
MCFG_RAM_ADD(RAM_TAG)
@@ -712,5 +702,5 @@ ROM_END
/* System Drivers */
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */
-COMP( 1984, bw12, 0, 0, bw12, bw12, driver_device, 0, "Bondwell Holding", "Bondwell 12", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
-COMP( 1984, bw14, bw12, 0, bw14, bw12, driver_device, 0, "Bondwell Holding", "Bondwell 14", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
+COMP( 1984, bw12, 0, 0, bw12, bw12, driver_device, 0, "Bondwell Holding", "Bondwell 12", GAME_SUPPORTS_SAVE )
+COMP( 1984, bw14, bw12, 0, bw14, bw12, driver_device, 0, "Bondwell Holding", "Bondwell 14", GAME_SUPPORTS_SAVE )
diff --git a/src/mess/drivers/wangpc.c b/src/mess/drivers/wangpc.c
index e2b7ea0c4ec..fa4b9f79d15 100644
--- a/src/mess/drivers/wangpc.c
+++ b/src/mess/drivers/wangpc.c
@@ -12,6 +12,7 @@
TODO:
+ - with quantum perfect cpu gets stuck @ 49c3 mov ss,cs:[52ah]
- hard disk
*/
@@ -33,60 +34,17 @@ enum
//**************************************************************************
-// DIRECT MEMORY ACCESS
+// IMPLEMENTATION
//**************************************************************************
-void wangpc_state::select_drive(int drive, bool select)
+void wangpc_state::select_drive()
{
- if (LOG) logerror("%s: %sselect drive %u\n", machine().describe_context(), select ? "" : "De", drive + 1);
+ floppy_image_device *floppy = NULL;
- int state = select ? 0 : 1;
+ if (m_ds1) floppy = m_floppy0;
+ if (m_ds2) floppy = m_floppy1;
- if (!drive)
- {
- m_ds1 = state;
- if(state)
- m_fdc->set_floppy(m_floppy0);
- }
- else
- {
- m_ds2 = state;
- if(state)
- m_fdc->set_floppy(m_floppy1);
- }
- if(!m_ds1 && !m_ds2)
- m_fdc->set_floppy(NULL);
-}
-
-void wangpc_state::set_motor(int drive, bool motor)
-{
- if (LOG) logerror("%s: Motor %u %s\n", machine().describe_context(), drive + 1, motor ? "on" : "off");
-
- int state = motor ? 0 : 1;
-
- if (!drive)
- {
- m_floppy0->mon_w(state);
- }
- else
- {
- m_floppy1->mon_w(state);
- }
-}
-
-void wangpc_state::fdc_reset()
-{
- if (LOG) logerror("%s: FDC reset\n", machine().describe_context());
-
- m_fdc->reset();
-}
-
-void wangpc_state::fdc_tc()
-{
- if (LOG) logerror("%s: FDC TC\n", machine().describe_context());
-
- m_fdc->tc_w(true);
- m_fdc->tc_w(false);
+ m_fdc->set_floppy(floppy);
}
WRITE8_MEMBER( wangpc_state::fdc_ctrl_w )
@@ -125,145 +83,142 @@ WRITE8_MEMBER( wangpc_state::fdc_ctrl_w )
READ8_MEMBER( wangpc_state::deselect_drive1_r )
{
- select_drive(0, false);
+ m_ds1 = false;
+ select_drive();
return 0xff;
}
-
WRITE8_MEMBER( wangpc_state::deselect_drive1_w )
{
- select_drive(0, false);
+ deselect_drive1_r(space, offset);
}
-
READ8_MEMBER( wangpc_state::select_drive1_r )
{
- select_drive(0, true);
+ m_ds1 = true;
+ select_drive();
return 0xff;
}
-
WRITE8_MEMBER( wangpc_state::select_drive1_w )
{
- select_drive(0, true);
+ select_drive1_r(space, offset);
}
-
READ8_MEMBER( wangpc_state::deselect_drive2_r )
{
- select_drive(1, false);
+ m_ds2 = false;
+ select_drive();
return 0xff;
}
-
WRITE8_MEMBER( wangpc_state::deselect_drive2_w )
{
- select_drive(1, false);
+ deselect_drive2_r(space, offset);
}
-
READ8_MEMBER( wangpc_state::select_drive2_r )
{
- select_drive(1, true);
+ m_ds2 = true;
+ select_drive();
return 0xff;
}
-
WRITE8_MEMBER( wangpc_state::select_drive2_w )
{
- select_drive(1, true);
+ select_drive2_r(space, offset);
}
-
READ8_MEMBER( wangpc_state::motor1_off_r )
{
- set_motor(0, false);
+ if (LOG) logerror("%s: Drive 1 motor OFF\n", machine().describe_context());
+
+ m_floppy0->mon_w(1);
return 0xff;
}
-
WRITE8_MEMBER( wangpc_state::motor1_off_w )
{
- set_motor(0, false);
+ motor1_off_r(space, offset);
}
-
READ8_MEMBER( wangpc_state::motor1_on_r )
{
- set_motor(0, true);
+ if (LOG) logerror("%s: Drive 1 motor ON\n", machine().describe_context());
+
+ m_floppy0->mon_w(0);
return 0xff;
}
-
WRITE8_MEMBER( wangpc_state::motor1_on_w )
{
- set_motor(0, true);
+ motor1_on_r(space, offset);
}
-
READ8_MEMBER( wangpc_state::motor2_off_r )
{
- set_motor(1, false);
+ if (LOG) logerror("%s: Drive 2 motor OFF\n", machine().describe_context());
+
+ m_floppy1->mon_w(1);
return 0xff;
}
-
WRITE8_MEMBER( wangpc_state::motor2_off_w )
{
- set_motor(1, false);
+ motor2_off_r(space, offset);
}
-
READ8_MEMBER( wangpc_state::motor2_on_r )
{
- set_motor(1, true);
+ if (LOG) logerror("%s: Drive 2 motor ON\n", machine().describe_context());
+
+ m_floppy1->mon_w(0);
return 0xff;
}
-
WRITE8_MEMBER( wangpc_state::motor2_on_w )
{
- set_motor(1, true);
+ motor2_on_r(space, offset);
}
-
READ8_MEMBER( wangpc_state::fdc_reset_r )
{
- fdc_reset();
+ if (LOG) logerror("%s: FDC reset\n", machine().describe_context());
+
+ m_fdc->reset();
return 0xff;
}
-
WRITE8_MEMBER( wangpc_state::fdc_reset_w )
{
- fdc_reset();
+ fdc_reset_r(space, offset);
}
-
READ8_MEMBER( wangpc_state::fdc_tc_r )
{
- fdc_tc();
+ if (LOG) logerror("%s: FDC TC\n", machine().describe_context());
+
+ m_fdc->tc_w(1);
+ m_fdc->tc_w(0);
return 0xff;
}
-
WRITE8_MEMBER( wangpc_state::fdc_tc_w )
{
- fdc_tc();
+ fdc_tc_r(space, offset);
}
-
//-------------------------------------------------
// dma_page_w -
//-------------------------------------------------
@@ -559,7 +514,7 @@ READ8_MEMBER( wangpc_state::option_id_r )
UINT8 data = 0;
// FDC interrupt
- data |= (m_fdc_dd0 | m_fdc_dd1 | (int) m_fdc->get_irq()) << 7;
+ data |= (m_fdc_dd0 || m_fdc_dd1 || (int) m_fdc->get_irq()) << 7;
return data;
}
@@ -668,7 +623,7 @@ void wangpc_state::update_fdc_tc()
if (m_enable_eop)
m_fdc->tc_w(m_fdc_tc);
else
- m_fdc->tc_w(false);
+ m_fdc->tc_w(0);
}
WRITE_LINE_MEMBER( wangpc_state::hrq_w )
@@ -682,11 +637,11 @@ WRITE_LINE_MEMBER( wangpc_state::eop_w )
{
if (m_dack == 2)
{
- m_fdc_tc = !state;
+ m_fdc_tc = state;
update_fdc_tc();
}
- if (!state)
+ if (state)
{
if (LOG) logerror("EOP set\n");
@@ -1035,6 +990,10 @@ static SLOT_INTERFACE_START( wangpc_floppies )
SLOT_INTERFACE( "525dd", FLOPPY_525_DD )
SLOT_INTERFACE_END
+FLOPPY_FORMATS_MEMBER( wangpc_state::floppy_formats )
+ FLOPPY_PC_FORMAT
+FLOPPY_FORMATS_END
+
void wangpc_state::fdc_irq(bool state)
{
if (LOG) logerror("FDC INT %u\n", state);
@@ -1242,6 +1201,7 @@ static MACHINE_CONFIG_START( wangpc, wangpc_state )
MCFG_CPU_ADD(I8086_TAG, I8086, 8000000)
MCFG_CPU_PROGRAM_MAP(wangpc_mem)
MCFG_CPU_IO_MAP(wangpc_io)
+ //MCFG_QUANTUM_PERFECT_CPU(I8086_TAG)
// devices
MCFG_AM9517A_ADD(AM9517A_TAG, 4000000, dmac_intf)
@@ -1251,8 +1211,8 @@ static MACHINE_CONFIG_START( wangpc, wangpc_state )
MCFG_IM6402_ADD(IM6402_TAG, uart_intf)
MCFG_MC2661_ADD(SCN2661_TAG, 0, epci_intf)
MCFG_UPD765A_ADD(UPD765_TAG, false, false)
- MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", wangpc_floppies, "525dd", 0, floppy_image_device::default_floppy_formats)
- MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", wangpc_floppies, "525dd", 0, floppy_image_device::default_floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", wangpc_floppies, "525dd", 0, wangpc_state::floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", wangpc_floppies, "525dd", 0, wangpc_state::floppy_formats)
MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, centronics_intf)
MCFG_WANGPC_KEYBOARD_ADD()
diff --git a/src/mess/drivers/xerox820.c b/src/mess/drivers/xerox820.c
index 3dbea2a1ebc..8d7b6f9a8da 100644
--- a/src/mess/drivers/xerox820.c
+++ b/src/mess/drivers/xerox820.c
@@ -170,6 +170,16 @@ void xerox820ii_state::bankswitch(int bank)
}
}
+READ8_MEMBER( xerox820_state::fdc_r )
+{
+ return m_fdc->gen_r(offset) ^ 0xff;
+}
+
+WRITE8_MEMBER( xerox820_state::fdc_w )
+{
+ m_fdc->gen_w(offset, data ^ 0xff);
+}
+
WRITE8_MEMBER( xerox820_state::scroll_w )
{
m_scroll = (offset >> 8) & 0x1f;
@@ -241,7 +251,7 @@ static ADDRESS_MAP_START( xerox820_io, AS_IO, 8, xerox820_state )
AM_RANGE(0x05, 0x05) AM_MIRROR(0xff02) AM_DEVREADWRITE_LEGACY(Z80SIO_TAG, z80dart_c_r, z80dart_c_w)
AM_RANGE(0x08, 0x0b) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80PIO_GP_TAG, z80pio_device, read_alt, write_alt)
AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xff03) AM_DEVWRITE(COM8116_TAG, com8116_device, stt_w)
- AM_RANGE(0x10, 0x13) AM_MIRROR(0xff00) AM_DEVREADWRITE(FD1771_TAG, wd_fdc_t, read, write)
+ AM_RANGE(0x10, 0x13) AM_MIRROR(0xff00) AM_READWRITE(fdc_r, fdc_w)
AM_RANGE(0x14, 0x14) AM_MIRROR(0xff03) AM_MASK(0xff00) AM_WRITE(scroll_w)
AM_RANGE(0x18, 0x1b) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write)
AM_RANGE(0x1c, 0x1f) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80PIO_KB_TAG, z80pio_device, read_alt, write_alt)
@@ -652,28 +662,26 @@ static SLOT_INTERFACE_START( xerox820_floppies )
SLOT_INTERFACE( "sa850", FLOPPY_8_DSDD ) // Shugart SA-850
SLOT_INTERFACE_END
+void xerox820_state::update_nmi()
+{
+ int halt = m_maincpu->state_int(Z80_HALT);
+ int state = (halt && (m_fdc_irq || m_fdc_drq)) ? ASSERT_LINE : CLEAR_LINE;
+
+ m_maincpu->set_input_line(INPUT_LINE_NMI, state);
+}
+
void xerox820_state::fdc_intrq_w(bool state)
{
m_fdc_irq = state;
- int halt = m_maincpu->state_int(Z80_HALT);
-
- if (halt && (m_fdc_irq || m_fdc_drq))
- m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
- else
- m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
+ update_nmi();
}
void xerox820_state::fdc_drq_w(bool state)
{
m_fdc_drq = state;
- int halt = m_maincpu->state_int(Z80_HALT);
-
- if (halt && (m_fdc_irq || m_fdc_drq))
- m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
- else
- m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
+ update_nmi();
}
/* COM8116 Interface */
@@ -749,7 +757,6 @@ void xerox820_state::machine_start()
// floppy callbacks
m_fdc->setup_intrq_cb(wd_fdc_t::line_cb(FUNC(xerox820_state::fdc_intrq_w), this));
m_fdc->setup_drq_cb(wd_fdc_t::line_cb(FUNC(xerox820_state::fdc_drq_w), this));
- m_fdc->dden_w(1);
// state saving
save_item(NAME(m_keydata));
diff --git a/src/mess/includes/bw12.h b/src/mess/includes/bw12.h
index ab9f65112ee..6075a19ba66 100644
--- a/src/mess/includes/bw12.h
+++ b/src/mess/includes/bw12.h
@@ -44,8 +44,8 @@ public:
m_crtc(*this, MC6845_TAG),
m_centronics(*this, CENTRONICS_TAG),
m_ram(*this, RAM_TAG),
- m_floppy0(*this, UPD765_TAG ":0:525dd"),
- m_floppy1(*this, UPD765_TAG ":1:525dd"),
+ m_floppy0(*this, UPD765_TAG ":1:525dd"),
+ m_floppy1(*this, UPD765_TAG ":2:525dd"),
m_floppy_timer(*this, FLOPPY_TIMER_TAG),
m_video_ram(*this, "video_ram")
{ }
diff --git a/src/mess/includes/wangpc.h b/src/mess/includes/wangpc.h
index e035eb93dc1..54947908440 100644
--- a/src/mess/includes/wangpc.h
+++ b/src/mess/includes/wangpc.h
@@ -10,10 +10,10 @@
#include "machine/ctronics.h"
#include "machine/i8255.h"
#include "machine/im6402.h"
-#include "machine/pic8259.h"
+#include "machine/mc2661.h"
#include "machine/pit8253.h"
+#include "machine/pic8259.h"
#include "machine/ram.h"
-#include "machine/mc2661.h"
#include "machine/upd765.h"
#include "machine/wangpcbus.h"
#include "machine/wangpckb.h"
@@ -71,8 +71,8 @@ public:
m_fdc_dd0(0),
m_fdc_dd1(0),
m_fdc_tc(0),
- m_ds1(1),
- m_ds2(1)
+ m_ds1(false),
+ m_ds2(false)
{ }
required_device<cpu_device> m_maincpu;
@@ -93,10 +93,7 @@ public:
virtual void machine_start();
virtual void machine_reset();
- void select_drive(int drive, bool select);
- void set_motor(int drive, bool motor);
- void fdc_reset();
- void fdc_tc();
+ void select_drive();
void check_level1_interrupts();
void check_level2_interrupts();
void update_fdc_drq();
@@ -165,6 +162,8 @@ public:
DECLARE_WRITE_LINE_MEMBER( busy_w );
DECLARE_WRITE_LINE_MEMBER( bus_irq2_w );
+ DECLARE_FLOPPY_FORMATS( floppy_formats );
+
void fdc_irq(bool state);
void fdc_drq(bool state);
@@ -195,7 +194,7 @@ public:
int m_ds1;
int m_ds2;
- int m_led[6]; // HACK until keyboard works
+ int m_led[6];
};
diff --git a/src/mess/includes/xerox820.h b/src/mess/includes/xerox820.h
index 8480a766eee..882a21a0645 100644
--- a/src/mess/includes/xerox820.h
+++ b/src/mess/includes/xerox820.h
@@ -47,7 +47,11 @@ public:
m_ram(*this, RAM_TAG),
m_floppy0(*this, FD1771_TAG":0"),
m_floppy1(*this, FD1771_TAG":1"),
- m_video_ram(*this, "video_ram")
+ m_video_ram(*this, "video_ram"),
+ m_fdc_irq(0),
+ m_fdc_drq(0),
+ m_8n5(0),
+ m_400_460(0)
{ }
virtual void machine_start();
@@ -64,6 +68,8 @@ public:
required_device<floppy_connector> m_floppy0;
required_device<floppy_connector> m_floppy1;
+ DECLARE_READ8_MEMBER( fdc_r );
+ DECLARE_WRITE8_MEMBER( fdc_w );
DECLARE_WRITE8_MEMBER( scroll_w );
//DECLARE_WRITE8_MEMBER( x120_system_w );
DECLARE_READ8_MEMBER( kbpio_pa_r );
@@ -74,6 +80,7 @@ public:
void scan_keyboard();
void bankswitch(int bank);
+ void update_nmi();
void fdc_intrq_w(bool state);
void fdc_drq_w(bool state);