OSDN Git Service

[VM][WIP] Use namespace to devices per VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / msx / rtcif.cpp
1 /*
2         ASCII MSX2 Emulator 'yaMSX2'
3
4         Author : umaiboux
5         Date   : 2014.12.xx-
6
7         modified by Takeda.Toshiya
8
9         [ rtc i/f ]
10 */
11
12 #include "rtcif.h"
13
14 namespace MSX {
15
16 void RTCIF::write_io8(uint32_t addr, uint32_t data)
17 {
18         switch(addr & 1) {
19         case 0:
20                 adrs = data & 0x0f;
21                 break;
22         case 1:
23                 d_rtc->write_io8(adrs, data & 0x0f);
24                 break;
25         }
26 }
27
28 uint32_t RTCIF::read_io8(uint32_t addr)
29 {
30         return d_rtc->read_io8(adrs);
31 }
32
33 #define STATE_VERSION   1
34
35 bool RTCIF::process_state(FILEIO* state_fio, bool loading)
36 {
37         if(!state_fio->StateCheckUint32(STATE_VERSION)) {
38                 return false;
39         }
40         if(!state_fio->StateCheckInt32(this_device_id)) {
41                 return false;
42         }
43         state_fio->StateUint8(adrs);
44         return true;
45 }
46
47 }