mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-05-09 03:41:10 +08:00
RTC: Fix "safe read bit", fix time test that was reversed and causing major delays for time/date access
This commit is contained in:
parent
378d194972
commit
83785c99bc
@ -423,21 +423,13 @@ static Bitu cmos_readreg(Bitu port,Bitu iolen) {
|
||||
case 0x05: /* Hours Alarm */
|
||||
return cmos.regs[cmos.reg];
|
||||
case 0x0a: /* Status register A */
|
||||
if(date_host_forced) {
|
||||
// take bit 7 of reg b into account (if set, never updates)
|
||||
gettimeofday (&cmos.safetime, NULL); // get current UTC time
|
||||
if (cmos.lock || // if lock then never updated, so reading safe
|
||||
cmos.safetime.tv_usec < (1000-244)) { // if 0, at least 244 usec should be available
|
||||
return cmos.regs[0x0a]; // reading safe
|
||||
} else {
|
||||
return cmos.regs[0x0a] | 0x80; // reading not safe!
|
||||
}
|
||||
// take bit 7 of reg b into account (if set, never updates)
|
||||
gettimeofday (&cmos.safetime, NULL); // get current UTC time
|
||||
if (cmos.lock || // if lock then never updated, so reading safe
|
||||
cmos.safetime.tv_usec >= (1000-244)) { // if 0, at least 244 usec should be available
|
||||
return cmos.regs[0x0a]; // reading safe
|
||||
} else {
|
||||
if (PIC_TickIndex()<0.002) {
|
||||
return (cmos.regs[0x0a]&0x7f) | 0x80;
|
||||
} else {
|
||||
return (cmos.regs[0x0a]&0x7f);
|
||||
}
|
||||
return cmos.regs[0x0a] | 0x80; // reading not safe!
|
||||
}
|
||||
case 0x0c: /* Status register C */
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user