Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8233985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:19:23+00:00 2026-06-07T18:19:23+00:00

I’m working with an in-house software tool that displays & logs formatted diagnostic data

  • 0

I’m working with an in-house software tool that displays & logs formatted diagnostic data collected from the serial debug port of the product I develop embedded software for. It’s in C and very old. It’s built using Borland Turbo-C v1.01 (copyright 1990!). If possible I’d prefer to modify rather than rewrite the tool for a modern environment.

I want to collect debug data from several devices at once. I’d envisioned several devices connected via USB->Serial adapters to a hub, connected to a PC (running Windows XP). Run one instance of the diagnostic tool per device (again, in Windows), pointed at the appropriate COM port. Easy, right?

Not quite. Observe the serial port initialization function I’m working with:

void serinit(int baudrate, char paristat, char adaptnum) {
  int hibcon, lobcon, paricon;
  if(adaptnum == '3') {
    sioreg = lowbaud = 0x3E8;     // SIO (Serial I/O Reg.)
    intenreg = highbaud = 0x3E9;  // IER (Interrupt Enable Reg.)
    intidreg = 0x3EA;             // IIR (Interrupt Ident. Reg.)
    linecon = 0x3EB;              // LCR (Line Control Reg.)
    modemcon = 0x3EC;             // MCR (Modem Control Reg.)
    linestat = 0x3ED;             // LSR (Line Status Reg.)
    modemstat = 0x3EE;            // MSR (Modem Status Reg.)
    sintvect = 0x0C;
    sintmask = 0x10;
  } else if(adaptnum == '2') {
    //omitted for brevity, similar to above w/ different magic numbers
  } else {
    //ditto
  }

  outportb(linecon, 0x80);        // LCR - set up to set baud rate

  switch(baudrate) {
    case 9600:  hibcon = 0x00;  lobcon = 0x0C; break;
    //more magic numbers for other baud rates
  }

  outportb(lowbaud, lobcon);            // Baud Rate Divisor LSB
  outportb(highbaud, hibcon);           // Baud Rate Divisor MSB

  switch(paristat) {
    case 'o': //odd parity, 2 stop, 7 data
    case 'O': paricon = 0x0E; break;
    //more magic numbers for other parity settings
  }

  outportb(linecon, paricon);  //Line Control Register
  outportb(intenreg, 0x01);    //IER - receive enabled
  outportb(modemcon, 0x09);    //x x x x +out2 x -rts +dtr

  imodemcon = 0x09;     //update image
  inportb(sioreg);      //Just in case there's anything lurking in the register
  intvsave = getvect(sintvect);
  setvect(sintvect, serint);   //Set up interrupt vector.
  outportb(0x21, inportb(0x21) & !sintmask); //OCW 1 - enable serial interrupts
}

What’re my options for adapting this kind of configuration for COM ports 5+ as the USB->Serial adapters will show up as? I can see them as expected with the DOS mode command (and in the Windows device manager like a normal human being), but I’m unsure how to access them from the diagnostic program.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T18:19:25+00:00Added an answer on June 7, 2026 at 6:19 pm

    Directly addressing the I/O registers requires a device driver that emulates the behavior of a traditional COM port. The standard Microsoft device driver does this. But you are not using that driver, you’ve got a vendor specific USB driver.

    Those drivers emulate a serial port by wiring themselves into the standard winapi functions for serial ports. Like CreateFile(), SetCommConfig(), etcetera. Which requires writing 32-bit code to use those functions. What they don’t do is emulate the registers so DOS apps can still work, that’s over and done with. And cannot work in general, DOS only supported 4 COM ports so only 4 sets of registers where ever used. There are no standard register addresses for COM5 and up.

    Maybe you can find a USB emulator with a driver that still does this. But I’d consider the odds very low. Instead, marry your ’90s software to ’90s hardware. Buy an old-fashioned PCI card that you screw into the bus. So that the standard Microsoft driver works. Those cards were still available last time I looked (fat year ago) although pickings were getting slim. Or dig one out of an old machine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a bunch of posts stored in text files formatted in yaml/textile (from
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.