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