The intent is to be able to use the RTC in Commodore BASIC programs that need a real time clock. Programs like a display clock, reminders, or anything else that needs the date and time. All times are in 24 hour format.
The RTC can be hooked into the daisy chain with disk drives and printers, so it is just another peripheral to the computer.
I don't have a Commodore 64 to test with, but since the IEC protocol is the same, it should work just fine with a C64.
Here is BASIC code to read the time and date:
10 OPEN 1,12,1 { open connection to read time }
20 INPUT#1, A$ { read the time = hhmmss}
30 PRINT"{CLEAR}"
40 PRINT LEFT$(A$,2); { display hh:mm:ss }
45 PRINT ":"
50 PRINT MID$(A$,3,2);
55 PRINT ":"
60 PRINT RIGHT$(A$,2)
90 CLOSE 1 { close connection }
100 OPEN 1,12,2 { open connection to read date }
110 INPUT#1, B$ { read the date = yymmdd }
120 PRINT MID$(B$,3,2); { display mm/dd/yy }
130 PRINT "/"
140 PRINT RIGHT$(B$,2);
150 PRINT "/"
160 PRINT LEFT$(B$,2)
200 CLOSE 1
And here is BASIC code to set the time and date:
10 OPEN 1,12,7 { open connection to set time/date }
20 PRINT#1,"YYMMDDhhmmss" { substitute current time and date digits }
{ YY = year, MM = month, DD = day }
{ hh = hour (24), mm = minute, ss = seconds }
30 CLOSE 1 { close connection }
For example, PRINT#1, "250801202235" would set the time and date to Aug 1, 2025, 8:22:35 PM.
M. Bindhammer
mircemk
talofer99
kmatch98