1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Centralised and improved serial logging.

This commit is contained in:
Thomas Harte 2016-07-06 07:46:21 -04:00
parent 8819711bc8
commit 428fcdb978
4 changed files with 20 additions and 5 deletions

View File

@ -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::Data, !(value&0x02));
}
printf("1540 serial port VIA port B: %02x\n", value);
// printf("1540 serial port VIA port B: %02x\n", value);
}
else
printf("1540 serial port VIA port A: %02x\n", value);
// else
// printf("1540 serial port VIA port A: %02x\n", 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) {
default: break;
case ::Commodore::Serial::Line::Data: _portB = (_portB & ~0x01) | (value ? 0 : 0x01); break;

View File

@ -10,6 +10,18 @@
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)
{
_ports.push_back(port);
@ -39,6 +51,7 @@ void Bus::set_line_output_did_change(Line line)
// post an update only if one occurred
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;
for(std::weak_ptr<Port> port : _ports)

View File

@ -22,6 +22,8 @@ namespace Serial {
Reset
};
const char *StringForLine(Line line);
class Port;
class Bus {

View File

@ -76,7 +76,7 @@ class UserPortVIA: public MOS::MOS6522<UserPortVIA>, public MOS::MOS6522IRQDeleg
}
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) {
default: break;
case ::Commodore::Serial::Line::Data: _portA = (_portA & ~0x02) | (value ? 0 : 0x02); break;