Z80 Assembly 42: Interfacing with a Real-Time Clock (RTC) Chip
The Need for a Real-Time Clock The Z80’s internal clock is only useful for instruction timing. It cannot track actual time (hours, minutes, days). A Real-Time Clock (RTC) is a separate, dedicated chip (like the DS1307 or MC146818) that contains its own crystal oscillator and often a small battery to maintain time even when the main computer is powered off. Communication: Indexed I/O The Z80 communicates with an RTC chip using a method called indexed I/O (similar to how the AY sound chip works). The RTC has a set of internal registers (e.g., 0-12) that store the seconds, minutes, hours, day, date, and control flags. ...