Skip to content

Commit 6ed7029

Browse files
authored
sinclair/specnext_copper.cpp: Improved logging (#14248)
1 parent 68e82ab commit 6ed7029

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

src/mame/sinclair/specnext.cpp

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,16 @@
4141
#include "speaker.h"
4242

4343

44-
#define LOG_IO (1U << 1)
45-
#define LOG_MEM (1U << 2)
46-
#define LOG_WARN (1U << 3)
44+
#define LOG_IO (1U << 1)
45+
#define LOG_MEM (1U << 2)
46+
#define LOG_COPPER (1U << 3)
4747

48-
//#define VERBOSE ( LOG_GENERAL | LOG_IO | /*LOG_MEM |*/ LOG_WARN )
48+
//#define VERBOSE ( LOG_GENERAL | LOG_IO | /*LOG_MEM |*/ LOG_COPPER )
4949
#include "logmacro.h"
5050

51-
#define LOGIO(...) LOGMASKED(LOG_IO, __VA_ARGS__)
52-
#define LOGMEM(...) LOGMASKED(LOG_MEM, __VA_ARGS__)
53-
#define LOGWARN(...) LOGMASKED(LOG_WARN, __VA_ARGS__)
54-
51+
#define LOGIO(...) LOGMASKED(LOG_IO, __VA_ARGS__)
52+
#define LOGMEM(...) LOGMASKED(LOG_MEM, __VA_ARGS__)
53+
#define LOGCOPPER(...) LOGMASKED(LOG_COPPER, __VA_ARGS__)
5554

5655
namespace {
5756

@@ -911,7 +910,7 @@ void specnext_state::update_video_mode()
911910

912911
m_eff_nr_03_machine_timing = m_nr_03_machine_timing;
913912
m_eff_nr_05_5060 = m_nr_05_5060;
914-
LOG("%s: %s %dHz", machine_name, is_hdmi ? "HDMI" : "VGA", m_nr_05_5060 ? 60 : 50);
913+
LOG("%s: %s %dHz\n", machine_name, is_hdmi ? "HDMI" : "VGA", m_nr_05_5060 ? 60 : 50);
915914
}
916915

917916
u32 specnext_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
@@ -1211,24 +1210,34 @@ attotime specnext_state::copper_until_pos_r(u16 pos)
12111210
const u16 vcount = BIT(pos, 0, 9);
12121211
const u16 hcount = BIT(pos, 9, 6) << 3;
12131212
if (vcount > m_video_timings.max_vc || hcount > m_video_timings.max_hc)
1213+
{
1214+
LOGCOPPER("[%s] HALT\n", m_copper->tag());
12141215
return attotime::never;
1216+
}
12151217
else
12161218
{
12171219
if (BIT(pos, 15)) // MOVE
12181220
{
12191221
u16 vtarget = cvc_to_vpos(vcount);
1220-
u16 htarget = ((hcount/* + 12*/) + m_video_timings.min_hactive + m_screen->width()) % m_screen->width();
1222+
u16 htarget = ((hcount/* + 12*/) + m_video_timings.min_hactive + m_video_timings.max_hc) % m_video_timings.max_hc;
12211223
if (htarget < (m_video_timings.min_hactive))
12221224
vtarget = (vtarget + 1) % m_screen->height();
12231225
htarget <<= 1;
1224-
if (vtarget != m_screen->vpos() || htarget > m_screen->hpos())
1226+
const u16 vpos = m_screen->vpos();
1227+
const u16 hpos = m_screen->hpos();
1228+
LOGCOPPER("[%s] [%02x, %03x] WAIT(%02x+%02x, %03x)\n", m_copper->tag(), vpos, hpos >> 1, m_nr_64_copper_offset, vcount, hcount);
1229+
if (vtarget != vpos || htarget > hpos)
12251230
return m_screen->time_until_pos(vtarget, htarget);
12261231
else
1232+
{
1233+
LOGCOPPER("[%s] !WAIT\n", m_copper->tag());
12271234
return attotime::zero;
1235+
}
12281236
}
12291237
else // FRAME or RESET
12301238
{
12311239
assert(!vcount && !hcount);
1240+
LOGCOPPER("[%s] FRAME (0, 0)\n", m_copper->tag());
12321241
return m_screen->time_until_pos(cvc_to_vpos(0), m_video_timings.min_hactive << 1);
12331242
}
12341243
}
@@ -1715,7 +1724,7 @@ u8 specnext_state::reg_r(offs_t nr_register)
17151724
default:
17161725
port_253b_dat = 0x00;
17171726
if (!machine().side_effects_disabled())
1718-
LOGWARN("rR: %X -> %x\n", nr_register, port_253b_dat);
1727+
LOG("rR: %X -> %x\n", nr_register, port_253b_dat);
17191728
}
17201729

17211730
return port_253b_dat;
@@ -2330,7 +2339,7 @@ void specnext_state::reg_w(offs_t nr_wr_reg, u8 nr_wr_dat)
23302339
LOG("Debug: #%02X\n", nr_wr_dat); // LED
23312340
break;
23322341
default:
2333-
LOGWARN("wR: %X <- %x\n", nr_wr_reg, nr_wr_dat);
2342+
LOG("wR: %X <- %x\n", nr_wr_reg, nr_wr_dat);
23342343
break;
23352344
}
23362345

src/mame/sinclair/specnext_copper.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414

1515
#define LOG_CTRL (1U << 1)
1616
#define LOG_DATA (1U << 2)
17+
#define LOG_EXEC (1U << 3)
1718

18-
#define VERBOSE ( LOG_GENERAL /*| LOG_CTRL | LOG_DATA*/ )
19+
//#define VERBOSE ( LOG_GENERAL /*| LOG_CTRL | LOG_DATA*/ | LOG_EXEC )
1920
#include "logmacro.h"
2021

2122
#define LOGCTRL(...) LOGMASKED(LOG_CTRL, __VA_ARGS__)
2223
#define LOGDATA(...) LOGMASKED(LOG_DATA, __VA_ARGS__)
24+
#define LOGEXEC(...) LOGMASKED(LOG_EXEC, __VA_ARGS__)
2325

2426

2527
// device type definition
@@ -82,6 +84,7 @@ TIMER_CALLBACK_MEMBER(specnext_copper_device::timer_callback)
8284

8385
if (m_copper_dout == 1) // if we are on MOVE, clear the output for the next cycle
8486
{
87+
LOGEXEC("MOVE(%02x, %02x)\n", (m_copper_list_data >> 8) & 0x7f, m_copper_list_data & 0xff);
8588
m_out_nextreg_cb((m_copper_list_data >> 8) & 0x7f, m_copper_list_data & 0xff);
8689
m_copper_dout = 0;
8790
}

0 commit comments

Comments
 (0)