mirror of
https://github.com/holub/mame
synced 2025-06-07 05:13:46 +03:00
[mess] pc.c:convert mc1502 to use wd_fdc (nw)
will boot but changing disks doesn't currently work
This commit is contained in:
parent
2c9eb21bd3
commit
a01f6e9417
@ -97,7 +97,7 @@ video HW too.
|
|||||||
#include "machine/am9517a.h"
|
#include "machine/am9517a.h"
|
||||||
#include "sound/sn76496.h"
|
#include "sound/sn76496.h"
|
||||||
|
|
||||||
#include "machine/wd17xx.h"
|
#include "machine/wd_fdc.h"
|
||||||
#include "machine/kb_7007_3.h"
|
#include "machine/kb_7007_3.h"
|
||||||
|
|
||||||
#include "machine/ram.h"
|
#include "machine/ram.h"
|
||||||
@ -161,10 +161,7 @@ static ADDRESS_MAP_START(mc1502_io, AS_IO, 8, pc_state )
|
|||||||
AM_RANGE(0x0100, 0x0100) AM_READWRITE(mc1502_wd17xx_aux_r, mc1502_wd17xx_aux_w)
|
AM_RANGE(0x0100, 0x0100) AM_READWRITE(mc1502_wd17xx_aux_r, mc1502_wd17xx_aux_w)
|
||||||
AM_RANGE(0x0108, 0x0108) AM_READ(mc1502_wd17xx_drq_r) // blocking read!
|
AM_RANGE(0x0108, 0x0108) AM_READ(mc1502_wd17xx_drq_r) // blocking read!
|
||||||
AM_RANGE(0x010a, 0x010a) AM_READ(mc1502_wd17xx_motor_r)
|
AM_RANGE(0x010a, 0x010a) AM_READ(mc1502_wd17xx_motor_r)
|
||||||
AM_RANGE(0x010c, 0x010c) AM_DEVREADWRITE_LEGACY("vg93", wd17xx_status_r, wd17xx_command_w)
|
AM_RANGE(0x010c, 0x010f) AM_DEVREADWRITE("vg93", fd1793_t, read, write)
|
||||||
AM_RANGE(0x010d, 0x010d) AM_DEVREADWRITE_LEGACY("vg93", wd17xx_track_r, wd17xx_track_w)
|
|
||||||
AM_RANGE(0x010e, 0x010e) AM_DEVREADWRITE_LEGACY("vg93", wd17xx_sector_r, wd17xx_sector_w)
|
|
||||||
AM_RANGE(0x010f, 0x010f) AM_DEVREADWRITE_LEGACY("vg93", wd17xx_data_r, wd17xx_data_w)
|
|
||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
static ADDRESS_MAP_START( zenith_map, AS_PROGRAM, 8, pc_state )
|
static ADDRESS_MAP_START( zenith_map, AS_PROGRAM, 8, pc_state )
|
||||||
@ -867,19 +864,6 @@ static const pc_lpt_interface pc_lpt_config =
|
|||||||
DEVCB_CPU_INPUT_LINE("maincpu", 0)
|
DEVCB_CPU_INPUT_LINE("maincpu", 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
static const floppy_interface mc1502_floppy_interface =
|
|
||||||
{
|
|
||||||
DEVCB_NULL,
|
|
||||||
DEVCB_NULL,
|
|
||||||
DEVCB_NULL,
|
|
||||||
DEVCB_NULL,
|
|
||||||
DEVCB_NULL,
|
|
||||||
FLOPPY_STANDARD_5_25_DSHD,
|
|
||||||
LEGACY_FLOPPY_OPTIONS_NAME(pc),
|
|
||||||
"floppy_5_25",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
FLOPPY_FORMATS_MEMBER( pc_state::floppy_formats )
|
FLOPPY_FORMATS_MEMBER( pc_state::floppy_formats )
|
||||||
FLOPPY_PC_FORMAT
|
FLOPPY_PC_FORMAT
|
||||||
FLOPPY_FORMATS_END
|
FLOPPY_FORMATS_END
|
||||||
@ -1398,8 +1382,9 @@ static MACHINE_CONFIG_START( mc1502, pc_state )
|
|||||||
/* cassette */
|
/* cassette */
|
||||||
MCFG_CASSETTE_ADD( CASSETTE_TAG, mc1502_cassette_interface ) // has no motor control
|
MCFG_CASSETTE_ADD( CASSETTE_TAG, mc1502_cassette_interface ) // has no motor control
|
||||||
|
|
||||||
MCFG_FD1793_ADD( "vg93", default_wd17xx_interface_2_drives )
|
MCFG_FD1793x_ADD("vg93", XTAL_8MHz / 8) // clock?
|
||||||
MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(mc1502_floppy_interface)
|
MCFG_FLOPPY_DRIVE_ADD("fd0", ibmpc_floppies, "525dd", 0, pc_state::floppy_formats)
|
||||||
|
MCFG_FLOPPY_DRIVE_ADD("fd1", ibmpc_floppies, "525dd", 0, pc_state::floppy_formats)
|
||||||
|
|
||||||
/* internal ram */
|
/* internal ram */
|
||||||
MCFG_RAM_ADD(RAM_TAG)
|
MCFG_RAM_ADD(RAM_TAG)
|
||||||
|
@ -145,6 +145,7 @@ public:
|
|||||||
void fdc_dma_drq(bool state);
|
void fdc_dma_drq(bool state);
|
||||||
void pc_select_dma_channel(int channel, bool state);
|
void pc_select_dma_channel(int channel, bool state);
|
||||||
void pc_eop_w(int channel, bool state);
|
void pc_eop_w(int channel, bool state);
|
||||||
|
void mc1502_fdc_irq_drq(bool state);
|
||||||
DECLARE_FLOPPY_FORMATS( floppy_formats );
|
DECLARE_FLOPPY_FORMATS( floppy_formats );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "sound/speaker.h"
|
#include "sound/speaker.h"
|
||||||
|
|
||||||
#include "machine/am9517a.h"
|
#include "machine/am9517a.h"
|
||||||
#include "machine/wd17xx.h"
|
#include "machine/wd_fdc.h"
|
||||||
|
|
||||||
#include "machine/ram.h"
|
#include "machine/ram.h"
|
||||||
|
|
||||||
@ -1280,16 +1280,22 @@ READ8_MEMBER(pc_state::mc1502_wd17xx_aux_r)
|
|||||||
|
|
||||||
WRITE8_MEMBER(pc_state::mc1502_wd17xx_aux_w)
|
WRITE8_MEMBER(pc_state::mc1502_wd17xx_aux_w)
|
||||||
{
|
{
|
||||||
|
fd1793_t *fdc = machine().device<fd1793_t>("vg93");
|
||||||
|
floppy_image_device *floppy0 = machine().device<floppy_connector>("fd0")->get_device();
|
||||||
|
floppy_image_device *floppy1 = machine().device<floppy_connector>("fd1")->get_device();
|
||||||
|
floppy_image_device *floppy = ((data & 0x10)?floppy1:floppy0);
|
||||||
|
fdc->set_floppy(floppy);
|
||||||
|
|
||||||
// master reset
|
// master reset
|
||||||
wd17xx_mr_w(machine().device("vg93"), BIT(data, 0));
|
if(data & 1)
|
||||||
|
fdc->reset();
|
||||||
|
|
||||||
// SIDE ONE
|
// SIDE ONE
|
||||||
wd17xx_set_side(machine().device("vg93"), BIT(data, 1));
|
floppy->ss_w((data & 2)?1:0);
|
||||||
|
|
||||||
// bits 2, 3 -- motor on (drive 0, 1)
|
// bits 2, 3 -- motor on (drive 0, 1)
|
||||||
|
floppy0->mon_w(!(data & 4));
|
||||||
// DRIVE SEL
|
floppy1->mon_w(!(data & 8));
|
||||||
wd17xx_set_drive(machine().device("vg93"), BIT(data, 4));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1297,17 +1303,21 @@ WRITE8_MEMBER(pc_state::mc1502_wd17xx_aux_w)
|
|||||||
*/
|
*/
|
||||||
READ8_MEMBER(pc_state::mc1502_wd17xx_drq_r)
|
READ8_MEMBER(pc_state::mc1502_wd17xx_drq_r)
|
||||||
{
|
{
|
||||||
UINT8 data;
|
fd1793_t *fdc = machine().device<fd1793_t>("vg93");
|
||||||
UINT64 newpc;
|
|
||||||
|
|
||||||
data = wd17xx_drq_r(machine().device("vg93"));
|
if (!fdc->drq_r() && !fdc->intrq_r()) {
|
||||||
if (!data && !wd17xx_intrq_r(machine().device("vg93"))) {
|
/* fake cpu wait by resetting PC one insn back */
|
||||||
/* fake cpu halt by resetting PC one insn back */
|
m_maincpu->set_pc(m_maincpu->pc() - 1);
|
||||||
newpc = machine().firstcpu->pc();
|
m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
|
||||||
machine().firstcpu->set_pc( newpc - 1 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return fdc->drq_r();
|
||||||
|
}
|
||||||
|
|
||||||
|
void pc_state::mc1502_fdc_irq_drq(bool state)
|
||||||
|
{
|
||||||
|
if(state)
|
||||||
|
m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
READ8_MEMBER(pc_state::mc1502_wd17xx_motor_r)
|
READ8_MEMBER(pc_state::mc1502_wd17xx_motor_r)
|
||||||
@ -1516,6 +1526,10 @@ MACHINE_START_MEMBER(pc_state,mc1502)
|
|||||||
memset(&mc1502_keyb, 0, sizeof(mc1502_keyb));
|
memset(&mc1502_keyb, 0, sizeof(mc1502_keyb));
|
||||||
mc1502_keyb.keyb_signal_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc_state::mc1502_keyb_signal_callback),this));
|
mc1502_keyb.keyb_signal_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc_state::mc1502_keyb_signal_callback),this));
|
||||||
mc1502_keyb.keyb_signal_timer->adjust( attotime::from_msec(20), 0, attotime::from_msec(20) );
|
mc1502_keyb.keyb_signal_timer->adjust( attotime::from_msec(20), 0, attotime::from_msec(20) );
|
||||||
|
|
||||||
|
fd1793_t *fdc = machine().device<fd1793_t>("vg93");
|
||||||
|
fdc->setup_drq_cb(fd1793_t::line_cb(FUNC(pc_state::mc1502_fdc_irq_drq), this));
|
||||||
|
fdc->setup_intrq_cb(fd1793_t::line_cb(FUNC(pc_state::mc1502_fdc_irq_drq), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user