Skip to content

sinclair/glukrs.cpp: Added expected clock value validation #13944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/mame/sinclair/glukrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,20 @@
#include "glukrs.h"

glukrs_device::glukrs_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: mc146818_device(mconfig, GLUKRS, tag, owner, 32'768)
: mc146818_device(mconfig, GLUKRS, tag, owner, clock)
{
m_tuc = 1984;
set_24hrs(true);
}

void glukrs_device::device_validity_check(validity_checker &valid) const
{
mc146818_device::device_validity_check(valid);

if (clock() != 32'768)
osd_printf_error("Clock %u is different from expected 32'768\n", clock());
}

void glukrs_device::device_start()
{
mc146818_device::device_start();
Expand Down
3 changes: 2 additions & 1 deletion src/mame/sinclair/glukrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class glukrs_device : public mc146818_device
{
public:
glukrs_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
glukrs_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 32'768);

void enable() { m_glukrs_active = true; }
void disable() { m_glukrs_active = false; }
Expand All @@ -24,6 +24,7 @@ class glukrs_device : public mc146818_device
virtual void data_w(u8 data) override { if (m_glukrs_active) { mc146818_device::data_w(data); } }

protected:
virtual void device_validity_check(validity_checker &valid) const override;
void device_start() override ATTR_COLD;
void device_reset() override ATTR_COLD;

Expand Down
2 changes: 1 addition & 1 deletion src/mame/sinclair/pentevo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ void pentevo_state::pentevo(machine_config &config)
m_ram->set_default_size("4M");
RAM(config, m_char_ram).set_default_size("2048").set_default_value(0);

GLUKRS(config, m_glukrs);
GLUKRS(config, m_glukrs, 32.768_kHz_XTAL);
SPI_SDCARD(config, m_sdcard, 0);
m_sdcard->set_prefer_sdhc();
m_sdcard->spi_miso_callback().set(FUNC(pentevo_state::spi_miso_w));
Expand Down
2 changes: 1 addition & 1 deletion src/mame/sinclair/tsconf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void tsconf_state::tsconf(machine_config &config)

m_ram->set_default_size("4096K").set_default_value(0x00); // must be random but 0x00 behaves better than 0xff in tested software

GLUKRS(config, m_glukrs);
GLUKRS(config, m_glukrs, 32.768_kHz_XTAL);

TSCONF_DMA(config, m_dma, 28_MHz_XTAL);
m_dma->in_mreq_callback().set(FUNC(tsconf_state::ram_read16));
Expand Down
Loading