mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-29 12:50:28 +00:00
Centralised and improved serial logging.
This commit is contained in:
parent
8819711bc8
commit
428fcdb978
@ -38,14 +38,14 @@ class SerialPortVIA: public MOS::MOS6522<SerialPortVIA>, public MOS::MOS6522IRQD
|
|||||||
serialPort->set_output(::Commodore::Serial::Line::Clock, !(value&0x08));
|
serialPort->set_output(::Commodore::Serial::Line::Clock, !(value&0x08));
|
||||||
serialPort->set_output(::Commodore::Serial::Line::Data, !(value&0x02));
|
serialPort->set_output(::Commodore::Serial::Line::Data, !(value&0x02));
|
||||||
}
|
}
|
||||||
printf("1540 serial port VIA port B: %02x\n", value);
|
// printf("1540 serial port VIA port B: %02x\n", value);
|
||||||
}
|
}
|
||||||
else
|
// else
|
||||||
printf("1540 serial port VIA port A: %02x\n", value);
|
// printf("1540 serial port VIA port A: %02x\n", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_serial_line_state(::Commodore::Serial::Line line, bool value) {
|
void set_serial_line_state(::Commodore::Serial::Line line, bool value) {
|
||||||
printf("1540 Serial port line %d: %s\n", line, value ? "on" : "off");
|
// printf("1540 Serial port line %d: %s\n", line, value ? "on" : "off");
|
||||||
switch(line) {
|
switch(line) {
|
||||||
default: break;
|
default: break;
|
||||||
case ::Commodore::Serial::Line::Data: _portB = (_portB & ~0x01) | (value ? 0 : 0x01); break;
|
case ::Commodore::Serial::Line::Data: _portB = (_portB & ~0x01) | (value ? 0 : 0x01); break;
|
||||||
|
@ -10,6 +10,18 @@
|
|||||||
|
|
||||||
using namespace Commodore::Serial;
|
using namespace Commodore::Serial;
|
||||||
|
|
||||||
|
const char *::Commodore::Serial::StringForLine(Line line)
|
||||||
|
{
|
||||||
|
switch(line)
|
||||||
|
{
|
||||||
|
case ServiceRequest: return "Service request";
|
||||||
|
case Attention: return "Attention";
|
||||||
|
case Clock: return "Clock";
|
||||||
|
case Data: return "Data";
|
||||||
|
case Reset: return "Reset";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
@ -39,6 +51,7 @@ void Bus::set_line_output_did_change(Line line)
|
|||||||
// post an update only if one occurred
|
// post an update only if one occurred
|
||||||
if(new_line_value != _line_values[line])
|
if(new_line_value != _line_values[line])
|
||||||
{
|
{
|
||||||
|
printf("[Bus] %s is %s\n", StringForLine(line), new_line_value ? "true" : "false");
|
||||||
_line_values[line] = new_line_value;
|
_line_values[line] = new_line_value;
|
||||||
|
|
||||||
for(std::weak_ptr<Port> port : _ports)
|
for(std::weak_ptr<Port> port : _ports)
|
||||||
|
@ -22,6 +22,8 @@ namespace Serial {
|
|||||||
Reset
|
Reset
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char *StringForLine(Line line);
|
||||||
|
|
||||||
class Port;
|
class Port;
|
||||||
|
|
||||||
class Bus {
|
class Bus {
|
||||||
|
@ -76,7 +76,7 @@ class UserPortVIA: public MOS::MOS6522<UserPortVIA>, public MOS::MOS6522IRQDeleg
|
|||||||
}
|
}
|
||||||
|
|
||||||
void set_serial_line_state(::Commodore::Serial::Line line, bool value) {
|
void set_serial_line_state(::Commodore::Serial::Line line, bool value) {
|
||||||
printf("VIC Serial port line %d: %s\n", line, value ? "on" : "off");
|
// printf("VIC Serial port line %d: %s\n", line, value ? "on" : "off");
|
||||||
switch(line) {
|
switch(line) {
|
||||||
default: break;
|
default: break;
|
||||||
case ::Commodore::Serial::Line::Data: _portA = (_portA & ~0x02) | (value ? 0 : 0x02); break;
|
case ::Commodore::Serial::Line::Data: _portA = (_portA & ~0x02) | (value ? 0 : 0x02); break;
|
||||||
|
Loading…
Reference in New Issue
Block a user