Difference between revisions of "Modules/tool/mem op"
From MSX Game Library
< Modules
(Created page with "{{MODULE |name=clock |category=Tool |dependency1= |dependency2= |dependency3= |sample1= |sample2= |sample3= }}") |
(No difference)
|
Revision as of 19:35, 14 January 2024
The clock module allow to use MSX2 Real-time Clock (RTC) features including date and time handle, but also save or load data from the embedded non-volatile RAM (CMOS).
Usage
To use this module, include "clock.h" in your source code, and add "clock" to the modules list (LibModules) in your project's configuration file (project_config.js).
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:
- Ricoh RP-5C01 manual (MSX Assembly Page),
- Real Time Clock Programming (MSX Resource Center).
Samples
See module use cases in the sample programs: None yet
Settings
Library configuration (msxgl_config.h):
#define RTC_USE_CLOCK TRUE // Add functions to handle date and time #define RTC_USE_CLOCK_EXTRA TRUE // Add extra date and time functions that require additional data #define RTC_USE_SAVEDATA TRUE // Add functions to read/write into the CMOS #define RTC_USE_SAVESIGNED TRUE // Add signature handling to validate CMOS I/O
Dependencies
Dependency on other modules: None
Documentation