Fix style and hide extra COM ports behind options
This commit is contained in:
parent
0bce005cc0
commit
e237b218c9
|
@ -121,6 +121,9 @@ function V86Starter(options)
|
|||
settings.fastboot = options["fastboot"] || false;
|
||||
settings.fda = undefined;
|
||||
settings.fdb = undefined;
|
||||
settings.uart1 = options["uart1"] || false;
|
||||
settings.uart2 = options["uart2"] || false;
|
||||
settings.uart3 = options["uart3"] || false;
|
||||
|
||||
if(options["network_relay_url"])
|
||||
{
|
||||
|
|
22
src/cpu.js
22
src/cpu.js
|
@ -333,7 +333,7 @@ CPU.prototype.get_state = function()
|
|||
state[51] = this.devices.hpet;
|
||||
state[52] = this.devices.vga;
|
||||
state[53] = this.devices.ps2;
|
||||
state[54] = this.devices.uart;
|
||||
state[54] = this.devices.uart0;
|
||||
state[55] = this.devices.fdc;
|
||||
state[56] = this.devices.cdrom;
|
||||
state[57] = this.devices.hda;
|
||||
|
@ -413,7 +413,7 @@ CPU.prototype.set_state = function(state)
|
|||
this.devices.hpet = state[51];
|
||||
this.devices.vga = state[52];
|
||||
this.devices.ps2 = state[53];
|
||||
this.devices.uart = state[54];
|
||||
this.devices.uart0 = state[54];
|
||||
this.devices.fdc = state[55];
|
||||
this.devices.cdrom = state[56];
|
||||
this.devices.hda = state[57];
|
||||
|
@ -740,10 +740,20 @@ CPU.prototype.init = function(settings, device_bus)
|
|||
|
||||
this.devices.ps2 = new PS2(this, device_bus);
|
||||
|
||||
this.devices.uart = new UART(this, 0x3F8, device_bus);
|
||||
this.devices.uart1 = new UART(this, 0x2F8, device_bus);
|
||||
this.devices.uart2 = new UART(this, 0x3E8, device_bus);
|
||||
this.devices.uart3 = new UART(this, 0x2E8, device_bus);
|
||||
this.devices.uart0 = new UART(this, 0x3F8, device_bus);
|
||||
|
||||
if(settings.uart1)
|
||||
{
|
||||
this.devices.uart1 = new UART(this, 0x2F8, device_bus);
|
||||
}
|
||||
if(settings.uart2)
|
||||
{
|
||||
this.devices.uart2 = new UART(this, 0x3E8, device_bus);
|
||||
}
|
||||
if(settings.uart3)
|
||||
{
|
||||
this.devices.uart3 = new UART(this, 0x3E8, device_bus);
|
||||
}
|
||||
|
||||
this.devices.fdc = new FloppyController(this, settings.fda, settings.fdb);
|
||||
|
||||
|
|
42
src/uart.js
42
src/uart.js
|
@ -69,26 +69,28 @@ function UART(cpu, port, bus)
|
|||
|
||||
this.current_line = [];
|
||||
|
||||
switch(port) {
|
||||
case 0x3F8:
|
||||
this.com = 0;
|
||||
this.irq = 4;
|
||||
break;
|
||||
case 0x2F8:
|
||||
this.com = 1;
|
||||
this.irq = 3;
|
||||
break;
|
||||
case 0x3E8:
|
||||
this.com = 2;
|
||||
this.irq = 4;
|
||||
break;
|
||||
case 0x2E8:
|
||||
this.com = 3;
|
||||
this.irq = 3;
|
||||
break;
|
||||
default:
|
||||
dbg_log("Invalid port: " + h(port), LOG_SERIAL);
|
||||
return;
|
||||
switch(port)
|
||||
{
|
||||
case 0x3F8:
|
||||
this.com = 0;
|
||||
this.irq = 4;
|
||||
break;
|
||||
case 0x2F8:
|
||||
this.com = 1;
|
||||
this.irq = 3;
|
||||
break;
|
||||
case 0x3E8:
|
||||
this.com = 2;
|
||||
this.irq = 4;
|
||||
break;
|
||||
case 0x2E8:
|
||||
this.com = 3;
|
||||
this.irq = 3;
|
||||
break;
|
||||
default:
|
||||
dbg_log("Invalid serial port: " + h(port), LOG_SERIAL);
|
||||
this.com = 0;
|
||||
this.irq = 4;
|
||||
}
|
||||
|
||||
this.bus.register("serial" + this.com + "-input", function(data)
|
||||
|
|
Loading…
Reference in a new issue