fix for COM port

This commit is contained in:
Wengier
2021-05-30 17:43:09 -04:00
parent efcbcde48a
commit 1b87a51ccb
2 changed files with 7 additions and 5 deletions

View File

@@ -427,7 +427,6 @@ private:
extern CSerial* serialports[];
const uint8_t serial_defaultirq[] = { 4, 3, 4, 3, 0, 0, 0, 0, 0 };
const uint16_t serial_baseaddr[] = {0x3f8,0x2f8,0x3e8,0x2e8,0,0,0,0,0};
const char* const serial_comname[]={"COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9"};
// the COM devices

View File

@@ -98,10 +98,9 @@ device_COM::~device_COM() {
sclass->mydosdevice = NULL;
}
// COM1 - COM4 objects
// COM1 - COM9 objects
CSerial* serialports[9] ={0,0,0,0,0,0,0,0,0};
uint16_t serial_baseaddr[9] = {0x3f8,0x2f8,0x3e8,0x2e8,0,0,0,0,0};
static Bitu SERIAL_Read (Bitu port, Bitu iolen) {
(void)iolen;//UNUSED
@@ -1122,7 +1121,10 @@ CSerial::CSerial(Bitu id, CommandLine* cmd) {
std::string str;
uint16_t base = serial_baseaddr[id];
if(cmd->FindStringBegin("base:",str,true)) base = (uint16_t)strtol(str.c_str(), NULL, 16);
if(cmd->FindStringBegin("base:",str,true)) {
base = (uint16_t)strtol(str.c_str(), NULL, 16);
serial_baseaddr[id] = base;
}
irq = serial_defaultirq[id];
getBituSubstring("irq:",&irq, cmd);
if (irq < 2 || irq > 15) irq = serial_defaultirq[id];
@@ -1175,6 +1177,7 @@ CSerial::CSerial(Bitu id, CommandLine* cmd) {
txOverrunErrors=0;
overrunIF0=0;
breakErrors=0;
LOG_MSG("Serial%d: BASE %xh",(int)id+1,(int)base);
for (Bitu i = 0; i <= 7; i++) {
WriteHandler[i].Install (i + base, SERIAL_Write, IO_MB);