Difference between revisions of "Modules/clock/Usage"

From MSX Game Library

< Modules‎ | clock

 
Line 15: Line 15:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
The MSX 2 real-time clock is a Ricoh RP-5C01. For more information about this device:
+
The MSX2 real-time clock is a Ricoh RP-5C01. For more information about this device:
 
* [https://map.grauw.nl/resources/rtc/ricoh_rp5c01.pdf Ricoh RP-5C01 manual] (MSX Assembly Page),
 
* [https://map.grauw.nl/resources/rtc/ricoh_rp5c01.pdf Ricoh RP-5C01 manual] (MSX Assembly Page),
 
* [https://www.msx.org/wiki/Real_Time_Clock_Programming Real Time Clock Programming] (MSX Resource Center).
 
* [https://www.msx.org/wiki/Real_Time_Clock_Programming Real Time Clock Programming] (MSX Resource Center).

Latest revision as of 12:31, 13 January 2024

For example, display the current year:

RTC_Initialize();
u8 year = RTC_GetYear();
Print_DrawFormat("This year: %i", 1980 + year);

Save data to CMOS memory:

u8 saveData[6];
saveData[0] = 0xFF;
saveData[1] = 100;
saveData[2] = 0;
RTC_SaveData(saveData);

The MSX2 real-time clock is a Ricoh RP-5C01. For more information about this device: