wd wrote:Don't know, at the moment the dos time/bios time/cmos time/ticks
are consistent, but i'm not sure in what way they are really de […] Show full quote
Don't know, at the moment the dos time/bios time/cmos time/ticks
are consistent, but i'm not sure in what way they are really dependent
under dos. Maybe the file create times might be a problem (afair
dosbox leaves the current system time set on them).
FCBwrite uses the dos structure's date, I'll change that (probably remove de date-field), otherwise I couldn't find anything. I tested the CMOS clock, it works now, I'll have to check BIOS RTC support (int 1ah), and have DOS int 21h call the BIOS functions. Possibly finished this evening, but more likely next week.
Well the regular dos file creation functions use fopen on the host level,
and for querying the time (findfirst i think) stat returns that time/date.
If the dos time/date is set (in dosbox) to a different value, this should
maybe modified accordingly. Packers/unpackers use that stuff iirc.
wd wrote:> otherwise I couldn't find anything. […] Show full quote
> otherwise I couldn't find anything.
Well the regular dos file creation functions use fopen on the host level,
and for querying the time (findfirst i think) stat returns that time/date.
If the dos time/date is set (in dosbox) to a different value, this should
maybe modified accordingly. Packers/unpackers use that stuff iirc.
Yes, I agree that may remain problematic, I'll have to look into that. Otherwise, the CMOS and BIOS are done now (a few tests to be performed yet). CMOS RTC is now almost completely emulated, including correct am/pm and non-BCD modes, 'lock' bit (bit 7 of statreg B) and 'update in progress' bit (bit 7 of statreg A). Both reading/writing possible, after writing an offset is kept from UTC to determine 'DOSbox time'.
Ok, time for a small update. I sent Qbix my alterations to bios.cpp, dos.cpp and cmos.cpp to check. I tested them, though not as extensively as I would like, and everything seems to function fine. I did not alter any routines that use the dos.date field (FCB routines), that's for another exercise. It would be nice to have commandline date/time functions, but unfortunately I have no time to implement that. I included the latest version of the above mentioned files. They are based on the 0.65 sources, not the CVS.
I attached a midi software ocplay. Another one is a patch that I applied for cvs .
Run play/ocp10/ocplay.exe in dosbox then move your mouse cursor or play midi file. Mouse cursor stops moving, and playing sound is stuttering every second.
Last edited by ykhwong on 2006-10-05, 14:56. Edited 1 time in total.
Has this patch been incorporated in the current (or any) releases? I am currently using .72, and I am having problems similar to other users in this thread.
Research progress is accomplished through two time measurements:
1. The amount of time taken to accomplish a mission and
2. Your […] Show full quote
Research progress is accomplished through two time measurements:
1. The amount of time taken to accomplish a mission and
2. Your computer's internal clock.
That is, once your computer's internal clock strikes 12 o'clock, a new day begins and research progresses.
Wouldn't it be a lot easier to just read the system time (with e.g. time()), and convert that to the right value (with e.g. localtime()) at the int 21h call, not using the BIOS values? The fact that 'real' DOS does it this way shouldn't stop DOSbox from doing a better job?
I think so. I was running an old MS DOS punch clock program on my Linux server using Dosemu. I switched to FreeBSD and had the problem Dosemu isn't ported to FreeBSD.
DosBox runs fine but has the date problem. I patched dos.cpp to return the server time:
1 case 0x2a: /* Get System Date */ 2 { 3 struct timeval tv; 4 struct timezone tz; 5 struct tm *loctime; 6 7 gettimeofday(&tv, &tz); 8 loctime=localtime(&tv.tv_sec); 9 10 reg_al=loctime->tm_wday; 11 reg_cx=1900+loctime->tm_year; 12 reg_dh=1+loctime->tm_mon; 13 reg_dl=loctime->tm_mday; 14 15// int a = (14 - dos.date.month)/12; 16// int y = dos.date.year - a; 17// int m = dos.date.month + 12*a - 2; 18// reg_al=(dos.date.day+y+(y/4)-(y/100)+(y/400)+(31*m)/12) % 7; 19// reg_cx=dos.date.year; 20// reg_dh=dos.date.month; 21// reg_dl=dos.date.day; 22 }
and
1 case 0x2c: /* Get System Time */ 2//TODO Get time through bios calls date is fixed 3 { 4 struct timeval tv; 5 struct timezone tz; 6 struct tm *loctime; 7 8 gettimeofday(&tv, &tz); 9 loctime=localtime(&tv.tv_sec); 10 11 reg_ch=(Bit8u)(loctime->tm_hour); 12 reg_cl=(Bit8u)(loctime->tm_min); 13 reg_dh=(Bit8u)(loctime->tm_sec); 14 reg_dl=(Bit8u)(tv.tv_usec/10000); 15/* Calculate how many miliseconds have passed */ 16// Bitu ticks=5*mem_readd(BIOS_TIMER); 17// ticks = ((ticks / 59659u) << 16) + ((ticks % 59659u) << 16) / 59659u; 18// Bitu seconds=(ticks/100); 19// reg_ch=(Bit8u)(seconds/3600); 20// reg_cl=(Bit8u)((seconds % 3600)/60); 21// reg_dh=(Bit8u)(seconds % 60); 22// reg_dl=(Bit8u)(ticks % 100); 23 }
Now my application runs fine. I hope the code is useful for someone else too.