/***************************************************************************1* Copyright (C) 2007 by Sindre Aamås *2* [email protected] *3* *4* This program is free software; you can redistribute it and/or modify *5* it under the terms of the GNU General Public License version 2 as *6* published by the Free Software Foundation. *7* *8* This program is distributed in the hope that it will be useful, *9* but WITHOUT ANY WARRANTY; without even the implied warranty of *10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *11* GNU General Public License version 2 for more details. *12* *13* You should have received a copy of the GNU General Public License *14* version 2 along with this program; if not, write to the *15* Free Software Foundation, Inc., *16* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *17***************************************************************************/18#ifndef VIDEO_LYC_IRQ_H19#define VIDEO_LYC_IRQ_H2021#include "newstate.h"2223namespace gambatte {2425struct SaveState;26class LyCounter;2728class LycIrq {29unsigned long time_;30unsigned char lycRegSrc_;31unsigned char statRegSrc_;32unsigned char lycReg_;33unsigned char statReg_;34bool cgb_;3536void regChange(unsigned statReg, unsigned lycReg, const LyCounter &lyCounter, unsigned long cc);3738public:39LycIrq();40void doEvent(unsigned char *ifreg, const LyCounter &lyCounter);41unsigned lycReg() const { return lycRegSrc_; }42void loadState(const SaveState &state);43unsigned long time() const { return time_; }44void setCgb(const bool cgb) { cgb_ = cgb; }45void lcdReset();46void reschedule(const LyCounter & lyCounter, unsigned long cc);4748void statRegChange(unsigned statReg, const LyCounter &lyCounter, unsigned long cc) {49regChange(statReg, lycRegSrc_, lyCounter, cc);50}5152void lycRegChange(unsigned lycReg, const LyCounter &lyCounter, unsigned long cc) {53regChange(statRegSrc_, lycReg, lyCounter, cc);54}5556template<bool isReader>void SyncState(NewState *ns);57};5859}6061#endif626364