mirror of
https://github.com/holub/mame
synced 2025-07-01 00:09:18 +03:00
mc6845.cpp: more logging and reduced (not eliminated) warning spam significantly at startup when register values doesn't make sense
This commit is contained in:
parent
7c6ca794ae
commit
d7125bedbc
@ -45,12 +45,18 @@
|
||||
|
||||
#include "screen.h"
|
||||
|
||||
#define LOG_REGS (1 << 0U)
|
||||
#define LOG_CONFIG (1 << 1U)
|
||||
#define VERBOSE (0)
|
||||
#define LOG_SETUP (1 << 1U)
|
||||
#define LOG_REGS (1 << 2U)
|
||||
#define LOG_CONF (1 << 3U)
|
||||
|
||||
//#define VERBOSE (LOG_SETUP|LOG_CONF|LOG_REGS)
|
||||
//#define LOG_OUTPUT_STREAM std::cout
|
||||
|
||||
#include "logmacro.h"
|
||||
|
||||
#define LOGSETUP(...) LOGMASKED(LOG_SETUP, __VA_ARGS__)
|
||||
#define LOGREGS(...) LOGMASKED(LOG_REGS, __VA_ARGS__)
|
||||
#define LOGCONF(...) LOGMASKED(LOG_CONF, __VA_ARGS__)
|
||||
|
||||
DEFINE_DEVICE_TYPE(MC6845, mc6845_device, "mc6845", "Motorola MC6845 CRTC")
|
||||
DEFINE_DEVICE_TYPE(MC6845_1, mc6845_1_device, "mc6845_1", "Motorola MC6845-1 CRTC")
|
||||
@ -213,7 +219,19 @@ uint8_t mc6845_device::register_r()
|
||||
|
||||
void mc6845_device::register_w(uint8_t data)
|
||||
{
|
||||
LOGMASKED(LOG_REGS, "%s:M6845 reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
|
||||
LOGREGS("%s:M6845 reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
|
||||
|
||||
/* Omits LOGSETUP logs of cursor registers as they tend to be spammy */
|
||||
if (m_register_address_latch < 0x0e &&
|
||||
m_register_address_latch != 0x0a &&
|
||||
m_register_address_latch != 0x0b) LOGSETUP(" * %02x <= %3u [%02x] %s\n", m_register_address_latch,
|
||||
data, data, std::array<char const *, 16>
|
||||
{{ "R0 - Horizontal Total", "R1 - Horizontal Displayed", "R2 - Horizontal Sync Position",
|
||||
"R3 - Sync Width", "R4 - Vertical Total", "R5 - Vertical Total Adjust",
|
||||
"R6 - Vertical Displayed", "R7 - Vertical Sync Position", "R8 - Interlace & Skew",
|
||||
"R9 - Maximum Raster Address", "R10 - Cursor Start Address", "R11 - Cursor End Address",
|
||||
"R12 - Start Address (H)", "R13 - Start Address (L)", "R14 - Cursor (H)",
|
||||
"R15 - Cursor (L)" }}[(m_register_address_latch & 0x0f)]);
|
||||
|
||||
switch (m_register_address_latch)
|
||||
{
|
||||
@ -342,7 +360,7 @@ uint8_t mos8563_device::register_r()
|
||||
|
||||
void mos8563_device::register_w(uint8_t data)
|
||||
{
|
||||
LOGMASKED(LOG_REGS, "%s:MOS8563 reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
|
||||
LOGREGS("%s:MOS8563 reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
|
||||
|
||||
switch (m_register_address_latch)
|
||||
{
|
||||
@ -429,7 +447,7 @@ uint8_t hd6345_device::register_r()
|
||||
|
||||
void hd6345_device::register_w(uint8_t data)
|
||||
{
|
||||
LOGMASKED(LOG_REGS, "%s:HD6345 reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
|
||||
LOGREGS("%s:HD6345 reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
|
||||
|
||||
switch (m_register_address_latch)
|
||||
{
|
||||
@ -571,8 +589,8 @@ void mc6845_device::recompute_parameters(bool postload)
|
||||
else
|
||||
visarea.set(0 + m_visarea_adjust_min_x, max_visible_x + m_visarea_adjust_max_x, 0 + m_visarea_adjust_min_y, max_visible_y + m_visarea_adjust_max_y);
|
||||
|
||||
LOGMASKED(LOG_CONFIG, "M6845 config screen: HTOTAL: %d VTOTAL: %d MAX_X: %d MAX_Y: %d HSYNC: %d-%d VSYNC: %d-%d Freq: %ffps\n",
|
||||
horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, hsync_on_pos, hsync_off_pos - 1, vsync_on_pos, vsync_off_pos - 1, refresh.as_hz());
|
||||
LOGCONF("M6845 config screen: HTOTAL: %d VTOTAL: %d MAX_X: %d MAX_Y: %d HSYNC: %d-%d VSYNC: %d-%d Freq: %ffps\n",
|
||||
horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, hsync_on_pos, hsync_off_pos - 1, vsync_on_pos, vsync_off_pos - 1, refresh.as_hz());
|
||||
|
||||
if (has_screen())
|
||||
screen().configure(horiz_pix_total, vert_pix_total, visarea, refresh.as_attoseconds());
|
||||
@ -1073,6 +1091,12 @@ uint32_t mc6845_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma
|
||||
{
|
||||
assert(!m_update_row_cb.isnull());
|
||||
|
||||
if (m_display_disabled_msg_shown == true)
|
||||
{
|
||||
logerror("M6845: Valid screen parameters - display reenabled!!!\n");
|
||||
m_display_disabled_msg_shown = false;
|
||||
}
|
||||
|
||||
/* call the set up function if any */
|
||||
if (!m_begin_update_cb.isnull())
|
||||
m_begin_update_cb(bitmap, cliprect);
|
||||
@ -1095,7 +1119,11 @@ uint32_t mc6845_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGMASKED(LOG_CONFIG, "M6845: Invalid screen parameters - display disabled!!!\n");
|
||||
if (m_display_disabled_msg_shown == false)
|
||||
{
|
||||
logerror("M6845: Invalid screen parameters - display disabled!!!\n");
|
||||
m_display_disabled_msg_shown = true;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1143,6 +1171,7 @@ void mc6845_device::device_start()
|
||||
m_supports_status_reg_d7 = false;
|
||||
m_supports_transparent = false;
|
||||
m_has_valid_parameters = false;
|
||||
m_display_disabled_msg_shown = false;
|
||||
m_line_enable_ff = false;
|
||||
m_vsync_ff = 0;
|
||||
m_raster_counter = 0;
|
||||
@ -1214,6 +1243,7 @@ void mc6845_device::device_start()
|
||||
save_item(NAME(m_line_address));
|
||||
save_item(NAME(m_cursor_x));
|
||||
save_item(NAME(m_has_valid_parameters));
|
||||
save_item(NAME(m_display_disabled_msg_shown));
|
||||
}
|
||||
|
||||
|
||||
|
@ -219,6 +219,7 @@ protected:
|
||||
uint16_t m_vsync_on_pos;
|
||||
uint16_t m_vsync_off_pos;
|
||||
bool m_has_valid_parameters;
|
||||
bool m_display_disabled_msg_shown;
|
||||
|
||||
uint16_t m_current_disp_addr; /* the display address currently drawn (used only in mc6845_update) */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user