That’s the frequency of alternate current (50 Hz in Europe). Numeric output of regular base 10 numbers is more difficult.Īs a final note, the TOD clock uses an external frequency as a reference. You may ask, why BCD numbers? BCD numbers are used by TOD clock registers because it’s easier to print them on screen using machine language. The time display routine is hooked-up to the standard interrupt handler, so that current time can be shown while you are using BASIC. The program makes use of a machine language routine to show current time on screen. Here is the program from “Compute!” I have typed-in for you.ĭOWNLOAD: Commodore 64 Clock (by Paul. Otherwise, TOD clock registers will stay frozen. Remember, if you only need to read hours, you also have to read tenths of seconds. That’s why when you read hours, TOD registers are stopped being updated. That may result in a time of 11 hours and 0 minutes, instead of 12 hours and zero minutes. Why is that? For instance, if current time is 11.59.59, if you read the value 11 for hours, you may then risk to read a zero for minutes. Registers updating restarts only when tenths of seconds are also read. The TOD clock keeps running, it’s just that registers are “frozen”. Furthermore, if hours are read, TOD clock registers update process is stopped. The TOD clock only starts when tenths of seconds are set. On register 56328, only the low nybble is used, as we only have one digit for the tenths of seconds. For the second digit instead, all four bits of the low nybble are required. are needed for the first digit of hours, minutes and seconds. So, only 3 bits of the high nybble A nybble is half a byte, that is four bits. And, for minutes and seconds, the first digit will never be greater than 5. For instance, in the AM/PM format, the first digit of hours will never be greater than 1. Please note that bit 7 of these registers is unused, as we will never need it. To store minutes and seconds on registers 5639 the method is the same. As a result, if we want to set hours to the value 12, we need to place the value 18 decimal on register 56331. Now, in order to store it in memory, the BCD number must be seen as a standard binary number. That means, BCD numbers are just base 10 numbers whose digits are represented using base 2.įor instance, the number 12 may be represented in BCD format by using a couple of 4 bits binary numbers, one for each digit. Numbers are stored on these registers using BCD format. 56328: this register is used to store tenths of seconds.56329: this register is used to store seconds. 56330: this register is used to store minutes.Bit 7 is used as a flag for AM/PM (1 = PM, 0 = AM) 56331: this register is used to store hours.Hours, minutes, seconds and tenths of a second are stored on the following CIA #1 registers CIA #2 also has its own TOD clock.: Instead, it makes use of the Time of Day Clock of the CIA #1 chip. The program doesn’t make use of the standard operating system software clock (the jiffy clock referenced by variables TI and TI$). I’ve recently typed-in a nice program from Compute! magazine Issue 43, December 1983 called “Commodore 64 clock”, by Paul F.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |