mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Made an attempt properly to deal with initial bus state.
This commit is contained in:
parent
1bb109a23b
commit
1e6d90de17
@ -52,7 +52,7 @@ class SerialPortVIA: public MOS::MOS6522<SerialPortVIA>, public MOS::MOS6522IRQD
|
|||||||
case ::Commodore::Serial::Line::Clock: _portB = (_portB & ~0x04) | (value ? 0 : 0x04); break;
|
case ::Commodore::Serial::Line::Clock: _portB = (_portB & ~0x04) | (value ? 0 : 0x04); break;
|
||||||
case ::Commodore::Serial::Line::Attention:
|
case ::Commodore::Serial::Line::Attention:
|
||||||
_portB = (_portB & ~0x80) | (value ? 0 : 0x80);
|
_portB = (_portB & ~0x80) | (value ? 0 : 0x80);
|
||||||
set_control_line_input(Port::B, Line::Two, !!(value&0x80));
|
set_control_line_input(Port::B, Line::Two, value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,13 @@ using namespace Commodore::Serial;
|
|||||||
void Bus::add_port(std::shared_ptr<Port> port)
|
void Bus::add_port(std::shared_ptr<Port> port)
|
||||||
{
|
{
|
||||||
_ports.push_back(port);
|
_ports.push_back(port);
|
||||||
|
for(int line = (int)ServiceRequest; line <= (int)Reset; line++)
|
||||||
|
set_line_output_did_change((Line)line);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bus::set_line_output_did_change(Line line)
|
void Bus::set_line_output_did_change(Line line)
|
||||||
{
|
{
|
||||||
|
// i.e. I believe these lines to be open collector, active low
|
||||||
bool new_line_value = false;
|
bool new_line_value = false;
|
||||||
for(std::weak_ptr<Port> port : _ports)
|
for(std::weak_ptr<Port> port : _ports)
|
||||||
{
|
{
|
||||||
@ -27,6 +30,7 @@ void Bus::set_line_output_did_change(Line line)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// post an update only if one occurred
|
||||||
if(new_line_value != _line_values[line])
|
if(new_line_value != _line_values[line])
|
||||||
{
|
{
|
||||||
_line_values[line] = new_line_value;
|
_line_values[line] = new_line_value;
|
||||||
|
Loading…
Reference in New Issue
Block a user