diff --git a/devices/video/appleramdac.cpp b/devices/video/appleramdac.cpp index bc3a7cd..3206f93 100644 --- a/devices/video/appleramdac.cpp +++ b/devices/video/appleramdac.cpp @@ -43,7 +43,7 @@ uint16_t AppleRamdac::iodev_read(uint32_t address) { case RamdacRegs::PLL_CTRL: return this->pll_cr; case RamdacRegs::VENDOR_ID: - return DACULA_VENDOR_SIERRA; + return this->dac_vendor; default: LOG_F(WARNING, "%s: read from unsupported multi-register at 0x%X", this->name.c_str(), this->dac_addr); @@ -142,7 +142,15 @@ int AppleRamdac::get_dot_freq() { uint8_t p = this->clk_pn[this->pll_cr & 1] >> 5; uint8_t n = this->clk_pn[this->pll_cr & 1] & 0x1F; - double dot_freq = 14318180.0f * (double)m / ((double)n * (double)(1 << p)); + double dot_freq; + if (this->dac_vendor == DACULA_VENDOR_OTHER) + dot_freq = 15000000.0f * (double)m / ((double)n + 2) / (double)(1 << p); + else if (this->dac_vendor == DACULA_VENDOR_SIERRA) + dot_freq = 14318180.0f * (double)m / ((double)n * (double)(1 << p)); + else { + dot_freq = 14318180.0f * (double)m / (double)n / (double)(1 << p); + LOG_F(ERROR, "%s: unknown VENDOR_ID", this->name.c_str()); + } return static_cast(dot_freq + 0.5f); } diff --git a/devices/video/appleramdac.h b/devices/video/appleramdac.h index a29c8c2..19c94e9 100644 --- a/devices/video/appleramdac.h +++ b/devices/video/appleramdac.h @@ -35,7 +35,8 @@ enum DacFlavour { DACULA, }; -#define DACULA_VENDOR_SIERRA 0x3C +#define DACULA_VENDOR_SIERRA 0x3C // 14.3 MHz +#define DACULA_VENDOR_OTHER 0x84 // 15 MHz constexpr auto VIDEO_XTAL = 14318180.0f; // external crystal oscillator frequency @@ -109,6 +110,7 @@ protected: uint8_t clk_m[2] = {}; uint8_t clk_pn[2] = {}; uint8_t pll_cr = 0; + uint8_t dac_vendor = DACULA_VENDOR_SIERRA; uint8_t comp_index = 0; uint8_t clut_color[3] = {}; uint32_t cursor_clut[8] = {};