🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Are there any Watcom C networking libraries?

Started by
15 comments, last by hplus0603 2 years, 10 months ago

Hey all!

I have decided to add multiplayer into my FPS game that I am programming for MS-DOS. I wanted to add in a multiplayer feature into the game to add some replayability, but however, I have yet to figure out how to do networking with the Watcom compiler. I have tried converting some Borland C and MSC code from various books that I have read to Watcom, but I have not gotten much success, unfortunately, as the initialization function doesn't even work, and I can not really find out what is going wrong.

Specifically, I was having an issue with inline assembly:

_asm sti

and

_asm cli

apparently do not want to work with Watcom, and I can not figure out for the life of me what the issue could be, so I just commented them out and the program compiled, but it did not work. I am not sure whether this could have caused connectivity issues with the program, but I took them out, or else the program would not compile, which is confusing me even more. Other than that, I did not change any other part of the code.

So, I am going to try and find a (preferably freeware) networking library to help me out. I know several ones for Borland like IBMCOM, but I can not even find it on Google anymore, and even if I could, I am not sure if there would be a Watcom-compatible version.

Advertisement

Watcom C inline assembly syntax is a bit unusual. Place this at the top of the file that has the inline asembly:

#pragma aux cli = "cli";
#pragma aux cli = "sti";

Then just replace every instance of “_asm sti” with “sti();” and every instance of “_asm cli” with “cli();”. More information of inline assembly in Watcom C here.

@a light breeze Thanks, but that did not fix the issue. It still does not want to initialize. Here is the code that I feel is causing issues:

void Serial_Write(char ch)
{

// waits for the transmit buffer to be empty then writes a character to the transmit 
//buffer. Not interrupt driven.


while(!(inp(open_port + SERIAL_LSR) & 0x20)){}

// turn off interrupts 

cli();

// send the character

outp(open_port + SERIAL_THR, ch);

// turn interrupts on

sti();

} // end Serial_Write

Do you actually have an ISA serial port at that address?

What does the debugger say? (I assume SoftICE is still the thing for DOS development, or maybe the Kool Kids have something even Kooler these days?)

enum Bool { True, False, FileNotFound };

@hplus0603 I suppose so… I am not sure how to check. I dont think watcom supports that. But I have gotten the code to work with Borland, but I dont want to convert all my code back to 16 bit.

@hplus0603 Also, I tried SoftICE and I can not figure out how to use it, and it didnt go well with my VMware Windows 95 machine, so are there any other options?

yaboiryan said:

@hplus0603 I suppose so… I am not sure how to check. I dont think watcom supports that. But I have gotten the code to work with Borland, but I dont want to convert all my code back to 16 bit.

The code you're looking at is trying to talk to a serial port using direct port I/O.

This will only work in real mode. And only if there is actually a serial port device installed at that address. (Of course, a virtual serial port would work in a virtual machine.)

The code also looks kind-of sketchy, as it doesn't seem to implement any time-outs or anything. If there's a serial port there, is it actually connected to any physical device that would assert the DSR and CTS signals and receive the communicated data? Else that loop will just keep waiting for “am I ready to send a byte yet?” (I imagine the 0x20 in the code is the TH bit of the 16550 UART device line status register.)

enum Bool { True, False, FileNotFound };

@hplus0603 Do you know how to get into protected mode in the code? Is there any way I could temporarily do that?

@undefined Or is there a way I could use the port in protected mode? What would the address be?

@hplus0603 And I can figure out the time out stuff… I just need it to connect first. Besides, I already have some functions for time outs that are in the sendInformation function, which is where the code I posted above works its "magic".

This topic is closed to new replies.

Advertisement