diff options
| author | 2026-04-11 00:29:37 +0200 | |
|---|---|---|
| committer | 2026-04-11 00:29:54 +0200 | |
| commit | 6e5d00aba289d9d9f51f7551b49cfee3f67965d6 (patch) | |
| tree | 1af2722ae42c657f6a8e1cf31b0a6e24688a9bf6 | |
| parent | 537a344e90456be200f9faad951547705065da6f (diff) | |
misc: small accuracy improvement for clock_device when result divided clock is not an integer
| -rw-r--r-- | src/mame/kaypro/kaypro.cpp | 4 | ||||
| -rw-r--r-- | src/mame/kaypro/kaypro.h | 2 | ||||
| -rw-r--r-- | src/mame/nascom/nascom1.cpp | 5 | ||||
| -rw-r--r-- | src/mame/novag/const.cpp | 16 | ||||
| -rw-r--r-- | src/mame/saitek/superstar.cpp | 5 | ||||
| -rw-r--r-- | src/mame/sanyo/mbc55x.cpp | 3 | ||||
| -rw-r--r-- | src/mame/ta/alphatro.cpp | 6 | ||||
| -rw-r--r-- | src/mame/zaccaria/zaccaria_a.cpp | 7 |
8 files changed, 28 insertions, 20 deletions
diff --git a/src/mame/kaypro/kaypro.cpp b/src/mame/kaypro/kaypro.cpp index c058b0de471..c7daac3cdc8 100644 --- a/src/mame/kaypro/kaypro.cpp +++ b/src/mame/kaypro/kaypro.cpp @@ -344,7 +344,9 @@ void kaypro84_state::kaypro484(machine_config &config) kbd.ser_out_callback().set("sio_1", FUNC(z80sio_device::rxb_w)); kbd.ser_out_callback().append("sio_1", FUNC(z80sio_device::syncb_w)); - CLOCK(config, "kbdtxrxc", 16_MHz_XTAL / 16 / 13 / 16).signal_handler().set("sio_1", FUNC(z80sio_device::rxtxcb_w)); + clock_device &kbdtxrxc(CLOCK(config, "kbdtxrxc")); + kbdtxrxc.set_period(attotime::from_hz(16_MHz_XTAL / 16 / 13 / 16)); + kbdtxrxc.signal_handler().set("sio_1", FUNC(z80sio_device::rxtxcb_w)); CENTRONICS(config, m_centronics, centronics_devices, "printer"); m_centronics->busy_handler().set(FUNC(kaypro84_state::write_centronics_busy)); diff --git a/src/mame/kaypro/kaypro.h b/src/mame/kaypro/kaypro.h index 42b15924cc1..52c0bc026b0 100644 --- a/src/mame/kaypro/kaypro.h +++ b/src/mame/kaypro/kaypro.h @@ -38,7 +38,7 @@ public: , m_bank3(*this, "bank3") , m_floppy_timer(*this, "floppy_timer") , m_leds(*this, "led%c", unsigned('A')) - {} + { } void init_kaypro(); diff --git a/src/mame/nascom/nascom1.cpp b/src/mame/nascom/nascom1.cpp index 99b28f38111..72a3b0bf974 100644 --- a/src/mame/nascom/nascom1.cpp +++ b/src/mame/nascom/nascom1.cpp @@ -816,7 +816,8 @@ void nascom1_state::nascom1(machine_config &config) // software SOFTWARE_LIST(config, "snap_list").set_original("nascom_snap").set_filter("NASCOM1"); - clock_device &uart_clock(CLOCK(config, "uart_clock", (16_MHz_XTAL / 16) / 256)); + clock_device &uart_clock(CLOCK(config, "uart_clock")); + uart_clock.set_period(attotime::from_hz(16_MHz_XTAL / 16 / 256)); uart_clock.signal_handler().set(FUNC(nascom1_state::nascom1_kansas_w)); uart_clock.signal_handler().append(m_hd6402, FUNC(ay31015_device::write_rcp)); TIMER(config, "kansas_r").configure_periodic(FUNC(nascom1_state::nascom1_kansas_r), attotime::from_hz(40000)); @@ -858,7 +859,7 @@ void nascom2_state::nascom2(machine_config &config) SOFTWARE_LIST(config, "socket_list").set_original("nascom_socket"); SOFTWARE_LIST(config, "floppy_list").set_original("nascom_flop"); - CLOCK(config, m_clock, (16_MHz_XTAL / 32) / 26); + CLOCK(config, m_clock).set_period(attotime::from_hz(16_MHz_XTAL / 32 / 26)); m_clock->signal_handler().set(FUNC(nascom2_state::nascom2_kansas_w)); TIMER(config, "kansas_r").configure_periodic(FUNC(nascom2_state::nascom2_kansas_r), attotime::from_hz(40000)); } diff --git a/src/mame/novag/const.cpp b/src/mame/novag/const.cpp index ab8ea188f6c..eeeeb16bd5b 100644 --- a/src/mame/novag/const.cpp +++ b/src/mame/novag/const.cpp @@ -97,6 +97,7 @@ public: const_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_irq_clock(*this, "irq_clock"), m_board(*this, "board"), m_display(*this, "display"), m_beeper(*this, "beeper"), @@ -122,6 +123,7 @@ protected: private: // devices/pointers required_device<cpu_device> m_maincpu; + required_device<clock_device> m_irq_clock; required_device<sensorboard_device> m_board; required_device<pwm_display_device> m_display; required_device<beep_device> m_beeper; @@ -361,9 +363,9 @@ void const_state::nconst(machine_config &config) M6502(config, m_maincpu, 2_MHz_XTAL); m_maincpu->set_addrmap(AS_PROGRAM, &const_state::const_map); - auto &irq_clock(CLOCK(config, "irq_clock", 2_MHz_XTAL / 0x2000)); // through 4020 IC, ~244Hz - irq_clock.set_pulse_width(attotime::from_nsec(17200)); // active for ~17.2us - irq_clock.signal_handler().set_inputline(m_maincpu, M6502_IRQ_LINE); + CLOCK(config, m_irq_clock).set_period(attotime::from_ticks(0x2000, 2_MHz_XTAL)); // through 4020 IC, ~244Hz + m_irq_clock->set_pulse_width(attotime::from_nsec(17200)); // active for ~17.2us + m_irq_clock->signal_handler().set_inputline(m_maincpu, M6502_IRQ_LINE); SENSORBOARD(config, m_board).set_type(sensorboard_device::BUTTONS); m_board->init_cb().set(m_board, FUNC(sensorboard_device::preset_chess)); @@ -386,7 +388,7 @@ void const_state::ssensor4(machine_config &config) // basic machine hardware m_maincpu->set_addrmap(AS_PROGRAM, &const_state::ssensor4_map); - subdevice<clock_device>("irq_clock")->set_pulse_width(attotime::from_usec(39)); // irq active for 39us + m_irq_clock->set_pulse_width(attotime::from_usec(39)); // irq active for 39us NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1); m_board->set_nvram_enable(true); @@ -406,7 +408,7 @@ void const_state::nconst36(machine_config &config) G65SC02(config.replace(), m_maincpu, 7.2_MHz_XTAL/2); m_maincpu->set_addrmap(AS_PROGRAM, &const_state::const_map); - subdevice<clock_device>("irq_clock")->set_clock(7.2_MHz_XTAL/2 / 0x2000); // ~439Hz (pulse width same as nconst) + m_irq_clock->set_period(attotime::from_ticks(0x2000, 7.2_MHz_XTAL/2)); // ~439Hz (pulse width same as nconst) m_board->set_delay(attotime::from_msec(200)); @@ -438,7 +440,7 @@ void const_state::nconstq(machine_config &config) // basic machine hardware m_maincpu->set_clock(8_MHz_XTAL/2); - subdevice<clock_device>("irq_clock")->set_clock(8_MHz_XTAL/4 / 0x1000); // ~488Hz (pulse width same as nconst) + m_irq_clock->set_period(attotime::from_ticks(0x1000, 8_MHz_XTAL/4)); // ~488Hz (pulse width same as nconst) config.set_default_layout(layout_novag_constq); @@ -455,7 +457,7 @@ void const_state::sconst(machine_config &config) M6502(config.replace(), m_maincpu, 8_MHz_XTAL/2); // UM6502C m_maincpu->set_addrmap(AS_PROGRAM, &const_state::sconst_map); - subdevice<clock_device>("irq_clock")->set_pulse_width(attotime::from_nsec(10200)); // irq active for 10.2us + m_irq_clock->set_pulse_width(attotime::from_nsec(10200)); // irq active for 10.2us NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1); m_board->set_nvram_enable(true); diff --git a/src/mame/saitek/superstar.cpp b/src/mame/saitek/superstar.cpp index ea21a79fd03..435973077ef 100644 --- a/src/mame/saitek/superstar.cpp +++ b/src/mame/saitek/superstar.cpp @@ -228,7 +228,7 @@ void star_state::sstar28k(machine_config &config) M6502(config, m_maincpu, 1'800'000); // no XTAL m_maincpu->set_addrmap(AS_PROGRAM, &star_state::sstar28k_map); - CLOCK(config, m_nmi_clock, 1'800'000 / 0x2000); // 4020 Q13 + CLOCK(config, m_nmi_clock).set_period(attotime::from_ticks(0x2000, 1'800'000)); // 4020 Q13 m_nmi_clock->signal_handler().set_inputline(m_maincpu, INPUT_LINE_NMI); SENSORBOARD(config, m_board).set_type(sensorboard_device::BUTTONS); @@ -252,8 +252,7 @@ void star_state::tstar432(machine_config &config) R65C02(config.replace(), m_maincpu, 4_MHz_XTAL); m_maincpu->set_addrmap(AS_PROGRAM, &star_state::tstar432_map); - CLOCK(config.replace(), m_nmi_clock, 4_MHz_XTAL / 0x4000); // 4020 Q14 - m_nmi_clock->signal_handler().set_inputline(m_maincpu, INPUT_LINE_NMI); + m_nmi_clock->set_period(attotime::from_ticks(0x4000, 4_MHz_XTAL)); // 4020 Q14 config.set_default_layout(layout_saitek_tstar432); diff --git a/src/mame/sanyo/mbc55x.cpp b/src/mame/sanyo/mbc55x.cpp index b5d743b9751..0693eee2dee 100644 --- a/src/mame/sanyo/mbc55x.cpp +++ b/src/mame/sanyo/mbc55x.cpp @@ -300,7 +300,8 @@ void mbc55x_state::mbc55x(machine_config &config) m_pit->out_handler<2>().append("sio", FUNC(i8251_device::write_rxc)); m_pit->out_handler<2>().append("line", FUNC(rs232_port_device::write_etc)); - clock_device &clk_78_6khz(CLOCK(config, "clk_78.6khz", 14.318181_MHz_XTAL / 14 / 13)); + clock_device &clk_78_6khz(CLOCK(config, "clk_78.6khz")); + clk_78_6khz.set_period(attotime::from_hz(14.318181_MHz_XTAL / 14 / 13)); clk_78_6khz.signal_handler().set(m_pit, FUNC(pit8253_device::write_clk0)); clk_78_6khz.signal_handler().append(m_kb_uart, FUNC(i8251_device::write_txc)); clk_78_6khz.signal_handler().append(m_kb_uart, FUNC(i8251_device::write_rxc)); diff --git a/src/mame/ta/alphatro.cpp b/src/mame/ta/alphatro.cpp index 5649128e462..bc9ba471011 100644 --- a/src/mame/ta/alphatro.cpp +++ b/src/mame/ta/alphatro.cpp @@ -859,11 +859,13 @@ void alphatro_state::alphatro(machine_config &config) m_usart->rxrdy_handler().set(m_pic, FUNC(pic8259_device::ir1_w)); m_usart->txrdy_handler().set(m_pic, FUNC(pic8259_device::ir2_w)); - clock_device &cass_clock(CLOCK(config, "cass_clock", 16_MHz_XTAL / 4 / 13 / 16)); // 19.2 kHz + clock_device &cass_clock(CLOCK(config, "cass_clock")); + cass_clock.set_period(attotime::from_hz(16_MHz_XTAL / 4 / 13 / 16)); // 19.2 kHz cass_clock.signal_handler().set(FUNC(alphatro_state::kansas_w)); cass_clock.signal_handler().append(FUNC(alphatro_state::kansas_r)); - clock_device &serial_clock(CLOCK(config, "serial_clock", 16_MHz_XTAL / 4 / 13 / 4)); // 76.8 kHz 4800 baud (can be set with jumpers) + clock_device &serial_clock(CLOCK(config, "serial_clock")); + serial_clock.set_period(attotime::from_hz(16_MHz_XTAL / 4 / 13 / 4)); // 76.8 kHz 4800 baud (can be set with jumpers) serial_clock.signal_handler().append(m_usart, FUNC(i8251_device::write_txc)); serial_clock.signal_handler().append(m_usart, FUNC(i8251_device::write_rxc)); diff --git a/src/mame/zaccaria/zaccaria_a.cpp b/src/mame/zaccaria/zaccaria_a.cpp index f4258f91a54..2d69539f3ef 100644 --- a/src/mame/zaccaria/zaccaria_a.cpp +++ b/src/mame/zaccaria/zaccaria_a.cpp @@ -232,7 +232,8 @@ void zac1b111xx_melody_base::device_add_mconfig(machine_config &config) M6802(config, m_melodycpu, XTAL(3'579'545)); // verified on pcb m_melodycpu->set_addrmap(AS_PROGRAM, &zac1b111xx_melody_base::zac1b111xx_melody_base_map); - clock_device &timebase(CLOCK(config, "timebase", XTAL(3'579'545)/4096/2)); // CPU clock divided using 4040 and half of 74LS74 + clock_device &timebase(CLOCK(config, "timebase")); + timebase.set_period(attotime::from_ticks(0x2000, XTAL(3'579'545))); // CPU clock divided using 4040 and half of 74LS74 timebase.signal_handler().set(m_melodypia, FUNC(pia6821_device::cb1_w)); PIA6821(config, m_melodypia); @@ -242,10 +243,10 @@ void zac1b111xx_melody_base::device_add_mconfig(machine_config &config) m_melodypia->irqa_handler().set_inputline("melodycpu", INPUT_LINE_NMI); m_melodypia->irqb_handler().set_inputline("melodycpu", M6802_IRQ_LINE); - AY8910(config, m_melodypsg1, XTAL(3'579'545)/2); // CPU clock divided using 4040 + AY8910(config, m_melodypsg1, XTAL(3'579'545) / 2); // CPU clock divided using 4040 m_melodypsg1->port_b_read_callback().set(FUNC(zac1b111xx_melody_base::melodypsg1_portb_r)); - AY8910(config, m_melodypsg2, XTAL(3'579'545)/2); // CPU clock divided using 4040 + AY8910(config, m_melodypsg2, XTAL(3'579'545) / 2); // CPU clock divided using 4040 } void zac1b111xx_melody_base::device_start() |
