joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.8k stars 383 forks source link

Can the Date/Time be passed to BIOS? #3764

Open bdhirsch-code opened 2 years ago

bdhirsch-code commented 2 years ago

Question

I'm running a legacy DOS application using Dosbox-X running in Windows 10. The computer BIOS date/time is passed to Windows, which passes it to the application upon DOSBox launch, which is fine. My question is, is there a way for my DOS application to update the BIOS date/time the way Windows does? The users of the DOS application sometimes need to change the date and time within the application, and it would be great if the computer BIOS would update at the same time to make the setting persistent between computer shutdowns.

Have you checked that no similar question(s) exist?

Code of Conduct & Contributing Guidelines

rderooy commented 2 years ago

You can update the date/time within DOSBox-X, which is useful for some applications that cannot handle the current date, or for some games that had eastereggs on certain dates like xmas or new year.

But this cannot be propogated to the host. Doing so would be BAD in my view from a security perspective. Also, updating the host date/time is different for each host OS and will typically require privilege escalation.

bdhirsch-code commented 2 years ago

I have also observed an extremely intermittent problem running our Borland compiled business application in DOSBox (in Windows 10), and I’m hoping DOSBox-X may solve this. The application polls the keyboard and a serial port when “resting” on the main home screen in a “roll your own” screensaver mode. The screen is kept black to conserve battery power until the user presses one of the keys, and our application will “wake up” and display the home page text. The problem is that sometimes the text appears to shrink from normal 12-14 point type to a small screen font size (~6-8 point), and the application doesn’t respond to serial port inputs either. When restarting the application everything goes back to normal.

The Windows event log doesn’t provide any clues, and the device manager reports all is normal with the serial port. Because this only rarely happens I haven’t been able to isolate the cause. We haven’t observed this behavior when running the application in native MS-DOS or ROM-DOS. Any thoughts?

From: Robert Sent: Thursday, September 29, 2022 05:00 AM To: joncampbell123/dosbox-x @.> Cc: bdhirsch-code @.>; Author @.***> Subject: Re: [joncampbell123/dosbox-x] Can the Date/Time be passed to BIOS? (Issue #3764)

You can update the date/time within DOSBox-X, which is useful for some applications that cannot handle the current date, or for some games that had eastereggs on certain dates like xmas or new year. But this cannot be propogated to the host. Doing so would be BAD in my view from a security perspective. Also, updating the host date/time is different for each host OS and will typically require privilege escalation. — Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/3764#issuecomment-1261982238 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ASV7MBGYIXIN4FXIIAZRAPLWAVLA7ANCNFSM6AAAAAAQYGNODE . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ASV7MBDTWS3JZ5XKX4CVQNTWAVLA7A5CNFSM6AAAAAAQYGNODGWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSLHBJB4.gif Message ID: @.***>

bdhirsch-code commented 2 years ago

Update: DOSBox-X didn't solve the font problem. Both versions exhibit the same intermittent font shrinking behavior, even though the software consistently displays the correct font when executed within a native DOS environment.

bdhirsch-code commented 2 years ago

I'm going to post this as a new question.

Keatah commented 2 years ago

Perhaps this could be done as a delta file - where Dosbox looks at the current host time and its own time, then creates a delta file upon exit. Next time Dosbox is loaded, it will real the file, and apply the correction.

1- Say DB is operating in 1998 and is running a program with its date as Jan-27-1998.

2- Shutdown DB. DB checks host date (OCT-15-2022) and internal time (Jan-27-1998) and determines its clock is 9028 days in the past. Good. It saves that in a date-delta file.

3- Restart DB. DB checks the date-delta file, and reads the host clock as usual. It then subtracts 9028 days from the current date (OCT-15-2022). And now it's running back in (Jan-27-1998).

rderooy commented 2 years ago

You could do that also from a small DOS program within dosbox-x. Run it after closing the application (possibly from the batch file that starts it), and run it before starting the application.