mirror of
https://github.com/86Box/86Box.git
synced 2026-03-01 18:34:23 -07:00
Add optional serial console debugging feature
This commit is contained in:
11
src/serial.c
11
src/serial.c
@@ -52,7 +52,7 @@ enum
|
||||
static int next_inst = 0;
|
||||
static serial_device_t serial_devices[SERIAL_MAX];
|
||||
|
||||
|
||||
#define ENABLE_SERIAL_CONSOLE 1
|
||||
#ifdef ENABLE_SERIAL_LOG
|
||||
int serial_do_log = ENABLE_SERIAL_LOG;
|
||||
|
||||
@@ -203,6 +203,15 @@ serial_transmit(serial_t *dev, uint8_t val)
|
||||
write_fifo(dev, val);
|
||||
else if (dev->sd->dev_write)
|
||||
dev->sd->dev_write(dev, dev->sd->priv, val);
|
||||
#ifdef ENABLE_SERIAL_CONSOLE
|
||||
if ((val >= ' ' && val <= '~') || val == '\r' || val == '\n') {
|
||||
fputc(val, stdout);
|
||||
if (val == '\n')
|
||||
fflush(stdout);
|
||||
} else {
|
||||
fprintf(stdout, "[%02X]", val);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user