This will be a clock based on the COSMAC ELF 1802 CPU along with some CMOS counters and a time base along with some kind of display.
The plan is that it will display time, date, and year. Since it is an "ELF clock" it will be describing the instant in time, defined as the number of days since the ELF was first described in Popular Electronic Magazine in August of 1976 (8/1/1976). This will be similar to Unix time but without the resolution down to a second.
The time keeping element would be a chain of 8 bit CMOS counters, one for seconds, minutes, and days. These counters could be read as input ports from the CPU.
For software I am trying Tiny Basic to see if it can at least update the display several times per minute. The display will not include seconds in the first revision if using Tiny Basic since it can not complete the calculation fast enough.
I have written the initial conversion of the day counter to calculate year, month, and day accounting for leap year. With a 1.75 Mhz clock speed using the Emma02 emulator it takes 20 seconds for the 300+ lines of code to complete the calculation. Since Tiny Basic only supports 16 bit integers the clock will have a limit of the year 2065.
Below is my code so far. I will remove the spaces after it is debugged to save space but for now it has only been slightly space compressed.
5 PR "SERIAL EPOCH";
10 INPUT S
20 GOSUB 1000
30 GOSUB 3000
55 REM Y=YEAR L=LEAP TRUE/FALSE P=POSITION IN YEAR(DAYS) M=MONTH D=DAY
60 PR "14:23 ";M;"/";D;"/";Y
65 PR "Y=";Y;" L=";L;" P=";P;" M=";M;" D=";D
100 END
1000 IF S>0Y=1976
1005 IF Y=1976L=1
1007 IF Y=1976P=S-0
1010 IF S>153Y=1977
1015 IF Y=1977L=0
1017 IF Y=1977P=S-153
1020 IF S>518Y=1978
1025 IF Y=1978L=0
1027 IF Y=1978P=S-518
1030 IF S>883Y=1979
1035 IF Y=1979L=0
1037 IF Y=1979P=S-883
1040 IF S>1248Y=1980
1045 IF Y=1980L=1
1047 IF Y=1980P=S-1248
1050 IF S>1614Y=1981
1055 IF Y=1981L=0
1057 IF Y=1981P=S-1614
1060 IF S>1979Y=1982
1065 IF Y=1982L=0
1067 IF Y=1982P=S-1979
1070 IF S>2344Y=1983
1075 IF Y=1983L=0
1077 IF Y=1983P=S-2344
1080 IF S>2709Y=1984
1085 IF Y=1984L=1
1087 IF Y=1984P=S-2709
1090 IF S>3075Y=1985
1095 IF Y=1985L=0
1097 IF Y=1985P=S-3075
1100 IF S>3440Y=1986
1105 IF Y=1986L=0
1107 IF Y=1986P=S-3440
1110 IF S>3805Y=1987
1115 IF Y=1987L=0
1117 IF Y=1987P=S-3805
1120 IF S>4170Y=1988
1125 IF Y=1988L=1
1127 IF Y=1988P=S-4170
1130 IF S>4536Y=1989
1135 IF Y=1989L=0
1137 IF Y=1989P=S-4536
1140 IF S>4901Y=1990
1145 IF Y=1990L=0
1147 IF Y=1990P=S-4901
1150 IF S>5266Y=1991
1155 IF Y=1991L=0
1157 IF Y=1991P=S-5266
1160 IF S>5631Y=1992
1165 IF Y=1992L=1
1167 IF Y=1992P=S-5631
1170 IF S>5997Y=1993
1175 IF Y=1993L=0
1177 IF Y=1993P=S-5997
1180 IF S>6362Y=1994
1185 IF Y=1994L=0
1187 IF Y=1994P=S-6362
1190 IF S>6727Y=1995
1195 IF Y=1995L=0
1197 IF Y=1995P=S-6727
1200 IF S>7092Y=1996
1205 IF Y=1996L=1
1207 IF Y=1996P=S-7092
1210 IF S>7458Y=1997
1215 IF Y=1997L=0
1217 IF Y=1997P=S-7458
1220 IF S>7823Y=1998
1225 IF Y=1998L=0
1227 IF Y=1998P=S-7823
1230 IF S>8188Y=1999
1235 IF Y=1999L=0
1237 IF Y=1999P=S-8188
1240 IF S>8553Y=2000
1245 IF Y=2000L=1
1247 IF Y=2000P=S-8553
1250 IF S>8919Y=2001
1255 IF Y=2001L=0
1257 IF Y=2001P=S-8919
1260 IF S>9284Y=2002
1265 IF Y=2002L=0
1267 IF Y=2002P=S-9284
1270 IF S>9649Y=2003
1275 IF Y=2003L=0
1277 IF Y=2003P=S-9649
1280 IF S>10014Y=2004
1285 IF Y=2004L=1
1287 IF Y=2004P=S-10014
1290 IF S>10380Y=2005
1295 IF Y=2005L=0
1297 IF Y=2005P=S-10380
1300 IF S>10745Y=2006
1305 IF Y=2006L=0
1307 IF Y=2006P=S-10745
1310 IF S>11110Y=2007
1315 IF Y=2007L=0
1317 IF Y=2007P=S-11110
1320 IF S>11475Y=2008
1325 IF Y=2008L=1
1327 IF Y=2008P=S-11475
1330 IF S>11841Y=2009
1335 IF Y=2009L=0
1337 IF Y=2009P=S-11841
1340 IF S>12206Y=2010
1345 IF Y=2010L=0
1347 IF Y=2010P=S-12206
1350 IF S>12571Y=2011
1355 IF Y=2011L=0
1357 IF Y=2011P=S-12571
1360 IF S>12936Y=2012
1365 IF Y=2012L=1
1367 IF Y=2012P=S-12936
1370 IF S>13302Y=2013
1375 IF Y=2013L=0
1377 IF Y=2013P=S-13302
1380 IF S>13667Y=2014
1385 IF Y=2014L=0
1387 IF Y=2014P=S-13667
1390 IF S>14032Y=2015
1395 IF Y=2015L=0
1397 IF Y=2015P=S-14032
1400 IF S>14397Y=2016
1405 IF Y=2016L=1
1407 IF Y=2016P=S-14397
1410 IF S>14763Y=2017
1415 IF Y=2017L=0
1417 IF Y=2017P=S-14763
1420 IF S>15128Y=2018
1425 IF Y=2018L=0
1427 IF Y=2018P=S-15128
1430 IF S>15493Y=2019
1435 IF Y=2019L=0
1437 IF Y=2019P=S-15493
1440 IF S>15858Y=2020
1445 IF Y=2020L=1
1447 IF Y=2020P=S-15858
1450 IF S>16224Y=2021
1455 IF Y=2021L=0
1457 IF Y=2021P=S-16224
1460 IF S>16589Y=2022
1465 IF Y=2022L=0
1467 IF Y=2022P=S-16589
1470 IF S>16954Y=2023
1475 IF Y=2023L=0
1477 IF Y=2023P=S-16954
1480 IF S>17319Y=2024
1485 IF Y=2024L=1
1487 IF Y=2024P=S-17319
1490 IF S>17685Y=2025
1495 IF Y=2025L=0
1497 IF Y=2025P=S-17685
1500 IF S>18050Y=2026
1505 IF Y=2026L=0
1507 IF Y=2026P=S-18050
1510 IF S>18415Y=2027
1515 IF Y=2027L=0
1517 IF Y=2027P=S-18415
1520 IF S>18780Y=2028
1525 IF Y=2028L=1
1527 IF Y=2028P=S-18780
1530 IF S>19146Y=2029
1535 IF Y=2029L=0
1537 IF Y=2029P=S-19146
1540 IF S>19511Y=2030
1545 IF Y=2030L=0
1547 IF Y=2030P=S-19511
1550 IF S>19876Y=2031
1555 IF Y=2031L=0
1557 IF Y=2031P=S-19876
1560 IF S>20241Y=2032
1565 IF Y=2032L=1
1567 IF Y=2032P=S-20241
1570 IF S>20607Y=2033
1575 IF Y=2033L=0
1577 IF Y=2033P=S-20607
1580 IF S>20972Y=2034
1585 IF Y=2034L=0
1587 IF Y=2034P=S-20972
1590 IF S>21337Y=2035
1595 IF Y=2035L=0
1597 IF Y=2035P=S-21337
1600 IF S>21702Y=2036
1605 IF Y=2036L=1
1607 IF Y=2036P=S-21702
1610 IF S>22068Y=2037
1615 IF Y=2037L=0
1617 IF Y=2037P=S-22068
1620 IF S>22433Y=2038
1625 IF Y=2038L=0
1627 IF Y=2038P=S-22433
1630 IF S>22798Y=2039
1635 IF Y=2039L=0
1637 IF Y=2039P=S-22798
1640 IF S>23163Y=2040
1645 IF Y=2040L=1
1647 IF Y=2040P=S-23163
1650 IF S>23529Y=2041
1655 IF Y=2041L=0
1657 IF Y=2041P=S-23529
1660 IF S>23894Y=2042
1665 IF Y=2042L=0
1667 IF Y=2042P=S-23894
1670 IF S>24259Y=2043
1675 IF Y=2043L=0
1677 IF Y=2043P=S-24259
1680 IF S>24624Y=2044
1685 IF Y=2044L=1
1687 IF Y=2044P=S-24624
1690 IF S>24990Y=2045
1695 IF Y=2045L=0
1697 IF Y=2045P=S-24990
1700 IF S>25355Y=2046
1705 IF Y=2046L=0
1707 IF Y=2046P=S-25355
1710 IF S>25720Y=2047
1715 IF Y=2047L=0
1717 IF Y=2047P=S-25720
1720 IF S>26085Y=2048
1725 IF Y=2048L=1
1727 IF Y=2048P=S-26085
1730 IF S>26451Y=2049
1735 IF Y=2049L=0
1737 IF Y=2049P=S-26451
1740 IF S>26816Y=2050
1745 IF Y=2050L=0
1747 IF Y=2050P=S-26816
1750 IF S>27181Y=2051
1755 IF Y=2051L=0
1757 IF Y=2051P=S-27181
1760 IF S>27546Y=2052
1765 IF Y=2052L=1
1767 IF Y=2052P=S-27546
1770 IF S>27912Y=2053
1775 IF Y=2053L=0
1777 IF Y=2053P=S-27912
1780 IF S>28277Y=2054
1785 IF Y=2054L=0
1787 IF Y=2054P=S-28277
1790 IF S>28642Y=2055
1795 IF Y=2055L=0
1797 IF Y=2055P=S-28642
1800 IF S>29007Y=2056
1805 IF Y=2056L=1
1807 IF Y=2056P=S-29007
1810 IF S>29373Y=2057
1815 IF Y=2057L=0
1817 IF Y=2057P=S-29373
1820 IF S>29738Y=2058
1825 IF Y=2058L=0
1827 IF Y=2058P=S-29738
1830 IF S>30103Y=2059
1835 IF Y=2059L=0
1837 IF Y=2059P=S-30103
1840 IF S>30468Y=2060
1845 IF Y=2060L=1
1847 IF Y=2060P=S-30468
1850 IF S>30834Y=2061
1855 IF Y=2061L=0
1857 IF Y=2061P=S-30834
1860 IF S>31199Y=2062
1865 IF Y=2062L=0
1867 IF Y=2062P=S-31199
1870 IF S>31564Y=2063
1875 IF Y=2063L=0
1877 IF Y=2063P=S-31564
1880 IF S>31929Y=2064
1885 IF Y=2064L=1
1887 IF Y=2064P=S-31929
1890 IF S>32295Y=2065
1895 IF Y=2065L=0
1897 IF Y=2065P=S-32295
2000 RETURN
3000 IF Y=1976 L=3
3010 IF L=0 GOSUB 4000
3020 IF L=1 GOSUB 5000
3030 IF L=3 GOSUB 6000
3040 RETURN
4000 IF P>0M=1
4010 IF P>0D=P
4020 IF P>31M=2
4030 IF P>31D=P-31
4040 IF P>59M=3
4050 IF P>59D=P-59
4060 IF P>90M=4
4070 IF P>90D=P-90
4080 IF P>120M=5
4090 IF P>120D=P-120
4100 IF P>151M=6
4110 IF P>151D=P-151
4120 IF P>181M=7
4130 IF P>181D=P-181
4140 IF P>212M=8
4150 IF P>212D=P-212
4160 IF P>243M=9
4170 IF P>243D=P-243
4180 IF P>273M=10
4190 IF P>273D=P-273
4200 IF P>304M=11
4210 IF P>304D=P-304
4220 IF P>334M=12
4230 IF P>334D=P-334
4900 RETURN
5000 IF P>0M=1
5010 IF P>0D=P
5020 IF P>31M=2
5030 IF P>31D=P-31
5040 IF P>60M=3
5050 IF P>60D=P-60
5060 IF P>91M=4
5070 IF P>91D=P-91
5080 IF P>121M=5
5090 IF P>121D=P-121
5100 IF P>152M=6
5110 IF P>152D=P-152
5120 IF P>182M=7
5130 IF P>182D=P-182
5140 IF P>213M=8
5150 IF P>213D=P-213
5160 IF P>244M=9
5170 IF P>244D=P-244
5180 IF P>274M=10
5190 IF P>274D=P-274
5200 IF P>305M=11
5210 IF P>305D=P-305
5220 IF P>335M=12
5230 IF P>335D=P-335
5240 RETURN
6000 RETURN
0
No comments:
Post a Comment