VOGONS


55 msec timer

Topic actions

First post, by motorhead

User metadata
Rank Newbie
Rank
Newbie

Hi,

I have an old DOS application that uses the 55mSec timer or 55mSec tick from the hardware. Does DOS BOX provide this timer tick to applications?

Reply 1 of 14, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

DOSBox provides a PIT emulation that should cover typical uses, including the default/standard ~18.2Hz (~55ms) interval. Why not go ahead and try it with your app? Keep in mind that DOSBox is intended for games, but maybe your app will work.

Reply 2 of 14, by motorhead

User metadata
Rank Newbie
Rank
Newbie

We're doing 9600 baud serial communication and using the 55 mSec timer to determine the end of a mod bus packet, the application gets out of sync.
I have the source listing if it would be any help to see how we're accessing the timer?

Reply 3 of 14, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Some improvements have been made in SVN regarding serial comm., so maybe try a development build to see if your app works any better. Can't be certain of this, but since you're using the standard timer interval, an issue with serial comm. seems more likely than with timing.

Also, just to get this out of the way, how are you configuring the serial port in DOSBox?

Reply 4 of 14, by motorhead

User metadata
Rank Newbie
Rank
Newbie

Serial 1 = directserial realport:com1

Reply 5 of 14, by eL_PuSHeR

User metadata
Rank l33t++
Rank
l33t++

[Thread moved to DOSBox Games/Apps. Section]

Reply 6 of 14, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

DOSBox can't emulate this sort of hack.

DOSBox works like this: run for a part of a millisecond, pause, run again, pause, later it has something else to do than CPU emulation so doesn't process at all, then the operating system needs some time for itself... it is not in sync with what the serial port does. The serial port driver of the operating system may have its own idea of when to send data, and if you add USB you get the polling interval that throws you off. The internal time of DOSBox is not synced to the actual time, so overloading or longer execution adds more de-syncing.

A lot of factors...

1+1=10

Reply 7 of 14, by motorhead

User metadata
Rank Newbie
Rank
Newbie

We're not using a USB dongle serial port, but the actual hardware com1 port.
I notice your Megabuild6 supports FIFO serial communications.
Our DOS application uses the FIFO of the com port.
It comes down to whether it's the com port or the 55 mSec timer that is causing the problem.
We're trying to determine if DOS BOX can or can not access the 55 mSec tick of days past, or has the hardware mutated into something that can not be accessed any longer?
Others have had good success using your Megabuild6 with serial applications.

Do you think we're out of luck on this one?

Reply 8 of 14, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

The timer is emulated. The real hardware timer is not used for that.

1+1=10

Reply 9 of 14, by motorhead

User metadata
Rank Newbie
Rank
Newbie

So I do have some form of 55 mSec timer available to me, even if it is a virtual timer? I suppose we could be calling a hard address, and not using the virtual timer.

Here are the defines in the "C" language.

/* 18.2 Hz counter */

#define CLK_SEG 0x040 /* 55 msec. counter segment */
#define CLK_OFFSET 0x06C /* 55 msec. counter offset */

It then uses the following statements:

tm = peek( CLK_SEG, CLK_OFFSET ) + dly; /* time-out value */

We're screwed aren't we?

Reply 10 of 14, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

You're screwed anyways if you're trying to use a games-targeting emulator to drive some strange hardware.

Reply 11 of 14, by motorhead

User metadata
Rank Newbie
Rank
Newbie

There is a ton of legacy equipment out there based on DOS, you might have a market there.

Reply 13 of 14, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator
motorhead wrote:

There is a ton of legacy equipment out there based on DOS, you might have a market there.

Yes, there definitely is a market for legacy equipment using companies.
But Dosbox is aimed at games and not at companies running mission critical stuff in an emulator. Plus, they tend to pay badly and ask for good support 😉

Reply 14 of 14, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

DOSBox emulates the timer tick counter your app is using; but it appears you're relying on a tighter relationship than DOSBox has between the timer and what is going on with the serial port.

If modifying the app is not out of the question, maybe the device you're interfacing with offers some hardware (DTR/DTS) or software (XON/XOFF) flow control you can use instead of timing.