Martin S�fke wrote:
(... but I missed his first mail. I assume the bug is only in the time display, not in
time going
ahead/back or something similar).

>write('CMOS time: '); {Hack time out of CMOS}
>port[$70]:=(port[$80] and $80) or $04; {Display it in BCD}

Why do you read port $80 instead of port $70? (BTW this is harmless)

Ok, so you set the address latch to read register 4 (hours).

>write(hexbyte(port[$71]));

Read the value in BCD format (default) and display it in hex.
The value is wrong because of a bug in dosemu (missing BCD conversion
for hours). Corrected, thank you.

>write(hexbyte(port[$71]),'  binary:  ');{Display it in Binary}

I hope you didn't think "now I set the clock to binary mode", because
it is still in BCD (you need to write status register B to change mode).
You just display BCD values in decimal, which makes no sense.

BTW the MC146818 datasheets and two of my books say that bit 2=0 means
BCD and 1 means binary. However, a third book says the contrary.
There is a wrong comment in dosemu because of this, but the code
is right.

>port[$70]:=(port[$80] and $80) or $0B;  {Display CMOS settings for clock}
>if (port[$71] and $04)=$04 then write('binary') else write('BCD');
>port[$70]:=(port[$80] and $80) or $0B;
>if (port[$71] and $02)=$02 then write('  24h  ') else write(' am/pm ');
>port[$70]:=(port[$80] and $80) or $0B;
>if (port[$71] and $01)=$01 then writeln(' DLS') else writeln;

Second "bug" in dosemu: the DLS was disabled because it is obsolete and
unused. If you write 1 in bit 0 of status reg B, you still read 0. Give
me a good reason to set this bit...

Patch against 0.99.12 follows. (Hans: I will not resend this one)

begin 644 cmos.dff.gz
M'XL(".X93S<"`V-M;W,N9&9F`*U5R6[;,!`]VU\QO11V)-F2O"26H69Q@[8'
M)T#LG@U*I".BDNB25!84^?<.*7E+D2(%*@210@[?/+YY,Z%\O0:ODC<)4*%8
M47E^;S+I!6%?R;2?$,7ZE#WT"Z[2?EH(U4M?Q?7(P^#-V+;G>>_%;2V(ACEY
MAC"$8!P%HVAX!L%D,FD[CO,O2?=`$_#]*#R-PG$-='$!7C`8N4$(CGT/X>*B
M#2TX@604LY(D.0.2$UD`+W6S,=QN5!M*-#O8&<3J9T4D@T?RP$!4NNW9]3#&
M0`*%H,R%(+Z:?>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