// Meteor - A Nintendo Gameboy Advance emulator1// Copyright (C) 2009-2011 Philippe Daouadi2//3// This program is free software: you can redistribute it and/or modify4// it under the terms of the GNU General Public License as published by5// the Free Software Foundation, either version 3 of the License, or6// (at your option) any later version.7//8// This program is distributed in the hope that it will be useful,9// but WITHOUT ANY WARRANTY; without even the implied warranty of10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11// GNU General Public License for more details.12//13// You should have received a copy of the GNU General Public License14// along with this program. If not, see <http://www.gnu.org/licenses/>.1516#ifndef __EEPROM_H__17#define __EEPROM_H__1819#include "cartmem.hpp"20#include <stdint.h>21#include <istream>22#include <ostream>2324namespace AMeteor25{26class Eeprom : public CartMem27{28public :29Eeprom (bool big);3031void Reset ();3233uint16_t GetSize () const34{35return m_size;36}3738bool Load (std::istream& f);39bool Save (std::ostream& f);4041uint8_t Read (uint16_t add);42bool Write (uint16_t add, uint8_t val);4344uint16_t Read ();45//bool Write (uint16_t val);4647bool Write (uint16_t* data, uint16_t size);48//XXX49#if 050void Read (uint16_t* pOut);51#endif5253bool SaveState (std::ostream& stream);54bool LoadState (std::istream& stream);5556private :57enum State58{59IDLE,60//WAITING,6162//READ_ADD,63//READ_END,64READ_GARBAGE,65READ_DATA6667/*WRITE_ADD,68WRITE_DATA,69WRITE_END*/70};7172uint8_t m_state;73uint16_t m_add;74uint8_t m_pos;75};76}7778#endif798081