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

Improvements to Technics KN5000 #12684

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

felipesanches
Copy link
Contributor

This is ready for review and replaces PR #11835 but does not include the kn1500 driver, which I'll leave for a future PR.

@felipesanches
Copy link
Contributor Author

After @ajrhacker made this comment (#11835 (comment)) I investigated the problem a bit more and I was able to get rid of the segfault on the extension interface for the Technics KN5000 (which is used to install the HDAE5000 board).

I've just force-pushed the amended fix.

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.

Thanks for updating this to build against the current codebase. This seems to still have a number of the same issues as the previous pull request.

Comment on lines +750 to +751
m_subcpu->portc_read().set([this] { return ioport("CN12")->read(); });
m_subcpu->portc_write().set([this] (u8 data) { m_checking_device_led_cn12 = (BIT(data, 1) == 0); });
Copy link
Member

Choose a reason for hiding this comment

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

Please avoid unnecessary on-the-fly tag lookups. You can look at the other options devcb provides (set_ioport is particularly relevant here).

Comment on lines +727 to +729
m_maincpu->portz_read().set([this] {
return ioport("COM_SELECT")->read() | (m_sstat << 2);
});
Copy link
Member

Choose a reason for hiding this comment

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

Please avoid on-the-fly tag lookups.

You can get m_sstat read through the I/O port with PORT_CUSTOM_MEMBER or PORT_READ_LINE_MEMBER.

Comment on lines -648 to +685
// TODO: m_maincpu->portd_write().set([this] (u8 data) { m_fdc->reset_w(BIT(data, 0)); });
m_maincpu->portd_write().set([this] (u8 data) { m_fdc->reset_w(BIT(data, 0)); });
Copy link
Member

Choose a reason for hiding this comment

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

You can use transforms like .set(m_fdc, FUNC(whatever_device::reset_w)).bit(0) etc.

Comment on lines -656 to +693
// TODO: m_maincpu->porte_read().set([] { return 1; }); //checked at EF05A6 (v10 ROM)
m_maincpu->porte_read().set([] { return 1; }); //checked at EF05A6 (v10 ROM)
Copy link
Member

Choose a reason for hiding this comment

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

There’s set_constant for this.

Comment on lines +621 to +622
if(m_extension)
{
Copy link
Member

Choose a reason for hiding this comment

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

The existing code in this file (as well as the majority of MAME) uses a space between flow control keywords and the opening parenthesis of the controlling expression, like if (whatever).

Comment on lines +1708 to +1710
{
buf = string_format("%s", m_sfr_names[imm]);
}
Copy link
Member

Choose a reason for hiding this comment

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

You don’t need string_format for unformatted strings, << is a thing.

src/devices/cpu/tlcs900/tmp94c241.h Show resolved Hide resolved
Comment on lines +90 to +92
protected:
// device-level overrides
virtual void device_config_complete() override;
Copy link
Member

Choose a reason for hiding this comment

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

Minor thing, but please don’t copy/paste this comment – it doesn’t even make sense. Use “device_t implementation” or similar.

Comment on lines +293 to +303
// Port 0: 8 bit I/O. Shared with d0-d7
devcb_read8 m_port0_read;
devcb_write8 m_port0_write;

// Port 1: 8 bit I/O. Shared with d8-d15
devcb_read8 m_port1_read;
devcb_write8 m_port1_write;

// Port 2: 8 bit I/O. Shared with d16-d23
devcb_read8 m_port2_read;
devcb_write8 m_port2_write;
Copy link
Member

Choose a reason for hiding this comment

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

Can you use a devcb_read8::array and devcb_write8::array for these to make it more concise?

Comment on lines +392 to +427
uint8_t tmp94c241_device::p0_r()
{
return m_port0_read(0);
}

void tmp94c241_device::p0_w(uint8_t data)
{
m_port_latch[0] = data;
m_port0_write(0, data, 0xff);
}

void tmp94c241_device::p0cr_w(uint8_t data)
{
m_port_control[0] = data;
}

void tmp94c241_device::p0fc_w(uint8_t data)
{
m_port_function[0] = data;
}

uint8_t tmp94c241_device::p1_r()
{
return m_port1_read(0);
}

void tmp94c241_device::p1_w(uint8_t data)
{
m_port_latch[1] = data;
m_port1_write(0, data, 0xff);
}

void tmp94c241_device::p1cr_w(uint8_t data)
{
m_port_control[1] = data;
}
Copy link
Member

Choose a reason for hiding this comment

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

Can you use function templates to avoid copy/pasta?

@cuavas
Copy link
Member

cuavas commented Aug 24, 2024

I cribbed a small part of this in 23e9abc as a release is coming very soon.

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.

2 participants