home .. forth .. colorforth mail list archive ..

[colorforth] Clock as in RTC.


Block 50 of the color.com image does not load. It fails on ms, I presume
mSec.
The word it occurs in (hms) seems to ensure the time returned was not read
during or just before an update on the chip.

Reading the data sheet of the MC146818 it states that the time value is not
written to for 244microSeconds after the Update In Progress bit goes high.
UIP bit is b7, register 10 on the chip.
Unless the pc one is using does not adhere to that, the following should
work.

block #50 (compare with original for the proper colors, I have
indicated hex values with $, omit that of course)

Clock macro
p@ $ec 1, ;
p! $ee 1, drop ; forth
ca $70 a! p! $71 a! ;
c@ ca 0 p@ ;
c! ca p! ;
hi 10 c@ $80 and drop if ; then hi ;
lo 10 c@ $80 and drop if lo ; then ;
bcd c@ 16 /mod 10 x + ;
hms lo 4 bcd 100 x 2 bcd + 100 x 0 bcd + ;
ymd lo 9 bcd 100 x 8 bcd + 100 x 7 bcd + ;
day lo 6 c@ -1 + ;
cal hi lo time - hi lo time + ;

Peter.



---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx