mirror of
https://github.com/holub/mame
synced 2025-04-22 08:22:15 +03:00
Add additional sanity checking to the tms9927/crt5027 core. [Lord Nightmare]
This commit is contained in:
parent
aa3ac42258
commit
13be662eec
@ -22,7 +22,7 @@ static const UINT8 skew_bits_value[4] = { 0, 1, 2, 2 };
|
||||
#define CHARS_PER_DATA_ROW (chars_per_row_value[(m_reg[2] >> 0) & 0x07])
|
||||
#define SKEW_BITS (skew_bits_value[(m_reg[3] >> 6) & 0x03])
|
||||
#define DATA_ROWS_PER_FRAME (((m_reg[3] >> 0) & 0x3f) + 1)
|
||||
#define SCAN_LINES_PER_FRAME ((m_reg[4] * 2) + 256)
|
||||
#define SCAN_LINES_PER_FRAME ((m_reg[4] * 2) + 256 + (((m_reg[1] >> 7) & 0x01) * 257))
|
||||
#define VERTICAL_DATA_START (m_reg[5])
|
||||
#define LAST_DISP_DATA_ROW (m_reg[6] & 0x3f)
|
||||
#define CURSOR_CHAR_ADDRESS (m_reg[7])
|
||||
@ -79,7 +79,7 @@ crt5057_device::crt5057_device(const machine_config &mconfig, const char *tag, d
|
||||
void tms9927_device::device_start()
|
||||
{
|
||||
assert(clock() > 0);
|
||||
assert(m_hpixels_per_column > 0);
|
||||
if (!(m_hpixels_per_column > 0)) fatalerror("ERROR: TMS9927: number of pixels per column must be explicitly set using MCFG_TMS9927_CHAR_WIDTH()!\n");
|
||||
|
||||
/* copy the initial parameters */
|
||||
m_clock = clock();
|
||||
@ -303,12 +303,19 @@ void tms9927_device::recompute_parameters(int postload)
|
||||
|
||||
/* see if it all makes sense */
|
||||
m_valid_config = TRUE;
|
||||
if (m_visible_hpix > m_total_hpix || m_visible_vpix > m_total_vpix)
|
||||
if ( (m_visible_hpix > m_total_hpix || m_visible_vpix > m_total_vpix) || (((m_visible_hpix-1)<=0) || ((m_visible_vpix-1)<=0)) || ((m_total_hpix * m_total_vpix) == 0) )
|
||||
{
|
||||
m_valid_config = FALSE;
|
||||
logerror("tms9927: invalid visible size (%dx%d) versus total size (%dx%d)\n", m_visible_hpix, m_visible_vpix, m_total_hpix, m_total_vpix);
|
||||
}
|
||||
|
||||
if (m_clock == 0)
|
||||
{
|
||||
m_valid_config = FALSE;
|
||||
// TODO: make the screen refresh never, and disable the vblank and odd/even interrupts here!
|
||||
logerror("tms9927: invalid clock rate of zero defined!\n");
|
||||
}
|
||||
|
||||
/* update */
|
||||
if (!m_valid_config)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user