wangpc: Derive clocks from XTAL values

This commit is contained in:
AJR 2023-08-26 18:48:50 -04:00
parent 7d7b98f1bb
commit 12099b0e08

View file

@ -1243,14 +1243,14 @@ void wangpc_state::on_disk1_unload(floppy_image_device *image)
void wangpc_state::wangpc(machine_config &config)
{
I8086(config, m_maincpu, 8000000);
I8086(config, m_maincpu, 24_MHz_XTAL / 3);
m_maincpu->set_addrmap(AS_PROGRAM, &wangpc_state::wangpc_mem);
m_maincpu->set_addrmap(AS_IO, &wangpc_state::wangpc_io);
m_maincpu->set_irq_acknowledge_callback(I8259A_TAG, FUNC(pic8259_device::inta_cb));
//config.m_perfect_cpu_quantum = subtag(I8086_TAG);
// devices
AM9517A(config, m_dmac, 4000000);
AM9517A(config, m_dmac, 24_MHz_XTAL / 6);
m_dmac->dreq_active_low();
m_dmac->out_hreq_callback().set(FUNC(wangpc_state::hrq_w));
m_dmac->out_eop_callback().set(FUNC(wangpc_state::eop_w));
@ -1267,35 +1267,36 @@ void wangpc_state::wangpc(machine_config &config)
m_dmac->out_dack_callback<2>().set(FUNC(wangpc_state::dack2_w));
m_dmac->out_dack_callback<3>().set(FUNC(wangpc_state::dack3_w));
PIC8259(config, m_pic, 0);
PIC8259(config, m_pic);
m_pic->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
I8255A(config, m_ppi, 0);
I8255A(config, m_ppi);
m_ppi->in_pa_callback().set(FUNC(wangpc_state::ppi_pa_r));
m_ppi->in_pb_callback().set(FUNC(wangpc_state::ppi_pb_r));
m_ppi->in_pc_callback().set(FUNC(wangpc_state::ppi_pc_r));
m_ppi->out_pc_callback().set(FUNC(wangpc_state::ppi_pc_w));
PIT8253(config, m_pit, 0);
m_pit->set_clk<0>(500000);
PIT8253(config, m_pit);
m_pit->set_clk<0>(24_MHz_XTAL / 48);
m_pit->out_handler<0>().set(FUNC(wangpc_state::pit0_w));
m_pit->set_clk<1>(2000000);
m_pit->set_clk<2>(500000);
m_pit->set_clk<1>(24_MHz_XTAL / 12);
m_pit->set_clk<2>(24_MHz_XTAL / 48);
m_pit->out_handler<2>().set(FUNC(wangpc_state::pit2_w));
IM6402(config, m_uart, 62500*16, 62500*16);
constexpr XTAL clk1mhz = 24_MHz_XTAL / 24;
IM6402(config, m_uart, clk1mhz.value(), clk1mhz.value());
m_uart->tro_callback().set("wangpckb", FUNC(wangpc_keyboard_device::write_rxd));
m_uart->dr_callback().set(FUNC(wangpc_state::uart_dr_w));
m_uart->tbre_callback().set(FUNC(wangpc_state::uart_tbre_w));
SCN2661C(config, m_epci, 5'068'800);
SCN2661C(config, m_epci, 5.0688_MHz_XTAL);
m_epci->txd_handler().set(RS232_TAG, FUNC(rs232_port_device::write_txd));
m_epci->rxrdy_handler().set(FUNC(wangpc_state::epci_irq_w));
m_epci->rts_handler().set(RS232_TAG, FUNC(rs232_port_device::write_rts));
m_epci->dtr_handler().set(RS232_TAG, FUNC(rs232_port_device::write_dtr));
m_epci->txemt_dschg_handler().set(FUNC(wangpc_state::epci_irq_w));
UPD765A(config, m_fdc, 8'000'000, false, false);
UPD765A(config, m_fdc, 24_MHz_XTAL / 6, false, false);
m_fdc->intrq_wr_callback().set(FUNC(wangpc_state::fdc_irq));
m_fdc->drq_wr_callback().set(FUNC(wangpc_state::fdc_drq));
FLOPPY_CONNECTOR(config, UPD765_TAG ":0", wangpc_floppies, "525dd", floppy_image_device::default_pc_floppy_formats);
@ -1322,7 +1323,7 @@ void wangpc_state::wangpc(machine_config &config)
WANGPC_KEYBOARD(config, "wangpckb").txd_handler().set(m_uart, FUNC(im6402_device::rri_w));
// bus
WANGPC_BUS(config, m_bus, 0);
WANGPC_BUS(config, m_bus, 24_MHz_XTAL / 3);
m_bus->irq2_wr_callback().set(FUNC(wangpc_state::bus_irq2_w));
m_bus->irq3_wr_callback().set(m_pic, FUNC(pic8259_device::ir3_w));
m_bus->irq4_wr_callback().set(m_pic, FUNC(pic8259_device::ir4_w));