Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

machine/am9513.cpp: wrapped logerror with LOGWARN macro #12533

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Elektraglide
Copy link
Contributor

  • fixed wrong logging happening too early

@rb6502
Copy link
Contributor

rb6502 commented Jul 1, 2024

Just a quick note: for MAME, the PR title and any notes largely go into the whatsnew.txt as-is. So we like to follow a format for the PR titles, where you start with the changed filename and its parent directory. In this case "machine/am9513.cpp: wrapped logerror for warnings with LOGWARN macro" would follow convention. We can edit the title as necessary before applying, which I'm going to do here, but obviously we'd rather not besides fixing the occasional autocorrect rampage. :-)

@Elektraglide Elektraglide changed the title - wrapping logerror() with LOGWARN macro machine/am9513.cpp: wrapped logerror with LOGWARN macro Jul 1, 2024
Copy link
Member

@cuavas cuavas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firstly, I think doing string pasting in the macro is just obfuscation. Secondly, I don’t think these things warrant SCREAMING warning text.

On top of that, I don’t think warning log messages should be hidden behind a compile-time option anyway. They’re things that shouldn’t be triggered by valid guest code if we understand the device properly. It’s worth having that stuff sent to the debugger log by default.

Combined with the other issues, I think this PR is fairly misguided.

Comment on lines 1257 to +1266
if (!BIT(data, 5))
{
LOGMASKED(LOG_MODE, "Disarm Counter %d\n", c + 1);
disarm_counter(c);
}
if (!BIT(data, 6))
{
LOGMASKED(LOG_MODE, "Save Counter %d\n", c + 1);
save_counter(c);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOG_MODE is for logging the master mode control setup. It’s inappropriate to use here.

Also, there are already LOG_GENERAL messages in both disarm_counter and save_counter so these are unnecessary.

Comment on lines +1444 to +1450
command_write(data & 0x00ff);

// NB testing afterwards because this command may have been changing bus width
if ((data & 0x00ff) == 0x00e7)
logerror("8-bit data bus selected with 16-bit write\n");
LOGWARN("8-bit data bus selected with 16-bit write\n");
else if ((data & 0x00ff) == 0x00ef && !bus_is_16_bit())
logerror("16-bit data bus selected\n");

command_write(data & 0x00ff);
LOGWARN("16-bit data bus selected\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this won’t work properly after the change – else if ((data & 0x00ff) == 0x00ef && !bus_is_16_bit()) won’t be true after calling command_write because the 16-bit mode will have selected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants