i8275: Calculate refresh rate from software-configured parameters

This commit is contained in:
AJR 2019-07-02 10:15:02 -04:00
parent 886b94648e
commit f36763266f
3 changed files with 30 additions and 27 deletions

View File

@ -106,6 +106,7 @@ i8275_device::i8275_device(const machine_config &mconfig, device_type type, cons
m_write_hrtc(*this), m_write_hrtc(*this),
m_write_vrtc(*this), m_write_vrtc(*this),
m_write_lc(*this), m_write_lc(*this),
m_refresh_hack(false),
m_status(0), m_status(0),
m_param_idx(0), m_param_idx(0),
m_param_end(0), m_param_end(0),
@ -725,15 +726,14 @@ void i8275_device::recompute_parameters()
int horiz_pix_total = (CHARACTERS_PER_ROW + HRTC_COUNT) * m_hpixels_per_column; int horiz_pix_total = (CHARACTERS_PER_ROW + HRTC_COUNT) * m_hpixels_per_column;
int vert_pix_total = (CHARACTER_ROWS_PER_FRAME + VRTC_ROW_COUNT) * SCANLINES_PER_ROW; int vert_pix_total = (CHARACTER_ROWS_PER_FRAME + VRTC_ROW_COUNT) * SCANLINES_PER_ROW;
attoseconds_t refresh = screen().frame_period().attoseconds(); attotime refresh = clocks_to_attotime((CHARACTERS_PER_ROW + HRTC_COUNT) * vert_pix_total);
int max_visible_x = (CHARACTERS_PER_ROW * m_hpixels_per_column) - 1; int max_visible_x = (CHARACTERS_PER_ROW * m_hpixels_per_column) - 1;
int max_visible_y = (CHARACTER_ROWS_PER_FRAME * SCANLINES_PER_ROW) - 1; int max_visible_y = (CHARACTER_ROWS_PER_FRAME * SCANLINES_PER_ROW) - 1;
LOG("width %u height %u max_x %u max_y %u refresh %f\n", horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, 1 / ATTOSECONDS_TO_DOUBLE(refresh)); LOG("width %u height %u max_x %u max_y %u refresh %f\n", horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, refresh.as_hz());
rectangle visarea; rectangle visarea(0, max_visible_x, 0, max_visible_y);
visarea.set(0, max_visible_x, 0, max_visible_y); screen().configure(horiz_pix_total, vert_pix_total, visarea, (m_refresh_hack ? screen().frame_period() : refresh).as_attoseconds());
screen().configure(horiz_pix_total, vert_pix_total, visarea, refresh);
int hrtc_on_pos = CHARACTERS_PER_ROW * m_hpixels_per_column; int hrtc_on_pos = CHARACTERS_PER_ROW * m_hpixels_per_column;
m_hrtc_on_timer->adjust(screen().time_until_pos(y, hrtc_on_pos), 0, screen().scan_period()); m_hrtc_on_timer->adjust(screen().time_until_pos(y, hrtc_on_pos), 0, screen().scan_period());

View File

@ -2,30 +2,30 @@
// copyright-holders:Curt Coder // copyright-holders:Curt Coder
/********************************************************************** /**********************************************************************
Intel 8275 Programmable CRT Controller emulation Intel 8275/8276 CRT Controller emulation
********************************************************************** **********************************************************************
_____ _____ ____ ____ ____ ____
LC3 1 |* \_/ | 40 Vcc LC3 1 |* \_/ | 40 Vcc LC3 1 |* \_/ | 40 Vcc
LC2 2 | | 39 LA0 LC2 2 | | 39 LA0 LC2 2 | | 39 NC
LC1 3 | | 38 LA1 LC1 3 | | 38 LA1 LC1 3 | | 38 NC
LC0 4 | | 37 LTEN LC0 4 | | 37 LTEN LC0 4 | | 37 LTEN
DRQ 5 | | 36 RVV DRQ 5 | | 36 RVV BRDY 5 | | 36 RVV
_DACK 6 | | 35 VSP _DACK 6 | | 35 VSP _BS 6 | | 35 VSP
HRTC 7 | | 34 GPA1 HRTC 7 | | 34 GPA1 HRTC 7 | | 34 GPA1
VRTC 8 | | 33 GPA0 VRTC 8 | | 33 GPA0 VRTC 8 | | 33 GPA0
_RD 9 | | 32 HLGT _RD 9 | | 32 HLGT _RD 9 | | 32 HLGT
_WR 10 | 8275 | 31 IRQ _WR 10 | 8275 | 31 IRQ _WR 10 | 8276 | 31 INT
LPEN 11 | | 30 CCLK LPEN 11 | | 30 CCLK NC 11 | | 30 CCLK
DB0 12 | | 29 CC6 DB0 12 | | 29 CC6 DB0 12 | | 29 CC6
DB1 13 | | 28 CC5 DB1 13 | | 28 CC5 DB1 13 | | 28 CC5
DB2 14 | | 27 CC4 DB2 14 | | 27 CC4 DB2 14 | | 27 CC4
DB3 15 | | 26 CC3 DB3 15 | | 26 CC3 DB3 15 | | 26 CC3
DB4 16 | | 25 CC2 DB4 16 | | 25 CC2 DB4 16 | | 25 CC2
DB5 17 | | 24 CC1 DB5 17 | | 24 CC1 DB5 17 | | 24 CC1
DB6 18 | | 23 CC0 DB6 18 | | 23 CC0 DB6 18 | | 23 CC0
DB7 19 | | 22 _CS DB7 19 | | 22 _CS DB7 19 | | 22 _CS
GND 20 |_____________| 21 A0 GND 20 |___________| 21 A0 GND 20 |___________| 21 C/_P
**********************************************************************/ **********************************************************************/
@ -61,6 +61,7 @@ public:
i8275_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); i8275_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void set_character_width(int value) { m_hpixels_per_column = value; } void set_character_width(int value) { m_hpixels_per_column = value; }
void set_refresh_hack(bool hack) { m_refresh_hack = hack; }
template <typename... T> void set_display_callback(T &&... args) { m_display_cb = draw_character_delegate(std::forward<T>(args)...); } template <typename... T> void set_display_callback(T &&... args) { m_display_cb = draw_character_delegate(std::forward<T>(args)...); }
void set_display_callback(draw_character_delegate callback) { m_display_cb = callback; } void set_display_callback(draw_character_delegate callback) { m_display_cb = callback; }
template <class FunctionClass> void set_display_callback(const char *devname, template <class FunctionClass> void set_display_callback(const char *devname,
@ -186,6 +187,7 @@ protected:
draw_character_delegate m_display_cb; draw_character_delegate m_display_cb;
int m_hpixels_per_column; int m_hpixels_per_column;
bool m_refresh_hack;
bitmap_rgb32 m_bitmap; bitmap_rgb32 m_bitmap;

View File

@ -595,6 +595,7 @@ void imds2ioc_device::device_add_mconfig(machine_config &config)
// assumption that CCLK is fixed at BCLK / 14) // assumption that CCLK is fixed at BCLK / 14)
I8275(config, m_ioccrtc, 22853600 / 14); I8275(config, m_ioccrtc, 22853600 / 14);
m_ioccrtc->set_character_width(14); m_ioccrtc->set_character_width(14);
m_ioccrtc->set_refresh_hack(true);
m_ioccrtc->set_display_callback(FUNC(imds2ioc_device::crtc_display_pixels), this); m_ioccrtc->set_display_callback(FUNC(imds2ioc_device::crtc_display_pixels), this);
m_ioccrtc->drq_wr_callback().set(m_iocdma, FUNC(i8257_device::dreq2_w)); m_ioccrtc->drq_wr_callback().set(m_iocdma, FUNC(i8257_device::dreq2_w));
m_ioccrtc->irq_wr_callback().set_inputline(m_ioccpu, I8085_INTR_LINE); m_ioccrtc->irq_wr_callback().set_inputline(m_ioccpu, I8085_INTR_LINE);