mirror of
https://github.com/holub/mame
synced 2025-10-07 17:27:06 +03:00
pc8801, pc88va: required_device (nw)
This commit is contained in:
parent
ee820fde51
commit
cc8fc1e6bd
@ -308,6 +308,8 @@ public:
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_screen(*this, "screen"),
|
||||
m_fdccpu(*this, "fdccpu"),
|
||||
m_fdc(*this, "upd765"),
|
||||
m_fdd(*this, "upd765:%u", 0U),
|
||||
m_pic(*this, I8214_TAG),
|
||||
m_rtc(*this, UPD1990A_TAG),
|
||||
m_cassette(*this, "cassette"),
|
||||
@ -316,10 +318,22 @@ public:
|
||||
m_opn(*this, "opn"),
|
||||
m_palette(*this, "palette")
|
||||
{ }
|
||||
void pc8801mc(machine_config &config);
|
||||
void pc8801fh(machine_config &config);
|
||||
void pc8801(machine_config &config);
|
||||
void pc8801ma(machine_config &config);
|
||||
protected:
|
||||
|
||||
virtual void video_start() override;
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
|
||||
private:
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<cpu_device> m_fdccpu;
|
||||
required_device<upd765a_device> m_fdc;
|
||||
required_device_array<floppy_connector, 2> m_fdd;
|
||||
optional_device<i8214_device> m_pic;
|
||||
required_device<upd1990a_device> m_rtc;
|
||||
required_device<cassette_image_device> m_cassette;
|
||||
@ -474,20 +488,10 @@ public:
|
||||
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
DECLARE_PALETTE_INIT(pc8801);
|
||||
void pc8801mc(machine_config &config);
|
||||
void pc8801fh(machine_config &config);
|
||||
void pc8801(machine_config &config);
|
||||
void pc8801ma(machine_config &config);
|
||||
void pc8801_io(address_map &map);
|
||||
void pc8801_mem(address_map &map);
|
||||
void pc8801fdc_io(address_map &map);
|
||||
void pc8801fdc_mem(address_map &map);
|
||||
protected:
|
||||
|
||||
virtual void video_start() override;
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
public:
|
||||
DECLARE_MACHINE_RESET(pc8801_clock_speed);
|
||||
DECLARE_MACHINE_RESET(pc8801_dic);
|
||||
DECLARE_MACHINE_RESET(pc8801_cdrom);
|
||||
@ -1881,20 +1885,20 @@ void pc8801_state::pc8801fdc_mem(address_map &map)
|
||||
TIMER_CALLBACK_MEMBER(pc8801_state::pc8801fd_upd765_tc_to_zero)
|
||||
{
|
||||
//printf("0\n");
|
||||
machine().device<upd765a_device>("upd765")->tc_w(false);
|
||||
m_fdc->tc_w(false);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(pc8801_state::upd765_mc_w)
|
||||
{
|
||||
machine().device<floppy_connector>("upd765:0")->get_device()->mon_w(!(data & 1));
|
||||
machine().device<floppy_connector>("upd765:1")->get_device()->mon_w(!(data & 2));
|
||||
m_fdd[0]->get_device()->mon_w(!(data & 1));
|
||||
m_fdd[1]->get_device()->mon_w(!(data & 2));
|
||||
}
|
||||
|
||||
READ8_MEMBER(pc8801_state::upd765_tc_r)
|
||||
{
|
||||
//printf("%04x 1\n",m_fdccpu->pc());
|
||||
|
||||
machine().device<upd765a_device>("upd765")->tc_w(true);
|
||||
m_fdc->tc_w(true);
|
||||
//TODO: I'm not convinced that this works correctly with current hook-up ... 1000 usec is needed by Aploon, a bigger value breaks Alpha.
|
||||
//OTOH, 50 seems more than enough for the new upd...
|
||||
machine().scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(pc8801_state::pc8801fd_upd765_tc_to_zero),this));
|
||||
@ -1910,10 +1914,10 @@ WRITE8_MEMBER(pc8801_state::fdc_irq_vector_w)
|
||||
WRITE8_MEMBER(pc8801_state::fdc_drive_mode_w)
|
||||
{
|
||||
logerror("FDC drive mode %02x\n", data);
|
||||
machine().device<floppy_connector>("upd765:0")->get_device()->set_rpm(data & 0x01 ? 360 : 300);
|
||||
machine().device<floppy_connector>("upd765:1")->get_device()->set_rpm(data & 0x02 ? 360 : 300);
|
||||
m_fdd[0]->get_device()->set_rpm(data & 0x01 ? 360 : 300);
|
||||
m_fdd[1]->get_device()->set_rpm(data & 0x02 ? 360 : 300);
|
||||
|
||||
machine().device<upd765a_device>("upd765")->set_rate(data & 0x20 ? 500000 : 250000);
|
||||
m_fdc->set_rate(data & 0x20 ? 500000 : 250000);
|
||||
}
|
||||
|
||||
void pc8801_state::pc8801fdc_io(address_map &map)
|
||||
@ -2403,9 +2407,9 @@ INTERRUPT_GEN_MEMBER(pc8801_state::pc8801_vrtc_irq)
|
||||
|
||||
void pc8801_state::machine_start()
|
||||
{
|
||||
machine().device<floppy_connector>("upd765:0")->get_device()->set_rpm(300);
|
||||
machine().device<floppy_connector>("upd765:1")->get_device()->set_rpm(300);
|
||||
machine().device<upd765a_device>("upd765")->set_rate(250000);
|
||||
m_fdd[0]->get_device()->set_rpm(300);
|
||||
m_fdd[1]->get_device()->set_rpm(300);
|
||||
m_fdc->set_rate(250000);
|
||||
|
||||
m_rtc->cs_w(1);
|
||||
m_rtc->oe_w(1);
|
||||
|
@ -80,15 +80,29 @@ public:
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_screen(*this, "screen"),
|
||||
m_fdc(*this, "upd765"),
|
||||
m_fdd(*this, "upd765:%u", 0U),
|
||||
m_dmac(*this, "dmac"),
|
||||
m_pic1(*this, "pic8259_master"),
|
||||
m_pic2(*this, "pic8259_slave"),
|
||||
m_palram(*this, "palram"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette") { }
|
||||
|
||||
void pc88va(machine_config &config);
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
virtual void video_start() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
||||
|
||||
private:
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<upd765a_device> m_fdc;
|
||||
required_device_array<floppy_connector, 2> m_fdd;
|
||||
required_device<am9517a_device> m_dmac;
|
||||
required_device<pic8259_device> m_pic1;
|
||||
required_device<pic8259_device> m_pic2;
|
||||
required_shared_ptr<uint16_t> m_palram;
|
||||
uint16_t m_bank_reg;
|
||||
uint16_t m_screen_ctrl_reg;
|
||||
@ -138,9 +152,6 @@ public:
|
||||
DECLARE_WRITE16_MEMBER(video_pri_w);
|
||||
DECLARE_READ8_MEMBER(backupram_dsw_r);
|
||||
DECLARE_WRITE8_MEMBER(sys_port1_w);
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
virtual void video_start() override;
|
||||
uint32_t screen_update_pc88va(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(pc88va_vrtc_irq);
|
||||
DECLARE_READ8_MEMBER(cpu_8255_c_r);
|
||||
@ -168,8 +179,8 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER(pc88va_tc_w);
|
||||
DECLARE_READ8_MEMBER(fdc_dma_r);
|
||||
DECLARE_WRITE8_MEMBER(fdc_dma_w);
|
||||
DECLARE_READ8_MEMBER(dma_memr_cb);
|
||||
DECLARE_WRITE8_MEMBER(dma_memw_cb);
|
||||
DECLARE_READ8_MEMBER(dma_memr_cb);
|
||||
DECLARE_WRITE8_MEMBER(dma_memw_cb);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(fdc_irq);
|
||||
DECLARE_WRITE_LINE_MEMBER(fdc_drq);
|
||||
@ -189,13 +200,11 @@ DECLARE_WRITE8_MEMBER(dma_memw_cb);
|
||||
void execute_spron_cmd();
|
||||
void execute_sprsw_cmd();
|
||||
|
||||
void pc88va(machine_config &config);
|
||||
void pc88va_io_map(address_map &map);
|
||||
void pc88va_map(address_map &map);
|
||||
void pc88va_z80_io_map(address_map &map);
|
||||
void pc88va_z80_map(address_map &map);
|
||||
protected:
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
};
|
||||
@ -1067,20 +1076,20 @@ TIMER_CALLBACK_MEMBER(pc88va_state::pc88va_fdc_timer)
|
||||
{
|
||||
if(m_fdc_ctrl_2 & 4) // XTMASK
|
||||
{
|
||||
machine().device<pic8259_device>( "pic8259_slave")->ir3_w(0);
|
||||
machine().device<pic8259_device>( "pic8259_slave")->ir3_w(1);
|
||||
m_pic2->ir3_w(0);
|
||||
m_pic2->ir3_w(1);
|
||||
}
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(pc88va_state::pc88va_fdc_motor_start_0)
|
||||
{
|
||||
machine().device<floppy_connector>("upd765:0")->get_device()->mon_w(0);
|
||||
m_fdd[0]->get_device()->mon_w(0);
|
||||
m_fdc_motor_status[0] = 1;
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(pc88va_state::pc88va_fdc_motor_start_1)
|
||||
{
|
||||
machine().device<floppy_connector>("upd765:1")->get_device()->mon_w(0);
|
||||
m_fdd[1]->get_device()->mon_w(0);
|
||||
m_fdc_motor_status[1] = 1;
|
||||
}
|
||||
|
||||
@ -1089,10 +1098,10 @@ void pc88va_state::pc88va_fdc_update_ready(floppy_image_device *, int)
|
||||
bool ready = m_fdc_ctrl_2 & 0x40;
|
||||
|
||||
floppy_image_device *floppy;
|
||||
floppy = machine().device<floppy_connector>("upd765:0")->get_device();
|
||||
floppy = m_fdd[0]->get_device();
|
||||
if(floppy && ready)
|
||||
ready = floppy->ready_r();
|
||||
floppy = machine().device<floppy_connector>("upd765:1")->get_device();
|
||||
floppy = m_fdd[1]->get_device();
|
||||
if(floppy && ready)
|
||||
ready = floppy->ready_r();
|
||||
|
||||
@ -1120,10 +1129,10 @@ WRITE8_MEMBER(pc88va_state::pc88va_fdc_w)
|
||||
---- --xx RV1/RV0: Drive 1/0 mode selection (0) 2D and 2DD mode (1) 2HD mode
|
||||
*/
|
||||
case 0x02: // FDC control port 0
|
||||
machine().device<floppy_connector>("upd765:0")->get_device()->set_rpm(data & 0x01 ? 360 : 300);
|
||||
machine().device<floppy_connector>("upd765:1")->get_device()->set_rpm(data & 0x02 ? 360 : 300);
|
||||
m_fdd[0]->get_device()->set_rpm(data & 0x01 ? 360 : 300);
|
||||
m_fdd[1]->get_device()->set_rpm(data & 0x02 ? 360 : 300);
|
||||
|
||||
machine().device<upd765a_device>("upd765")->set_rate(data & 0x20 ? 500000 : 250000);
|
||||
m_fdc->set_rate(data & 0x20 ? 500000 : 250000);
|
||||
break;
|
||||
/*
|
||||
---- x--- PCM: ?
|
||||
@ -1132,7 +1141,7 @@ WRITE8_MEMBER(pc88va_state::pc88va_fdc_w)
|
||||
case 0x04:
|
||||
if(data & 1)
|
||||
{
|
||||
machine().device<floppy_connector>("upd765:0")->get_device()->mon_w(1);
|
||||
m_fdd[0]->get_device()->mon_w(1);
|
||||
if(m_fdc_motor_status[0] == 0)
|
||||
timer_set(attotime::from_msec(505), TIMER_PC88VA_FDC_MOTOR_START_0);
|
||||
else
|
||||
@ -1141,7 +1150,7 @@ WRITE8_MEMBER(pc88va_state::pc88va_fdc_w)
|
||||
|
||||
if(data & 2)
|
||||
{
|
||||
machine().device<floppy_connector>("upd765:1")->get_device()->mon_w(1);
|
||||
m_fdd[1]->get_device()->mon_w(1);
|
||||
if(m_fdc_motor_status[1] == 0)
|
||||
timer_set(attotime::from_msec(505), TIMER_PC88VA_FDC_MOTOR_START_1);
|
||||
else
|
||||
@ -1165,7 +1174,7 @@ WRITE8_MEMBER(pc88va_state::pc88va_fdc_w)
|
||||
m_dmac->dreq2_w(1);
|
||||
|
||||
if(data & 0x80) // correct?
|
||||
machine().device<upd765a_device>("upd765")->reset();
|
||||
m_fdc->reset();
|
||||
|
||||
m_fdc_ctrl_2 = data;
|
||||
|
||||
@ -1199,8 +1208,8 @@ TIMER_CALLBACK_MEMBER(pc88va_state::t3_mouse_callback)
|
||||
{
|
||||
if(m_timer3_io_reg & 0x80)
|
||||
{
|
||||
machine().device<pic8259_device>("pic8259_slave")->ir5_w(0);
|
||||
machine().device<pic8259_device>("pic8259_slave")->ir5_w(1);
|
||||
m_pic2->ir5_w(0);
|
||||
m_pic2->ir5_w(1);
|
||||
m_t3_mouse_timer->adjust(attotime::from_hz(120 >> (m_timer3_io_reg & 3)));
|
||||
}
|
||||
}
|
||||
@ -1217,7 +1226,7 @@ WRITE8_MEMBER(pc88va_state::timer3_ctrl_reg_w)
|
||||
m_t3_mouse_timer->adjust(attotime::from_hz(120 >> (m_timer3_io_reg & 3)));
|
||||
else
|
||||
{
|
||||
machine().device<pic8259_device>("pic8259_slave")->ir5_w(0);
|
||||
m_pic2->ir5_w(0);
|
||||
m_t3_mouse_timer->adjust(attotime::never);
|
||||
}
|
||||
}
|
||||
@ -1329,7 +1338,7 @@ void pc88va_state::pc88va_io_map(address_map &map)
|
||||
|
||||
TIMER_CALLBACK_MEMBER(pc88va_state::pc8801fd_upd765_tc_to_zero)
|
||||
{
|
||||
machine().device<upd765a_device>("upd765")->tc_w(false);
|
||||
m_fdc->tc_w(false);
|
||||
}
|
||||
|
||||
/* FDC subsytem CPU */
|
||||
@ -1342,7 +1351,7 @@ void pc88va_state::pc88va_z80_map(address_map &map)
|
||||
|
||||
READ8_MEMBER(pc88va_state::upd765_tc_r)
|
||||
{
|
||||
machine().device<upd765a_device>("upd765")->tc_w(true);
|
||||
m_fdc->tc_w(true);
|
||||
timer_set(attotime::from_usec(50), TIMER_PC8801FD_UPD765_TC_TO_ZERO);
|
||||
return 0;
|
||||
}
|
||||
@ -1354,8 +1363,8 @@ WRITE8_MEMBER(pc88va_state::fdc_irq_vector_w)
|
||||
|
||||
WRITE8_MEMBER(pc88va_state::upd765_mc_w)
|
||||
{
|
||||
machine().device<floppy_connector>("upd765:0")->get_device()->mon_w(!(data & 1));
|
||||
machine().device<floppy_connector>("upd765:1")->get_device()->mon_w(!(data & 2));
|
||||
m_fdd[0]->get_device()->mon_w(!(data & 1));
|
||||
m_fdd[1]->get_device()->mon_w(!(data & 2));
|
||||
}
|
||||
|
||||
void pc88va_state::pc88va_z80_io_map(address_map &map)
|
||||
@ -1651,7 +1660,7 @@ WRITE8_MEMBER(pc88va_state::r232_ctrl_portc_w)
|
||||
READ8_MEMBER(pc88va_state::get_slave_ack)
|
||||
{
|
||||
if (offset==7) { // IRQ = 7
|
||||
return machine().device<pic8259_device>( "pic8259_slave")->acknowledge();
|
||||
return m_pic2->acknowledge();
|
||||
}
|
||||
return 0x00;
|
||||
}
|
||||
@ -1661,17 +1670,17 @@ void pc88va_state::machine_start()
|
||||
m_t3_mouse_timer = timer_alloc(TIMER_T3_MOUSE_CALLBACK);
|
||||
m_t3_mouse_timer->adjust(attotime::never);
|
||||
floppy_image_device *floppy;
|
||||
floppy = machine().device<floppy_connector>("upd765:0")->get_device();
|
||||
floppy = m_fdd[0]->get_device();
|
||||
if(floppy)
|
||||
floppy->setup_ready_cb(floppy_image_device::ready_cb(&pc88va_state::pc88va_fdc_update_ready, this));
|
||||
|
||||
floppy = machine().device<floppy_connector>("upd765:1")->get_device();
|
||||
floppy = m_fdd[1]->get_device();
|
||||
if(floppy)
|
||||
floppy->setup_ready_cb(floppy_image_device::ready_cb(&pc88va_state::pc88va_fdc_update_ready, this));
|
||||
|
||||
machine().device<floppy_connector>("upd765:0")->get_device()->set_rpm(300);
|
||||
machine().device<floppy_connector>("upd765:1")->get_device()->set_rpm(300);
|
||||
machine().device<upd765a_device>("upd765")->set_rate(250000);
|
||||
m_fdd[0]->get_device()->set_rpm(300);
|
||||
m_fdd[1]->get_device()->set_rpm(300);
|
||||
m_fdc->set_rate(250000);
|
||||
}
|
||||
|
||||
void pc88va_state::machine_reset()
|
||||
@ -1707,16 +1716,16 @@ void pc88va_state::machine_reset()
|
||||
|
||||
INTERRUPT_GEN_MEMBER(pc88va_state::pc88va_vrtc_irq)
|
||||
{
|
||||
machine().device<pic8259_device>("pic8259_master")->ir2_w(0);
|
||||
machine().device<pic8259_device>("pic8259_master")->ir2_w(1);
|
||||
m_pic1->ir2_w(0);
|
||||
m_pic1->ir2_w(1);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(pc88va_state::pc88va_pit_out0_changed)
|
||||
{
|
||||
if(state)
|
||||
{
|
||||
machine().device<pic8259_device>("pic8259_master")->ir0_w(0);
|
||||
machine().device<pic8259_device>("pic8259_master")->ir0_w(1);
|
||||
m_pic1->ir0_w(0);
|
||||
m_pic1->ir0_w(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1731,8 +1740,8 @@ WRITE_LINE_MEMBER( pc88va_state::fdc_irq )
|
||||
if(m_fdc_mode && state)
|
||||
{
|
||||
//printf("%d\n",state);
|
||||
machine().device<pic8259_device>( "pic8259_slave")->ir3_w(0);
|
||||
machine().device<pic8259_device>( "pic8259_slave")->ir3_w(1);
|
||||
m_pic2->ir3_w(0);
|
||||
m_pic2->ir3_w(1);
|
||||
}
|
||||
#if TEST_SUBFDC
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user