Using the real-time clock/calendar
M3SE includes a real-time clock/calendar (RTCC) which is compatible with the vintage Alpha Products Newclock-80 device. As shipped, M3SE uses a driver which updates LDOS's software clock from the RTCC once per second as long as interrupts are enabled.
The simplest way to set the RTCC is automatically via the SNTP utility program. To instead manually set the date and time, follow these steps:
To disable the RTCC such that it will not be re-enabled by reboot, issue the command "SYSTEM (SYSGEN)" after running STOPRTCC. The software clock/calendar will still be set from the RTCC at reboot unless you physically remove the RTCC chip from its socket on the M3SE circuit board.
Here's an ad for the original Newclock-80. See the manuals page for data sheets of both the emulated vintage RTCC chip and the modern chip actually used by M3SE.
Timekeeping registers within the RTCC chip are double-shadowed by the M3SE FPGA. They are all read from the chip approximately 15 times per second. The values seen through TRS-80 I/O ports are all updated simultaneously when they are not being accessed.
Interlaced with the burst reads of the RTCC registers are time slots for writing to the RTCC chip if any of the shadowed date/time values have been modified by the TRS-80. Once a value is modified, it will not be updated until the new value has been written to the RTCC chip.
Below are listed the I/O ports and bit assignments used by the RTCC. Values read from unlisted bits should be disregarded.
Port 0xB0 (R/W*): Bits 3:0 - Seconds ones; seconds range is 00-59 Port 0xB1 (R/W*): Bits 2:0 - Seconds tens Port 0xB2 (R/W): Bits 3:0 - Minutes ones; minutes range is 00-59 Port 0xB3 (R/W): Bits 2:0 - Minutes tens Port 0xB4 (R/W): Bits 3:0 - Hours ones; hours range is 00-23 or 01-12 (see below) Port 0xB5 (R/W): Bit 3 - 24-hour time format (not AM/PM)* Bit 2 - Time is PM (not AM) Bits 1:0 - Hours tens Port 0xB6 (R/W): Bits 2:0 - Day of week; 0=Sunday, 6=Saturday Port 0xB7 (R/W): Bits 3:0 - Day of month ones; day of month range is 01-31 Port 0xB8 (R/W): Bit 2 - Leap year* Bits 1:0 - Day of month tens Port 0xB9 (R/W): Bits 3:0 - Month ones; month range is 01-12 Port 0xBA (R/W): Bit 0 - Month tens Port 0xBB (R/W): Bits 3:0 - Year ones; year range is 00-99 Port 0xBC (R/W): Bits 3:0 - Year tens