Previous Thread
Next Thread
Print Thread
#119687 09/15/21 06:38 PM
Joined: Feb 2014
Posts: 674
Likes: 9
G
Senior Member
OP Offline
Senior Member
G
Joined: Feb 2014
Posts: 674
Likes: 9
Hi guys,

I was having trouble figuring out why the hardware flow control on the imagewriter isn't working with the ct486.

I came across this bit on the ins8250 that didn't look quite right:

so in update_msr it checks for changed status bits, but it looks like it would clear any existing change bits that were set previously:

I added the prevchange parts.

Code
void ins8250_uart_device::update_msr()
{
	u8 data;
	int change;
	u8 prevchange = 0;

	if (m_regs.mcr & INS8250_MCR_LOOPBACK)
	{
		data = (((m_regs.mcr & (INS8250_MCR_OUT1|INS8250_MCR_OUT2)) << 4) | \
			((m_regs.mcr & INS8250_MCR_DTR) << 5) | ((m_regs.mcr & INS8250_MCR_RTS) << 3));
		change = (m_regs.msr ^ data) >> 4;
		if(!(m_regs.msr & 0x40) && (data & 0x40))
			change &= ~4;
	}
	else
	{
		prevchange = m_regs.msr & 0xf;  // added this line
		data = (!m_dcd << 7) | (!m_ri << 6) | (!m_dsr << 5) | (!m_cts << 4);
		change = (m_regs.msr ^ data) >> 4;
		
	}

	//m_regs.msr = data | change;  // this would remove any existing change bits that were set prior
	m_regs.msr = data | change | prevchange;  // added this line

	if(change)
		trigger_int(COM_INT_PENDING_MODEM_STATUS_REGISTER);
}

could probably get away with
data = (!m_dcd << 7) | (!m_ri << 6) | (!m_dsr << 5) | (!m_cts << 4) | (m_regs.msr & 0xf);

and avoid using an extra variable.

I hope that I'm not reading it wrong (which is entirely possible 8-)

Joined: Mar 2001
Posts: 16,808
Likes: 32
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,808
Likes: 32
That looks right. Carl (crazyc) is listed as one of the authors of the ins8250, maybe he can check this out.

Joined: Jan 2012
Posts: 872
Likes: 6
C
Senior Member
Offline
Senior Member
C
Joined: Jan 2012
Posts: 872
Likes: 6
That's probably right, although the loopback mode probably shouldn't be excluded. Writing the msr don't use update_msr so the pcjr (which appears to be the only machine which writes the msr in POST) shoudn't be affected.


Link Copied to Clipboard
Who's Online Now
1 members (robcfg), 29 guests, and 2 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,974
Posts117,896
Members5,001
Most Online890
Jan 17th, 2020
Forum Host
These forums are hosted by www.retrogamesformac.com
Forum hosted by www.retrogamesformac.com