-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathrtc.h
116 lines (107 loc) · 3 KB
/
rtc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
* rtc.h - Atari NVRAM emulation code - declaration
*
* Copyright (c) 2001-2008 Petr Stehlik of ARAnyM dev team (see AUTHORS)
*
* This file is part of the ARAnyM project which builds a new and powerful
* TOS/FreeMiNT compatible virtual machine running on almost any hardware.
*
* ARAnyM is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ARAnyM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ARAnyM; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _RTC_H
#define _RTC_H
#include "icio.h"
/* NVRAM keyboard setting */
typedef enum {
COUNTRY_US, // USA
COUNTRY_DE, // Germany
COUNTRY_FR, // France
COUNTRY_UK, // United Kingdom
COUNTRY_ES, // Spain
COUNTRY_IT, // Italy
COUNTRY_SE, // Sweden
COUNTRY_SF, // Switzerland (French)
COUNTRY_SG, // Switzerland (German)
COUNTRY_TR, // Turkey
COUNTRY_FI, // Finland
COUNTRY_NO, // Norway
COUNTRY_DK, // Denmark
COUNTRY_SA, // Saudi Arabia
COUNTRY_NL, // Holland
COUNTRY_CZ, // Czech Republic
COUNTRY_HU, // Hungary
// the following entries are from EmuTOS and TOS.HYP (https://freemint.github.io/tos.hyp/en/bios_cookiejar.html#Cookie_2C_20_AKP)
COUNTRY_PL, // Poland
COUNTRY_LT, // Lithuania
COUNTRY_RU, // Russia
COUNTRY_EE, // Estonia
COUNTRY_BY, // Belarus
COUNTRY_UA, // Ukraine
COUNTRY_SK, // Slovak Republic
COUNTRY_RO, // Romania
COUNTRY_BG, // Bulgaria
COUNTRY_SI, // Slovenia
COUNTRY_HR, // Croatia
COUNTRY_RS, // Serbia
COUNTRY_ME, // Montenegro
COUNTRY_MK, // Macedonia
COUNTRY_GR, // Greece
COUNTRY_LV, // Latvia
COUNTRY_IL, // Israel
COUNTRY_ZA, // South Africa
COUNTRY_PT, // Portugal
COUNTRY_BE, // Belgium
COUNTRY_JP, // Japan
COUNTRY_CN, // China
COUNTRY_KR, // Korea
COUNTRY_VN, // Vietnam
COUNTRY_IN, // India
COUNTRY_IR, // Iran
COUNTRY_MN, // Mongolia
COUNTRY_NP, // Nepal
COUNTRY_LA, // Lao People's Democratic Republic
COUNTRY_KH, // Cambodia
COUNTRY_ID, // Indonesia
COUNTRY_BD, // Bangladesh
COUNTRY_MX = 99, // Mexico (found in Atari sources)
} nvram_t;
class RTC : public BASE_IO {
private:
uint8 index;
char nvram_filename[512];
struct tm frozen_time;
public:
RTC(memptr, uint32);
virtual ~RTC();
void reset();
void init(void);
bool load(void);
bool save(void);
virtual uint8 handleRead(memptr);
virtual void handleWrite(memptr, uint8);
nvram_t getNvramKeyboard(void);
private:
void setAddr(uint8 value);
uint8 getData();
void setData(uint8);
void setChecksum();
void patch();
void freezeTime(void);
struct tm getFrozenTime(void);
};
#endif // _RTC_H
/*
vim:ts=4:sw=4:
*/