v86/src/uart.js

33 lines
567 B
JavaScript
Raw Normal View History

2013-11-06 01:12:55 +01:00
/**
* No full implementation, just dumping serial output
* to console
*
* @constructor
*/
2014-01-05 03:19:09 +01:00
function UART(dev, adapter)
2013-11-06 01:12:55 +01:00
{
2014-01-05 03:19:09 +01:00
var io = dev.io,
2013-11-06 01:12:55 +01:00
line = "";
io.register_write(0x3F8, function(out_byte)
{
if(out_byte === 0x0A)
{
2014-01-05 03:19:09 +01:00
adapter.send_line(line);
2013-11-06 01:12:55 +01:00
dbg_log(line, LOG_SERIAL);
2014-01-05 03:19:09 +01:00
2013-11-06 01:12:55 +01:00
line = "";
}
else
{
line += String.fromCharCode(out_byte);
}
});
2013-12-20 22:05:49 +01:00
io.register_read(0x3FD, function(out_byte)
{
// TODO
return 0xFF;
});
2013-11-06 01:12:55 +01:00
}